Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: OpenGL 3.1 and freeGLUT alongside .NET

  1. #1
    Intern Contributor
    Join Date
    Jun 2012

    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?

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts