Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: OpenGL & MFC

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2003
    Posts
    3

    OpenGL & MFC

    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!

  2. #2
    Junior Member Newbie
    Join Date
    Jun 2003
    Location
    Viersen, NRW, Germany
    Posts
    7

    Re: OpenGL & MFC

    I think this is a good starting point: http://msdn.microsoft.com/library/de...l/msdn_gl3.asp

  3. #3
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: OpenGL & MFC

    Hi !

    Have a look at www.codeguru.com, there are some OpenGL tutorials that use MFC that might help.

    Mikael

  4. #4
    Junior Member Newbie
    Join Date
    Oct 2003
    Posts
    3

    Re: OpenGL & MFC

    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!

  5. #5
    Intern Contributor
    Join Date
    Jul 2002
    Location
    Seri Kembangan, Selangor, Malaysia
    Posts
    92

    Re: OpenGL & MFC

    Hi,

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

  6. #6
    Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    486

    Re: OpenGL & MFC

    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 ?

  7. #7
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: OpenGL & MFC

    Make sure you update the matrices correct when the window is resized (gluPerspective or what ever you use).

    Mikael

  8. #8
    Intern Contributor
    Join Date
    Jul 2002
    Location
    Seri Kembangan, Selangor, Malaysia
    Posts
    92

    Re: OpenGL & MFC

    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).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •