matus-chochlik / oglplus

OGLplus is a collection of open-source, cross-platform libraries which implement an object-oriented facade over the OpenGL® (version 3 and higher) and also OpenAL® (version 1.1) and EGL (version 1.4) C-language APIs. It provides wrappers which automate resource and object management and make the use of these libraries in C++ safer and more convenient.
http://oglplus.org/
Boost Software License 1.0
492 stars 72 forks source link

building oglplus under linux with an optimus nvidia card (using bumblebee) #105

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hello,

sorry the explanation, its just in case you dont know about this, nvidia optimus is a technology used in lots of nvidia laptops, where basically the laptop comes with 2 graphic cards: one low end usually intel that supports opengl 3.3, and another nvidia one (in my case a gtx765m that supports opengl 4.5)

in windows, the drivers make the switch automatically when something requires gpu acceleration, but on linux we still have to use "bumblebee" which is a small utility that basically makes programs use the nvidia libgl.so instead of the intel libgl.so.

for example:

glxinfo | grep -i opengl OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.5.0-devel OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.0 Mesa 10.5.0-devel OpenGL shading language version string: 1.30 OpenGL context flags: (none) OpenGL extensions:

now with the nvidia one:

primusrun glxinfo | grep -i opengl OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GTX 765M/PCIe/SSE2 OpenGL core profile version string: 4.3.0 NVIDIA 346.35 OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 4.5.0 NVIDIA 346.35 OpenGL shading language version string: 4.50 NVIDIA OpenGL context flags: (none) OpenGL profile mask: (none) OpenGL extensions:

and as you can see, now it reports the nvidia card capabilities. now to the real problem:

trying to build the oglplus library, i can build fine using the intel card by just running "./configure.py" and it detects opengl 3.3 and everything is fine.

but if i try to run using the nvidia card with: "primusrun ./configure.py", even laptop gpu led turn yellow (it stays green for the intel card, and changes to yellow when using the nvidia card so we know which card is being used) so it must be using the nvidia card, but the configuration cant detect the opengl version and assumes 3.2.

i've googled this issue and there was a person before with the same problem: https://github.com/matus-chochlik/oglplus/issues/46

sorry the long wall of text, my question is: is there a way to solve this problem? maybe i can force opengl 4.5 somehow in the configuration process?

thanks in advance.

matus-chochlik commented 9 years ago

Hi,

You've probably figured this out already, but just in case: Try running configure.py with --strict-gl-version-detection False, this should bypass the most of the normal version detection process.

HTH