3
\$\begingroup\$

I'm new to graphics programming, though not to coding generally. I've been learning opengl from the OpenGL Superbible, 6th Edition. I was trying out the shader examples from the book but couldn't get them to work. The logged error says approximately "incorrect #version". The book uses GLSL 4.3 core.

I ran glewinfo.exe and the generated text file said that the core OpenGL version on my system was OpenGL 4.0, but it was the stats of my integrated Intel GPU, not my Nvidia GT720m GPU. I'm pretty sure the nvidia gpu supports a higher opengl version.

How do I get GLEW to detect the high-performance GPU and make calls to the Nvidia drivers instead of the integrated Intel HD GPU?


A similar question has been asked there, but it concerned only running the program on the gpu. How do I tell which version of OpenGL the Nvidia GPU supports?

\$\endgroup\$
2
\$\begingroup\$

You didn't mention your platform, but assuming it is Windows, this blog post appears to address your exact question, between OpenGL 4.0 vs 4.3 on integrated vs nvidia gpus:

http://stevendebock.blogspot.com/2013/07/nvidia-optimus.html

It mentions using the "NVIDIA Control Panel" to change from autoselect to specifically the nvidia card. And that on a laptop, your selection would be influenced by battery life.

\$\endgroup\$
  • \$\begingroup\$ Thanks a lot! That's exactly what I was looking for. I did have to figure out that one needs to include "Windows.h" for the code to work and export the variable which forces the program to call the Nvidia drivers. \$\endgroup\$ – WormSandwich Mar 29 '15 at 20:40
  • \$\begingroup\$ I just came back to this question after a while... when I gave the answer I hadn't actually started my Windows port. Nearly a year later I got my Alienware laptop (which switchable GPUs) and got to apply this exact info. :-) \$\endgroup\$ – david van brink Mar 27 '16 at 15:52
  • \$\begingroup\$ You can export the NvOptimusEnablement variable as a DWORD, with which you can tell the driver that you are a game (if the value is 1) and a NVidia GPU is better fit. \$\endgroup\$ – Paul Stelian Feb 11 at 9:24
  • \$\begingroup\$ stackoverflow.com/a/14041061/3897333 Code in linked answer. \$\endgroup\$ – Paul Stelian Feb 11 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.