I have an OpenGL program in C#, but I also want to execute OpenGL functions from a C++ DLL. Will the changes made by my C++ library take effect on the C# program?
Edit: To be more clear, I want to share the same context of OpenGL for two languages.
I am PInvoking functions of C++ that uses OpenGL from my C# code.
Current OpenGL context is a thread-local global state.
What this means is that as long as the C++ and C# code are executing in the same thread, then OpenGL commands issued in either will be compatible.
However, if you are dealing with multiple/different threads, you will need to activate the OpenGL context in C++ (assuming it was created in C#), using wglMakeCurrent()
. In order to do this, you'll have to propagate the proper handles somehow.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments