Preparation of VC++ MDI application to handle OpenGL functions

I am using VC++ MDI application. Is there any standard procedure to prepare the application to handle OpenGL functions.

Just be sure to include the libs. Look in your install directory, for visual C++, and goto the libs directory and then to gl. These are all you need unless your planning on using glut.




I read through this when I first began the transition from glut to MFC to build my apps. Good stuff, albeit you’ll have to do some tweaking if you plan on using the MDI capabilities to have multiple OGL contexts within a single GDI parent.



[This message has been edited by Glossifah (edited 11-27-2000).]

I just took a look at that tutorial using OpenGL with MFC and saw a couple mistakes. First of all, using CS_OWNDC where he uses it has no effect. The styles specified in OnPrecreateWindow are actually used in the CreateWindow function, not the RegisterClass function, which is where the CS_OWNDC style needs to be specified. I don’t remember the correct way to specify CS_OWNDC offhand, but I believe there was a thread about that here awhile ago.

The other mistake in the tutorial is in it saying to return FALSE; in the OnEraseBkgnd. You should return TRUE; in order to prevent the MFC framework from erasing the background for you and causing the flicker. Returning TRUE tells MFC that you handled the screen clearing yourself so that it doesn’t attempt to do that for you.

Thanks for pointing those out, I’m glad someone is actually reading the stuff I post on my site. I’ll try to correct those mistakes when I get a chance. Hope you found it useful. If you did, please let me know by posting on my site. Regards,

Thank you!
The following site is useful.

mirocosoft’s web site (MSDN) has some discusion about this. In fact, a sample MFC program, cube, that ships with MFC deals with with this specifically.