How to use OpenGL in managed C++(CLI)

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?

You should use one of the already established C# wrappers. The best one in my opinion is <a href=“”>openTK</a>.

Can the C# Class is availble in managed c++ code?

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.