PDA

View Full Version : Opengl and MFC



aus79er
08-03-2002, 08:57 AM
Hi,
I have written one application to display a 3D object using MFC programming.
Everything is working well except one thing...
The object is displayed i the window only after i resize the window...i.e maxmimize the window...or minimize and then again open it...something like that....
This problem may have more to do with MFC than opengl...but still I will be glad if anybody can help me

Bye
aus

fabianspring
08-03-2002, 09:52 AM
hi!
I am neither an expert about mfc nor about openGL but the problem (so i guess) is just windowsbased...
All you need to do is, to let the programme know that you wanna draw into the window
1. when you create it
2. when you move it
3. when you update it.

You might realize that at
case WM_CREATE: ...
case WM_SIZE ...
etc. Just make sure that each of those messages contain the drawing of your openGL part. You might also include additional information about getting the width and the height of a screen then, to improve your programme.

Good luck,
Fabian

J P
08-04-2002, 03:45 AM
This is not a MFC problem. Basically all you need to do is have some draw code in either the OnPaint or OnDraw routine.
and let MFC handle the rest. You must not have initialized OpenGL properly in your MFC code. Make sure you call SwapBuffers() and glClear() in the correct places. Check www.mfcogl.com (http://www.mfcogl.com) for examples.

Also it would help if you included some basic information. What type (Dialog/SDI/MDI/home brew/etc.) of MFC program have you built and did you or the app wizard build it?