PDA

View Full Version : MFC and opengl



coda
10-03-2003, 04:59 PM
Actually I have an MFC appwizard(exe) and wan to use opengl with it. where do i start coding the opengl part?

10-04-2003, 09:07 AM
I've never programmed in MFC, but I think the concepts used are similar to what I'm currently using; GTK.

In my code, rendering occuring in the expose event. I think windows has a WM_PAINT event. That's where you should render.

I think windows sends a RESIZE event of some type. Such an event is where I like to set my viewing volume, ie make calls to glOrtho() or glFrustum() and glViewport().

In GTK, there is a realize event that indicates when the window is actually created on screen. This is where I like to set up the initial GL state, ie setup lights, light models, etc.

Hope this helps.

Eric
10-07-2003, 07:23 AM
You'll find an example of this in MSDN:
http://support.microsoft.com/default.aspx?scid=kb;en-us;127071

Most of my applications use both MFC and OpenGL and are loosely based on information based on this article.

Regards,

Eric