OpenGL current rendering context and current device handles in Unity

313 views
Skip to first unread message

Cédric Le Cam

unread,
Jul 12, 2013, 10:06:03 AM7/12/13
to vr-g...@googlegroups.com
Hi everyone,

I'm wondering if there's an actual way to get the handles to the OpenGL rendering context and current device used by Unity when an application is run.
I tried to do so with the opengl32.dll and the wglGetCurrentContext and wglGetCurrentDC functions, but all I got were IntPtr equal to zero.

I hope you can help me.

Jan Ciger

unread,
Jul 12, 2013, 10:59:27 AM7/12/13
to vr-g...@googlegroups.com
Isn't Unity using Direct3D on Windows? Then you wouldn't have a valid
OpenGL context.

Regards,

Jan

Dave Buchhofer

unread,
Jul 12, 2013, 11:00:53 AM7/12/13
to vr-g...@googlegroups.com

You can use opengl, but you need to supply it as a command line argument

--
You received this message because you are subscribed to the Google Groups "VR Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vr-geeks+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/vr-geeks.
For more options, visit https://groups.google.com/groups/opt_out.


Naem BARON

unread,
Jul 13, 2013, 3:02:59 PM7/13/13
to vr-g...@googlegroups.com
Hello world

you have to use the command line argument "-force-opengl" to run in OpenGL mode, then the glContext should not be null.


Naëm
return 0;

Jan Ciger

unread,
Jul 14, 2013, 3:52:16 PM7/14/13
to vr-g...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It can still be - not sure how it is on Windows, but e.g. in Linux the
OpenGL context is something that is thread-local. If you are in
another thread, you won't have access to it without some wizardry.

Also, the state management can be a pain - I am sure Unity won't be
happy if you just start drawing random stuff when it doesn't expect it.

Jan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iD8DBQFR4wFsn11XseNj94gRAiKYAKDn47Exe9FmJfBmy/SpE8jOpYOD0wCeJV4j
ipGiXCW0vjuYp2qH9TbWW4M=
=WvZ1
-----END PGP SIGNATURE-----

Cédric Le Cam

unread,
Jul 15, 2013, 4:16:54 AM7/15/13
to vr-g...@googlegroups.com
As far as the handles are concerned, -force-opengl did the trick.
Thank you.
Reply all
Reply to author
Forward
0 new messages