OpenGL 3.1 and freeGLUT alongside .NET

I know you can’t have an OpenGL context inside a Windows Form control without some kind of wrapper, like SharpGL or OpenTK. But I’ve been trying to make a project that includes a Windows Form and, seperate from it, a freeGLUT OpenGL context. The idea is that I’m much more comfortable designing a Windows Form GUI using the .NET framework’s built-in controls than I am writing code to display and handle events inside a freeGLUT window. On the other hand, I’m avoiding a wrapper since they sometimes have bugs (I had much trouble with glShaderSource when using SharpGL) and all the OpenGL tutorials I’m learning from are in C++ anyway.

So my goal is to have an OpenGL context, using freeGLUT for windowing, rendering a scene based on some variables, and then the user can change these variables through a seperate, Windows Form GUI. I’ve so far managed to get either the Windows Form GUI to show up, or the freeGLUT window, but not both. Is there any way for this to work, or is it just fundamentally impossible?

The difficulty is going to be communicating between what are, for all intents and purposes, two separate applications. Both WinForms and FreeGLUT own the message processing loop. That’s not going to work without some issues.

You need to find a way to launch your WinForms tool as a modeless dialog. This effectively gives it a separate thread. Granted, now you need shared mutexes between C++ and .NET in order to be able to communicate effectively between the two of them.

The easiest way to do this might be to make them separate applications. This means you need to use interprocess communication methods to have the WinForms application update the FreeGLUT one.