glutMainLoop()

Hello…

I have basic question …I’m using the glut library to create windows.

Now, what I’d like to do is create the window, run the program, and then kill the window…but I don’t know how to kill the window. the code would look something like this…

int main(int argc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(screenWidth,screenHeight);
glutInitWindowPosition(0, 0);
glutCreateWindow(“renderleaf”);
glutDisplayFunc(myDisplay);
glutReshapeFunc(reshape);
myInit();
glutMainLoop();
killwindow();

I tried not using glutMainLoop(), but then the display function doesn’t get called… could someone please help me out, or point me in the right direction of reading materials?

Thanks alot.

window_id = glutCreateWindow();
glutDestroyWindow(window_id);

you have to call glutMainLoop() or else your message loop will never be called, your window never created, and your display func never called.

Thanks Gavin. It worked.