PDA

View Full Version : glutMainLoop()



hatemagnet
03-08-2002, 07:37 PM
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.

Gavin
03-09-2002, 04:13 AM
window_id = glutCreateWindow();
glutDestroyWindow(window_id);

03-09-2002, 05:44 AM
you have to call glutMainLoop() or else your message loop will never be called, your window never created, and your display func never called.

hatemagnet
03-09-2002, 02:53 PM
Thanks Gavin. It worked.