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.

more ▼

asked May 24, 2011 at 08:03 PM

avatar image

301 45 37 49

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered May 24, 2011 at 08:54 PM

avatar image

Graham Dunnett ♦♦
26.3k 35 50 181

Ah nice... thank you :)

May 24, 2011 at 08:57 PM pragmascript

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.

Oct 29, 2014 at 03:44 PM hzhamad
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: May 24, 2011 at 08:03 PM

Seen: 3587 times

Last Updated: Oct 29, 2014 at 03:44 PM