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 4 of 4

Thread: GLUT crash

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2001
    Location
    Milwaukee WI 53211
    Posts
    29

    GLUT crash

    I'm using GLUT under windows and my program is crashing everytime I minimize the window. Is there something I'm missing when setting up GLUT? It has to be a problem with GLUT because even with a simple GL program I can get it to crash everytime when I minimize. Here's how I setup GLUT:

    glutInitWindowPosition(0, 0);
    glutInitWindowSize(640, 480);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Dan");
    glutDisplayFunc(ShowScreen);
    glutReshapeFunc(ChangeSize);
    glutVisibilityFunc(visible);
    glutSpecialFunc(special);
    glutKeyboardFunc(key);

    Thanks

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,070

    Re: GLUT crash

    The only diffrence I see from how I init glut is that you have glutinitdisplaymode third and not first.

    Change it to this:
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowPosition(0, 0);
    glutInitWindowSize(640, 480);

    Here is the one I am currently using on a program.

    int main(int argc, char** argv)
    {
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowSize (500, 500);
    glutInitWindowPosition (100, 100);
    glutCreateWindow (argv[0]);
    glutSetWindowTitle("GLbase");
    init ();
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutKeyboardFunc(keyboard);
    glutTimerFunc( 10, TimeEvent, 1);
    glutMainLoop();
    return 0;
    }
    Originally posted by dpgraves:
    I'm using GLUT under windows and my program is crashing everytime I minimize the window. Is there something I'm missing when setting up GLUT? It has to be a problem with GLUT because even with a simple GL program I can get it to crash everytime when I minimize. Here's how I setup GLUT:

    glutInitWindowPosition(0, 0);
    glutInitWindowSize(640, 480);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutCreateWindow("Dan");
    glutDisplayFunc(ShowScreen);
    glutReshapeFunc(ChangeSize);
    glutVisibilityFunc(visible);
    glutSpecialFunc(special);
    glutKeyboardFunc(key);

    Thanks

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,633

    Re: GLUT crash

    even with a simple GL program I can get it to crash everytime when I minimize.
    Then check your "visible" function. Chances are, if you take out the "glutVisibleFunc(visible);" line, your program won't crash anymore. Check if you did something stoopid in there

  4. #4
    Member Regular Contributor
    Join Date
    May 2000
    Location
    Oxford, England
    Posts
    471

    Re: GLUT crash

    this is not a bug related to the code you've posted, it's a division by zero in your re-shape function.

    Look for the line where you set the aspect ratio for a perspective projection and deal with the following statement :

    width/height

    and replace with :

    (height == 0)?1 float)(width/height)

    or something similar...

    [This message has been edited by Rob The Bloke (edited 03-05-2002).]

Posting Permissions

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