first program(opengl+MFC)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: first program(opengl+MFC)

  1. #1
    Join Date
    Sep 2005
    Location
    New Delhi, India
    Posts
    332

    first program(opengl+MFC)

    actually i am planning to make a game in OpenGL using MFC..but don't know anything about both of them....but still wanna make

    this is my fist code using opengl and MFC...please help

    #include <windows.h>

    #include <gl\glut.h>

    void SetupRC();
    void RenderScene();
    void main()

    {

    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutCreateWindow("Simple");

    RenderScene();

    SetupRC();

    glutMainLoop();


    }
    void SetupRC()
    {
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
    }

    void RenderScene()
    {
    glClear(GL_COLOR_BUFFER_BIT);
    glFlush();
    }

    I got this error at runtime...don't know where i am going wrong
    ------------------------------------------------------------------------

    GLUT: Warning in (unamed): The following is a new check for GLUT 3.0; update your code.
    GLUT: Fatal Error in (unamed): redisplay needed for window 1, but no display callback.
    Appreciate others by rating good posts

    "Only buy something that you'd be perfectly happy to hold if the market shut down for 10 years." - Warren Buffett

  2. #2
    Join Date
    Jul 2002
    Posts
    2,517

    Re: first program(opengl+MFC)

    You need to declare RenderScene function as callback which is called by GLUT framework to redraw window:

    Code:
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); 
    glutCreateWindow("Simple");
    
    glutDisplayFunc(RenderScene);
    
    SetupRC();
    
    glutMainLoop();
    Don't call RenderScene directly. Read also this tutorial:
    http://www.lighthouse3d.com/opengl/glut/index.php?2

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: first program(opengl+MFC)

    [ Redirected thread ]
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  4. #4
    Join Date
    Sep 2005
    Location
    New Delhi, India
    Posts
    332

    Re: first program(opengl+MFC)

    Thanxs alot...it worked fine
    Appreciate others by rating good posts

    "Only buy something that you'd be perfectly happy to hold if the market shut down for 10 years." - Warren Buffett

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center