Win32 and glutDestroyWindow()

View: New views
2 Messages — Rating Filter:   Alert me  

Win32 and glutDestroyWindow()

by Sisyphus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Win32 (freeglut-2.4.0), I'm having trouble destroying an existing window.
I have the following snippett:

int window;
glutInit(&argc, argv);
glutInitWindowSize(200, 300);
window = glutCreateWindow("TEST");
glutDestroyWindow(window);

but the window stays open ... from which I deduce that the return value of
glutCreateWindow() is not the appropriate argument to hand over to
glutDestroyWindow(). What *is* the appropriate argument ?

I've provided a full demo below my sig. The "Sleep(3000);" call allows me to
verify that the window stays open until the program exits.

Cheers,
Rob

#include <stdio.h>
#include <windows.h>
#include <GL/freeglut.h>

int main(int argc, char * argv[]) {

int window;

glutInit(&argc, argv);
glutInitWindowSize(200, 300);
window = glutCreateWindow("TEST");
glutDestroyWindow(window);
printf("Window should now have been destroyed\n");
Sleep(3000);

return 0;

}




------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Freeglut-developer mailing list
Freeglut-developer@...
https://lists.sourceforge.net/lists/listinfo/freeglut-developer

Re: Win32 and glutDestroyWindow()

by Chris Marshall-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sisyphus wrote:

> Hi,
>
> On Win32 (freeglut-2.4.0), I'm having trouble destroying an existing window.
> I have the following snippett:
>
> int window;
> glutInit(&argc, argv);
> glutInitWindowSize(200, 300);
> window = glutCreateWindow("TEST");
> glutDestroyWindow(window);
>
> but the window stays open ... from which I deduce that the return value of
> glutCreateWindow() is not the appropriate argument to hand over to
> glutDestroyWindow(). What *is* the appropriate argument ?
>
> I've provided a full demo below my sig. The "Sleep(3000);" call allows me to
> verify that the window stays open until the program exits.

You need to pump the event loop with glutMainLoopEvent() or
just call glutMainLoop() in order for the GLUT calls to take
effect....

> Cheers,
> Rob
>
> #include <stdio.h>
> #include <windows.h>
> #include <GL/freeglut.h>
>
> int main(int argc, char * argv[]) {
>
> int window;
>
> glutInit(&argc, argv);
> glutInitWindowSize(200, 300);
> window = glutCreateWindow("TEST");
> glutDestroyWindow(window);
> printf("Window should now have been destroyed\n");
> Sleep(3000);
>
> return 0;
>
> }

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Freeglut-developer mailing list
Freeglut-developer@...
https://lists.sourceforge.net/lists/listinfo/freeglut-developer