PDA

View Full Version : MFC connection with OpenGL?



Ace_Man
03-06-2000, 07:03 PM
Hi,
I'm new to OpenGl and MFC exe files under Viisual C++. I'm learning how to do both. What I can't figure out is how to link the two together. I'm sure it is something simple but I can't get it.

On one hand, if I create a simple Opengl picture(say to draw a triangle) under a win32 console application, compile, and run, everything is OK.

If I create a simple dialog box where a user can enter in a number(MFC (appwizard)exe) I can't figure out how to harness that number on the Opengl side. I probablly did't explain that very well. i'm new to both OpenGl and MFC(not to mention C++) but I can do the basics in all three(very basics).

I'm trying to draw a picture in OpenGl and have the user enter some input, and change the picture accordingly. Preferably with two simultaneous windows open. Someone here recomended me using a modeless dialog box(still trying to figure out what that is)
using MFC for the input.

I didn't get much luck using DOS as my input window.

Where would I put my OpenGL code in an MFC exe project for it all to work together and how would I set it up? guess that sums up my long winded question.....

holy_moly
03-08-2000, 01:25 AM
hi ace_man,
i'm quite new to mfc and opengl too,but i think i learned the simple basics now...
however,your opengl-code should be in the CView class of your mfc app (like CDemoView or something).here you can work with the whole opengl stuff like palettes,rendering context and so on..
For the dialog box,you have to make a new class derived from CDialog (like mySettingsDlg) where you can put your edit boxes and check boxes and stuff on it.then go to class wizard and link some flags (lighting on/off for example) with this objects.
so,now you could make a menu point in your CView class,which starts the (modal) dialog box.in the command handler now you could say
"mySettingsDlg dlg.m_lighting = lighting_flag" so the dialog box is updated every time you change the lighting flag. I dont know if this is the best way to do,but it works quite fine...(if i said something wrong here,please reply here ,guys)...hope this works