OpenGL 3.x/4.x in CLR Windows Form Apps

2014/12/21 19:44

A little code sample showing how to make Win32 like OpenGL 3.x and 4.x rendering contexts which can be attached to panels within a CLR Windows Form Application. Mixing Native C/C++ with C++/CLI can be pretty useful for making quick tools with shared code bases.

The basic code is in gl_canvas.h. The download contains a sample which makes 3 OpenGL canvases, two of which share a rendering context. It also uses a Timer to update the drawing of the panels. See the comments for more details.

Download it here. It should like this this

Updated! 2012.04.02:

The sample now uses GLEW, also made it more flexible to create different context 4.1, 3.2 etc, and make it support the creation of multisampled pixel formats.