MFC Buttons, etc, with OpenGL

I have been checking out books and tutorials over and over looking for information regarding the use of OpenGL and MFC… They say it’s possible, but any examples are for making full OpenGL windows…

What I’m looking for is some information/code where I can make a window on an MFC application and still put like buttons and radio buttons and so forth on the screen as well… Like making a box that takes up 3/4 of the top of the screen, with a bar at the bottom that has MFC buttons… How would something like that be set up?

Thanks.

That is as easy as setting up a DocView program with two views separated by a sliding bar. One is the main view, the other contains your control bar. It all depends on how you want to do it.

If you want to just have a docking toolbar, that’s easy enough: use the MFC AppWizard to create an application that has a docking toolbar.

If you actually want a separate CWnd object (possibly, a CFormView-derived class, so that controls can be added as easily as a CDialog window), then you need to do more work. You will need to use a static CSplitterWnd to setup two separate views. Then, you just put the main CView in the top area, and the secondary CView in the bottom.

In either case, you will need to have a CView-derived class that is an OpenGL window, which is no more difficult than doing it in Win32. You will, of course, need to trap all the appropriate messages (WM_SIZE, etc) to make the window fully functional, but I’m sure all that’s detailed well elsewhere.

OpenGL and MFC can work happily together. Check out Display3ds for an example of modest MFC that encloses OpenGL.

hth,
/p2

It’s possible because MFC is just a wrapper for the windows API. In fact, all of the Win API is still accessible.

So nothing is different. All the same rules apply such as don’t create button and other windows GUI elements in the GL window.

Codeguru.com has a section dedicated for GL and all sorts of stuff.

V-man

Try
http://www.mfcogl.com/