Developer postOriginal post (opens in a new tab)

Leadwerks Game Engine Update for NVidia Optimus

We experienced some reports early on of some users having trouble with their laptops that used a combination of Intel integrated and Nvidia discrete graphics. Since Leadwerks actually runs really well on Intel HD graphics, as long as they support OpenGL 4.0/DX11, I suspect most people didn't notice. However, there were cases where an Intel HD 3000 (which doesn't support OpenGL 4) was paired with a discrete GPU that did support OpenGL 4. These users were understandably upset, because they did have a capable GPU, even if it wasn't being used.

A brand new Lenovo ThinkPad was used for testing. Without updating any drivers, we ran a Leadwerks game and it gave an error "Failed to initialize background context", although it did print out that the OpenGL version supported was "400". After updating the Intel graphics driver to the latest (311.34) the game ran fine, but was still selecting the integrated chip rather than the discrete GPU.

After updating the Nvidia graphics card to the latest (332.21) we found that the Leadwerks game automatically selected the Nvidia discrete GPU, as it should. However, the editor did not, although it was running fine on Intel HD graphics.

Nvidia's trick to extern a variable in the executable had already been in use in Leadwerks at launch, in the game executable. However the editor itself did not have the variable; the engine DLL did, but that apparently was not enough to tell the driver to use the discrete GPU. Once the variable was added to the editor exe itself, everything worked as expected, and it was always run with the Nvidia card.

In order for this to work, you must have recent drivers. We determined today there are still computers being shipped with drivers that require updating before they will run properly, but that problem is easily solved by downloading your driver's from the manufacturer's site. (The laptop in question was the literally the last one being sold of an older model, so most new PCs probably have a newer driver by default.)

If you need to update your drivers, you can download them below:

Intel
https://downloadcenter.intel.com/default.aspx

AMD/ATI
http://support.amd.com/en-us/download

Nvidia
http://www.nvidia.com/Download/index.aspx?lang=en-us

Thank you to members "bandrewk" and "meteorstorm" for their feedback which helped identify this problem. The update is now available in Steam and you will be automatically patched.