Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the close operation on a GLUT program written in C? (as in the red button in the top left corner to work)

I'm writing a really simple program using GLUT and C in XCode 4.2.

int main(int argc, char** argv)
{
    glutInit(&argc, argv);

    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowSize(640, 480);

    glutCreateWindow("GLUT Program");

    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutIdleFunc(idle);

    glutMainLoop();
    return EXIT_SUCCESS;
}

When the window opens up, I can't close it via the red button in the top left corner (Mac) because it is grayed out. If any Java programming I've done is a model, there should be some function that sets the close operation so that the red exit button works. I also can't seem to find the documentation for the most recent version of GLUT. Whenever I google it I seem to get OpenGL documentation, which makes me a little more confused then I was on the relationship between the two (I thought GLUT was a cross-platform interface to interact with OpenGL).

like image 371
Eric Thoma Avatar asked Jan 03 '12 21:01

Eric Thoma


1 Answers

On Mac OS, the window cannot be closed and the application has to be quit instead (sources here).

like image 191
F'x Avatar answered Jan 19 '23 03:01

F'x