I have found a (possible) way to force a laptop to use the nvidia card by using this code
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
But it does not compile because NvOptimusEnablement seems to be already defined in the main. I’ve tried to search in all the functions called by main and I can’t find any line about NvOptimusEnablement.
Could someone tell me more about that ?
Is this value already defined by a windows lib called by OF ?
It would probably be easier if you could share the error message you’re getting! But first thing you could try is to put that in the main.cpp (or any other :cpp file) rather than in a header. (The header files can get included multiple times and it causes some issues if you’re creating global variable in them)
And huh, I’m sure you already know; but in the nvidia control panel you can usually create a specific profile for your app and force the high performance graphic there:
Here is the exact error
I’ve moved this few lines at the beginning of the main it works. Thank you.
I’m using this as with some windows update the settings change in the 3d parameter panel. They are reset to default. This is confusing.
Btw this lines are not supposed to work if you create a profile.
On the other side I have many problems with recent laptop (msi ge72vr 7rf) which have an intel hd630 + nvidia gtx1060.
with the MultiTextureShaderExample if set the preferered graphics card to autoselection I have 145 fps with the lines included in the main. If I set preferred graphics to nvidia gtx1060 I have 120 fps.
Some of my old of programs run faster on older computer than on this recent one… depending on what opengl version is used, the nvidia optimus, …
What I mean is that my old habits with 3d setup (create profile that use the dedicated graphics and everything to max performances) is not working any more with this computer.
A good thing to know : the hdmi and the mini-dvi are directly connected to the hardware of the nvidia graphics. If you run your program only on a screen connected to it, there is not optimus, autoselection or anything else, it’s only the dedicated graphics evolved and performances are better