Draw on Form

I see a lot of OpenGL examples on how to use OpenGL on a black window and using OpenGL on a standard window, but now i need to use OpenGL on the same form (Visual C++ 2008) where i created buttons for the user to click and i don’t see how.
One example would be Maya or 3D studio Max where you have one or several toolbars and the drawing are in the middle. How can this be made?

My thanks in advanced

I’m assuming you are using Windows Forms?

First, you have to get a window handle (HWND) from the Form instance you want to draw in:


Then you do the usual wgl stuff:

  • GetDC
  • ChoosePixelFormat
  • SetPixelFormat
  • wglCreateContext
  • wglMakeCurrent

Check this page for more details: