如何在Ubuntu上使用Mesa 10.1启用OpenGL 3.3

前端之家收集整理的这篇文章主要介绍了如何在Ubuntu上使用Mesa 10.1启用OpenGL 3.3前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图得到一个依赖OpenGL 3.3和GLSL 3.3的基于OpenGL的渲染引擎,使用AMD Radeon 6950在Ubuntu 13.10上运行.我想使用开源驱动程序(radeon),它依赖于Mesa来实现OpenGL . Ubuntu 13.10仅提供“开箱即用”的Mesa 9.2(实现OpenGL 3.1).但是,可以从 this PPA安装Mesa 10.1(实现OpenGL 3.3),如本主题所述:

StackOverflow:OpenGL & GLSL 3.3 on an HD Graphics 4000 under Ubuntu 12.04

我使用了与那里解释完全相同的步骤:

1.) Add the PPA Repository
  $sudo add-apt-repository ppa:oibaf/graphics-drivers
2.) Update sources
  $sudo apt-get update
3.) Dist-upgrade (rebuilds many packages)
  $sudo apt-get dist-upgrade
4.) Then I rebooted.

Mesa 10.1已成功安装.但是,glxinfo虽然现在报告Mesa 10.1正在使用,但仍然只报告OpenGL 3.0(compat profile)和OpenGL 3.1(核心配置文件):

$glxinfo | grep OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD CAYMAN
OpenGL core profile version string: 3.1 (Core Profile) Mesa 10.1.0-devel (git-7f57408 saucy-oibaf-ppa+curaga)
OpenGL core profile shading language version string: 1.40
OpenGL core profile context flags: (none)
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.1.0-devel (git-7f57408 saucy-oibaf-ppa+curaga)
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:

这是为什么?如何启用OpenGL 3.3?从我在the StackOverflow thread中提到的比较可以看出,glxinfo报告OpenGL 3.3是可能的.我知道glxinfo可能会报告错误的版本号,因为the Mesa 10.1 Release Notes,但我试图运行的渲染引擎因此而失败.

我使用以下代码生成一个窗口:

glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR,3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR,3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE,0);

if(GL_TRUE != glfwOpenWindow(
    _windowDimensions.x,_windowDimensions.y,32,GLFW_WINDOW))
{
    THROW("GLFW error: Failed to create window.");
}

当我尝试使用此设置运行渲染引擎时,由于不支持OpenGL 3.3,因此抛出上述异常.我可以将GLFW_OPENGL_VERSION_MINOR设置为0,然后窗口打开正常,但稍后将抛出异常,因为需要GLSL 3.3着色器.

还要注意,当我使用专有的fglrx驱动程序(然后glxinfo报告OpenGL版本4.2)时,渲染引擎运行正常,因此应用程序本身确实不是问题,但支持的OpenGL是.

那么我做错了什么?为什么Mesa 10.1不支持OpenGL 3.3?我的显卡当然支持它.

这里有一些可能有用的附加信息.

$apt-cache policy libgl1-mesa-glx
libgl1-mesa-glx:
  Installed: 10.1~git1402041945.7f5740+curaga~gd~s
  Candidate: 10.1~git1402041945.7f5740+curaga~gd~s
  Version table:
 *** 10.1~git1402041945.7f5740+curaga~gd~s 0
        500 http://ppa.launchpad.net/oibaf/graphics-drivers/ubuntu/ saucy/main amd64 Packages
        100 /var/lib/dpkg/status
     9.2.1-1ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages


$lspci -vv
...snip...
01:00.0 VGA compatible controller: Advanced Micro Devices,Inc. [AMD/ATI] Cayman PRO [Radeon HD 6950] (prog-if 00 [VGA controller])
    Subsystem: Hightech Information System Ltd. Device 2307
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0,Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 53
    Region 0: Memory at c0000000 (64-bit,prefetchable) [size=256M]
    Region 2: Memory at fe620000 (64-bit,non-prefetchable) [size=128K]
    Region 4: I/O ports at e000 [size=256]
    Expansion ROM at fe600000 [disabled] [size=128K]
    Capabilities: <access denied>
    Kernel driver in use: radeon
...snip...


$lsmod | egrep 'radeon|fglrx'
radeon               1402995  3
i2c_algo_bit           13413  1 radeon
ttm                    84169  1 radeon
drm_kms_helper         52710  1 radeon
drm                   297056  5 ttm,drm_kms_helper,radeon


$modinfo radeon
filename:       /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko
license:        GPL and additional rights
description:    ATI Radeon
author:         Gareth Hughes,Keith Whitwell,others.
...snip...
firmware:       radeon/CAYMAN_smc.bin
firmware:       radeon/CAYMAN_rlc.bin
firmware:       radeon/CAYMAN_mc.bin
firmware:       radeon/CAYMAN_me.bin
firmware:       radeon/CAYMAN_pfp.bin
...snip...
srcversion:     D174B1E4686391B33437915
alias:          pci:v00001002d000099A4sv*sd*bc*sc*i*
alias:          pci:v00001002d000099A2sv*sd*bc*sc*i*
...snip...
depends:        drm,ttm,i2c-algo-bit
intree:         Y
vermagic:       3.11.0-15-generic SMP mod_unload modversions 
parm:           no_wb:Disable AGP writeback for scratch registers (int)
parm:           modeset:Disable/Enable modesetting (int)
parm:           dynclks:Disable/Enable dynamic clocks (int)
parm:           r4xx_atom:Enable ATOMBIOS modesetting for R4xx (int)
parm:           vramlimit:Restrict VRAM for testing (int)
parm:           agpmode:AGP Mode (-1 == PCI) (int)
parm:           gartsize:Size of PCIE/IGP gart to setup in megabytes (32,64,etc) (int)
parm:           benchmark:Run benchmark (int)
parm:           test:Run tests (int)
parm:           connector_table:Force connector table (int)
parm:           tv:TV enable (0 = disable) (int)
parm:           audio:Audio enable (1 = enable) (int)
parm:           disp_priority:Display Priority (0 = auto,1 = normal,2 = high) (int)
parm:           hw_i2c:hw i2c engine enable (0 = disable) (int)
parm:           pcie_gen2:PCIE Gen2 mode (-1 = auto,0 = disable,1 = enable) (int)
parm:           msi:MSI support (1 = enable,-1 = auto) (int)
parm:           lockup_timeout:GPU lockup timeout in ms (defaul 10000 = 10 seconds,0 = disable) (int)
parm:           fastfb:Direct FB access for IGP chips (0 = disable,1 = enable) (int)
parm:           dpm:DPM support (1 = enable,-1 = auto) (int)
parm:           aspm:ASPM support (1 = enable,-1 = auto) (int)


$dpkg -S /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko
linux-image-extra-3.11.0-15-generic: /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko


$apt-cache policy linux-image-extra-3.11.0-15-generic
linux-image-extra-3.11.0-15-generic:
  Installed: 3.11.0-15.25
  Candidate: 3.11.0-15.25
  Version table:
 *** 3.11.0-15.25 0
        500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
        100 /var/lib/dpkg/status
他们没有告诉你,但间接暗示(“有些驱动程序不支持OpenGL 3.3中所需的所有功能.”),在Mesa(10.0)的最后一个正式版本中,GL 3.3仅适用于Intel硬件.这是英特尔与Mesa项目密切合作的乐趣之一.如果您想在AMD硬件上以任何形式获得可靠的GL 3.3支持,您应该暂时使用fglrx(专有的AMD驱动程序).

Mesa 10.1的开发版可能会在radeon驱动程序上实现GL 3.3,但您需要请求3.3核心配置文件.你目前没有这样做.

这个:

glfwOpenWindowHint(GLFW_OPENGL_PROFILE,0);

实际上需要这样:

glfwOpenWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);

此外,没有GL 3.0兼容性配置文件或3.1核心配置文件.直到3.2之前,配置文件才被引入OpenGL. GL 3.1中有GL_ARB_compatibility的概念,但这与概要文件不同; glxinfo正在提供误导性信息.

猜你在找的Ubuntu相关文章