PDA

View Full Version : Preparation of VC++ MDI application to handle OpenGL functions



Ramesh
11-26-2000, 06:11 AM
Hi
I am using VC++ MDI application. Is there any standard procedure to prepare the application to handle OpenGL functions.
thanks

wire
11-26-2000, 07:10 AM
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.

wire

Glossifah
11-27-2000, 06:28 AM
Ramesh,

Gitsum! http://www.cornflakezone.com/onetutorial.php?tutorialarticle=13

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.

Enjoy!

Glossifah

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

Deiussum
11-27-2000, 08:34 AM
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.

fshana
11-27-2000, 05:51 PM
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,
Francis
http://www.cornflakezone.com

Ramesh
11-28-2000, 02:55 AM
Thank you!
The following site is useful. http://www.cornflakezone.com/onetutorial.php?tutorialarticle=13

hawn
12-02-2000, 01:36 PM
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.