When I used use "glGetString(GL_VERSION)" and "glGetString(GL_SHADING_LANGUAGE_VERSION)" to check the OpenGL version on my computer, I got the following information:
3.1.0 - Build 8.15.10.2538 for GL_VERSION
1.40 - Intel Build 8.15.10.2538 for GL_SHADING_LANGUAGE_VERSION
When I ran "Geeks3D GPU Caps Viewer", it shown the OpenGL version of my graphics cards(NVS 4200M) are
GL_VERSION: 4.3.0
GLSL version: 4.30 NVIDIA via Cg compiler
Does that mean my graphics cards only supports some OpenGL 4.3.0 functions, and I cannot create 4.3 context?
Your graphics card is an NVIDIA Optimus card. This means that it "automatically" chooses between the integrated Intel graphics and the dedicated GPU. The Intel graphics only supports up to 3.1 while the dedicated GPU supports 4.3. Depending on which one is chosen, you'll only have support for up to that version. The only problem with Optimus is that it'll only automatically pick up DirectX, CUDA, C++ AMP, and OpenCL.
This has caused much confusion and frustration.
There are a few solutions to force the dedicated GPU to be used:
- The simplest, force your application to use the dedicated GPU via the NVIDIA Control Panel. This is generally a stop-gap solution, as it'll only work on your machine.
- Invoke a small bit of (or link to) CUDA or OpenCL at the beginning of your program to get it to trigger the switch to the dedicated card. This adds a dependency to CUDA or OpenCL, however.
- Export the global variable
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
. This is generally the best solution, however, depending on which language you're using, you may not be able to export global variables.
NVIDIA released a document about doing this: http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
来源:https://stackoverflow.com/questions/18071669/nvidia-optimus-card-not-switching-under-opengl