- Home /
runtime check for OpenGL
Can I detect at runtime (via script) whether Uniy3D is running in OpenGL mode?
I need to check if the game was compiled using -force-opengl on pc because i could use faster opengl texture transfer via native code then and fallback to slow Texture2D.SetPixels on DirectX elsewise.
Answer by Graham-Dunnett · May 24, 2011 at 08:54 PM
The windows standalone will always use OpenGL if it is run with the -force-opengl command line switch. That's to says the player can run in either OpenGL or DX mode. You might care to consider having a small (non-unity) launcher app that decides whether to use OpenGL or not, and use the switch if OpenGL is the best option on the PC. See http://unity3d.com/support/documentation/ScriptReference/SystemInfo-graphicsDeviceVersion.html to determine if you are running OpenGL or not.
is there a script that allows us to select the graphics renderer (either OpenGL or DirectX)? I am creating a native OpenGL plugin that loads the DLLs on clicking a button. That requires me to send the graphics callbacks after clicking the button not after starting ("Play") the scene.