[osg-users] Setting OpenGL and graphics card settings prgrammatically?

Daniel Emminizer, Code 5773 dan.emminizer at nrl.navy.mil
Thu May 10 11:18:31 PDT 2018

Hi Chris,

Not sure if this is what you’re looking for, but you can give a hint to the drivers by exporting variables in your code.  In my main.cpp I do something like:

#ifdef WIN32
extern "C" {

  /// Declare this variable in public to enable the NVidia side of Optimus - http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
  __declspec(dllexport) int NvOptimusEnablement = 1;

  /// Declare this variable in public to enable the AMD side of AMD Switchable Graphics (13.35 driver or newer needed) - http://devgurus.amd.com/thread/169965
  __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;

#endif /* WIN32 */

We have not had a problem since.

 - Dan

From: osg-users [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Chris Hanson
Sent: Thursday, May 10, 2018 2:15 PM
To: OpenSceneGraph Users
Subject: [osg-users] Setting OpenGL and graphics card settings prgrammatically?

  As you are aware, drivers like the NVidia Windows driver have a variety of tuneable settings accessible through the vendor-specific setting application. Many times these accomplish things that can't be accessed through the standard OpenGL APIs or extensions.

  Is there any way to force settings (like use of dedicated GPU versus integrated GPU) from application code via an API?

  Basically, we're trying to avoid having to teach the untrained user how to mess with those settings when we know the preferred settings for the application.

  Interested in NVidia and optionally AMD, Windows primarily but cross-platform APIs are welcomed.

  I'm digging into this: https://docs.nvidia.com/gameworks/index.html#gameworkslibrary/coresdk/gsa_api.htm

  to see if it does what I want, but welcome input from others.

Chris 'Xenon' Hanson, omo sanza lettere. Xenon at AlphaPixel.com http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel facebook.com/alphapixel (775) 623-PIXL [7495]

More information about the osg-users mailing list