x


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

pragmascript gravatar image

pragmascript
286 44 35 44

(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

Graham Dunnett gravatar image

Graham Dunnett ♦♦
21.8k 32 41 120

Ah nice... thank you :)

May 24, 2011 at 08:57 PM pragmascript
(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

By RSS:

Answers

Answers and Comments

Topics:

x154
x52
x50

asked: May 24, 2011 at 08:03 PM

Seen: 2955 times

Last Updated: May 24, 2011 at 08:57 PM