Thread: OpenGL hangs

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    465

    OpenGL hangs

    I'm using Dev-C++ on Windows Vista with FreeGlut. I'm going through the OpenGL SuperBible and the first program just runs and then windows returns "xxxx.exe has stopped working."

    The code looks like this but it happens with all the examples, not just this one.

    Code:
    /**************************
     * Includes
     *
     **************************/
    
    #include <gl/glu.h>
    #include <gl/gl.h>
    #include <gl/freeglut.h>
    
    // Called to draw scene
    void RenderScene(void)
    {
    // Clear the window with current clearing color
    glClear(GL_COLOR_BUFFER_BIT);
    // Flush drawing commands
    glFlush();
    }
    ///////////////////////////////////////////////////////////
    // Set up the rendering state
    void SetupRC(void)
    {
    glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
    }
    ///////////////////////////////////////////////////////////
    // Main program entry point
    
    int main(int argc, char* argv[])
    {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
    
    glutCreateWindow("Simple");
    glutDisplayFunc(RenderScene);
    SetupRC();
    glutMainLoop();
    return 0;
    }
    My computer is awesome.

  2. #2
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204
    Is the message popping up before you see anything in the window or is it happening after you close the program? I'm not a OpenGL person, but it sort of sounds like a DevC++ problem. Try compiling it as a release version and open it outside of DevC++ and see what happens then. Or, better yet, go with a better IDE.

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    465
    I tried just launching the executable outside of DevC++ and it tells me that the application could not be run because it cannot find glut.dll. I installed the freeglut package for DevC++. Is there something else that I need to do, also?
    My computer is awesome.

  4. #4
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204
    glut.dll should be in either the project directory or wherever you installed freeglut. Just copy it to where the executeable is. You can download it from the net if you google it, too.

    I still reckon you should go with a different IDE. Cry code::blocks or, to make things much easier IMO, VS Express.

  5. #5
    Registered User
    Join Date
    Dec 2004
    Posts
    465
    I tried wxwidgets once which I guess code::blocks is based on. Honestly, it confused the hell out of me and I didn't feel like any of the tutorials explained it very well.
    My computer is awesome.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM