个人工具
登录
查看“MATLAB”的源代码 - Ubuntu中文
页面
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“MATLAB”的源代码
来自Ubuntu中文
←
MATLAB
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=== OpenGL 和 MATLAB === If you are having problems with openGL doing stupid things like rendering surface patches in the wrong order, or getting errors saying that ''OpenGL not available, using ZBuffer'', and are using a version older than R14SP2, then you might have to do a bit of work to get things running right. The source for most of the thinking in this part is [http://www.mathworks.com/support/solutions/data/1-18N21.html?solution=1-18N21 MathWorks] Once you've gotten the MATLAB desktop up and running, at the prompt enter the '''opengl info''' command, as in the following example: <pre><nowiki> >> opengl info Version = 2.0.0 NVIDIA 76.64 Vendor = NVIDIA Corporation Renderer = GeForce FX 5200/PCI/SSE2 MaxTextureSize = 4096 Extensions = GL_ARB_depth_texture GL_ARB_fragment_program GL_ARB_fragment_program_shadow ... </nowiki></pre> 你的结果应当是和上面不一样的,但最重要的部分是 Renderer 这一行。在我的例子中,它显示了使用的显卡的名称。如果你使用了软件渲染,那一行就会显示 '''Mesa X11 '''。如果你有一个显卡,但没有得到硬件加速,你也许会需要使用 manufacturers 驱动,这个问题已经有很多相关文档了。 如果它不是你的显卡的驱动,那么打开一个终端输入下列命令: <pre><nowiki> ldd /usr/local/matlab/bin/glnx86/glren.so </nowiki></pre> 命令的输出将展示你 openGL 的库文件是否都在合适的位置。这里是一个工作配置的输出示例。 <pre><nowiki> $ldd /usr/local/matlab/bin/glnx86/glren.so libmx.so => not found libut.so => not found libmwudd.so => not found libmwservices.so => not found libGL.so => /usr/lib/libGL.so (0xb7f45000) libGLU.so => /usr/X11R6/lib/libGLU.so (0xb7ecf000) libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0xb7ec2000) libXp.so.6 => /usr/X11R6/lib/libXp.so.6 (0xb7eba000) libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0xb7e6a000) libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0xb7da5000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c78000) libGLcore.so.1 => /usr/lib/libGLcore.so.1 (0xb750f000) libnvidia-tls.so.1 => /usr/lib/tls/libnvidia-tls.so.1 (0xb750d000) libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb74ec000) libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb74e8000) libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0xb742e000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7423000) libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0xb741a000) libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0xb7402000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) </nowiki></pre> 如果你丢失了这个清单中的一个重要的库,但它是安装好的,那么你需要为它创建一个链接。让我们看这一行,'''libGL.so => not found'''。在一个终端中你要运行下列命令: <pre><nowiki> cd /usr/local/matlab/sys/opengl/lib/glnx86 dpkg -S libGL.so ln -s /usr/lib/libGL.so libGL.so </nowiki></pre> The odds of you having this problem is fairly low if you are using the proper drivers for your videocard. If you cannot find the missing library, try to find and install it using '''apt-cache search <term>''', where <term> is something like ''libXt''. If things still aren't working well, but do work kinda, the problem is probably MATLAB being silly and not using the right XVisual. We test this by opening up the MATLAB desktop and running the following code <pre><nowiki> hf=figure; set(hf,'renderer','opengl'); get(hf,'xvisual') </nowiki></pre> 这将返回一个字符串,例如 '''0x21 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)'''.。我们使用它来检查 '''glxinfo''',为了确认 MATLAB 不笨。 <pre><nowiki> glxinfo | grep 0x21 | awk '{print $15}' </nowiki></pre> 如果它返回了 24 (和 MATLAB 给出的深度相匹配),那么一切都是正常的。如果它是 0 ,你需要为 XVisual 找另外一个值。最简单的方法是使用 glxinfo 。 <pre><nowiki> glxinfo | grep tc | grep y </nowiki></pre> 选择一个最后一列不是 ''Slow'' 的行 - 可能是 ''None'' ,并且在第 15 列是 24 的行。这是一个示例输出。 <pre><nowiki> 0x21 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 0 0 None 0x23 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 0 0 None 0x26 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 0 0 None 0x27 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 0 0 None 0x2a 24 tc 0 32 0 r y . 8 8 8 0 4 16 0 16 16 16 16 0 0 None 0x2b 24 tc 0 32 0 r y . 8 8 8 8 4 16 0 16 16 16 16 0 0 None 0x2e 24 tc 0 32 0 r y . 8 8 8 0 4 0 0 16 16 16 16 0 0 None 0x2f 24 tc 0 32 0 r y . 8 8 8 8 4 0 0 16 16 16 16 0 0 None 0x32 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 2 1 Ncon 0x33 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 2 1 Ncon 0x34 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 4 1 Ncon 0x35 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 4 1 Ncon 0x3a 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 2 1 Ncon 0x3b 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 2 1 Ncon 0x3c 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 4 1 Ncon 0x3d 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 4 1 Ncon 0x42 24 tc 0 32 0 r y . 8 8 8 0 4 16 0 16 16 16 16 2 1 Ncon 0x43 24 tc 0 32 0 r y . 8 8 8 8 4 16 0 16 16 16 16 2 1 Ncon 0x44 24 tc 0 32 0 r y . 8 8 8 0 4 16 0 16 16 16 16 4 1 Ncon 0x45 24 tc 0 32 0 r y . 8 8 8 8 4 16 0 16 16 16 16 4 1 Ncon </nowiki></pre> 如果我们选择 0x26 来为 XVisual 使用。在 MATLAB 里设定,只需要运行 <pre><nowiki> set(0,'defaultfigurexvisual','0x26'); </nowiki></pre> 添加到你的 startup.m 文件里,你将得到一个全新的 openGL 图像。 [[category:CategoryDocumentation]] [[category:CategoryCleanup]] ---- * [[等待翻译]]
返回至
MATLAB
。