diff options
author | Brian Paul <[email protected]> | 2006-08-25 22:13:08 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-08-25 22:13:08 +0000 |
commit | 0c46a1236597667ca57b605e8a71eb6d2861402c (patch) | |
tree | 93e021c3069cb8acc7d172a104df2f85270dbd84 /progs/tests/bufferobj.c | |
parent | 6827cf4d9afd92772d2a3fed27d5da15f406cd9d (diff) |
delete buffers, destroy window upon exit
Diffstat (limited to 'progs/tests/bufferobj.c')
-rw-r--r-- | progs/tests/bufferobj.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/progs/tests/bufferobj.c b/progs/tests/bufferobj.c index c765d2516ba..50ab5cdfa89 100644 --- a/progs/tests/bufferobj.c +++ b/progs/tests/bufferobj.c @@ -28,6 +28,8 @@ struct object static struct object Objects[NUM_OBJECTS]; static GLuint NumObjects; +static GLuint Win; + static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; static GLboolean Anim = GL_TRUE; @@ -118,6 +120,14 @@ static void Reshape( int width, int height ) } +static void FreeBuffers(void) +{ + int i; + for (i = 0; i < NUM_OBJECTS; i++) + glDeleteBuffersARB(1, &Objects[i].BufferID); +} + + static void Key( unsigned char key, int x, int y ) { const GLfloat step = 3.0; @@ -138,6 +148,8 @@ static void Key( unsigned char key, int x, int y ) Zrot += step; break; case 27: + FreeBuffers(); + glutDestroyWindow(Win); exit(0); break; } @@ -346,7 +358,7 @@ int main( int argc, char *argv[] ) glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 600, 300 ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); + Win = glutCreateWindow(argv[0]); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutSpecialFunc( SpecialKey ); |