PDA

View Full Version : OpenGL & MFC



Talas
10-25-2003, 09:25 AM
Can someone point me to a good tutorial of how to setup OpenGL in an MFC environment? I am reading a ton of tutorials, but they explicitly state that I can understand this tutorial easily if I know how to setup the CView class to work with OpenGL (which I do not, hehe).

Any help would be appreciated, thanks a bunch!

Simi
10-25-2003, 09:55 AM
I think this is a good starting point: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnopen/html/msdn_gl3.asp

mikael_aronsson
10-25-2003, 10:27 PM
Hi !

Have a look at www.codeguru.com, (http://www.codeguru.com,) there are some OpenGL tutorials that use MFC that might help.

Mikael

Talas
10-26-2003, 03:56 PM
Thanks for the tips. I found one tutorial that supplied a wrapper class in order to interface directly between MFC and OpenGL. If you are interested, this is the link: http://www.codeguru.com/opengl/oglwrapperclass.shtml

It is designed for a MDI, but worked fine with my SDI implementation. Thanks again for the pointers; it sent me on the right track! http://www.opengl.org/discussion_boards/ubb/smile.gif

cwc36
10-30-2003, 06:52 PM
Hi,

Try on this website. A good example can be found there.
http://myopendemo.hypermart.net

Leyder Dylan
11-01-2003, 12:57 PM
cwc36,

Why when I resize the OpenGL screen in the MFC, the square isn't centered ?.

In fact, if we change the size of the OpenGL IDC_SCREEN, the square isn't centered ?

mikael_aronsson
11-01-2003, 11:51 PM
Make sure you update the matrices correct when the window is resized (gluPerspective or what ever you use).

Mikael

cwc36
11-02-2003, 04:53 AM
Hi,

Try to replace this command GetClientRect(&rect) with m_map_window.GetClientRect(&rect)in OnInitDialog();

That is used to get size of the window. The cube is not center because the width and height of windows is not based on the IDC_SCREEN.




[This message has been edited by cwc36 (edited 11-03-2003).]