I am trying to debug my OpenGL program with Nsight5, Then the Nsight5 tell me my opengl version is too low,my computer is lenovo z470 with GT 520M, In my program show opengl version is 4.5. but Nsight5 tell the opengl is only 3.1,Why?
If this is an Optimus capable laptop there exist three different OpenGL implementations on it: One from NVIDIA for the discrete GPU, another from Intel for the integrated graphics, and on all Windows OSes the software implementation from Microsoft.
If your application normally runs with OpenGL 4.5 that was picking the desired NVIDIA OpenGL implementation. The OpenGL 3.1 version is then most likely the implementation from Intel. The Microsoft one reports version 1.1.
To solve this, make sure your application runs on the discrete NVIDIA GPU. The display driver release notes explain how to either build a profile for applications in the NVIDIA Control Panel or to right-click a desktop icon to select which graphics to use.
If this only happens when running from within Nsight, make sure that Nsight itself is also forced to use the discrete GPU.