View Full Version : How to use OpenGL in managed C++(CLI)

07-07-2008, 01:27 AM
I'm deploying a project in managed c++(CLI) using opengl. But i import gl.h and compile the project then many errors occur. I'm sure my miscoding cause these errors. I suppose that there is other solution to use opengl in managed c++ as using directx in it. is it right?

07-07-2008, 06:34 AM
You should use one of the already established C# wrappers. The best one in my opinion is <a href="http://www.opentk.com/">openTK</a>.

07-07-2008, 07:03 AM
Can the C# Class is availble in managed c++ code?

07-07-2008, 11:24 PM
You can use OGL in CLI/C++ exactly like in C++. The only thing you'll need is the window handle, to attach the GL context and the rendering loop. The window handle can be obtained with a command like this: HWND hWnd = (HWND)my_renderable_control->Handle.ToPointer();
The rendering look is another matter. You can overwrite the wndproc, place a timer to render each x ms, and so.