-/* $Id: manytex.c,v 1.2 2000/10/23 23:32:22 brianp Exp $ */
/*
* test handling of many texture maps
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <math.h>
#include <GL/glut.h>
static GLboolean LinearFilter = GL_FALSE;
static GLboolean RandomSize = GL_FALSE;
static GLint Rows, Columns;
-static GLuint LowPriorityCount = 0;
+static GLint LowPriorityCount = 0;
+static GLint Win;
static void Idle( void )
}
+static void DeleteTextures(void)
+{
+ glDeleteTextures(NumTextures, TextureID);
+ free(TextureID);
+ TextureID = NULL;
+}
+
+
static void Init( void )
{
GLint level = 0;
GLint w = TexWidth, h = TexHeight;
while (1) {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0,
+ glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, texImage);
if (w == 1 && h == 1)
break;
Zrot += step;
break;
case ' ':
+ DeleteTextures();
Init();
break;
case 27:
+ DeleteTextures();
+ glutDestroyWindow(Win);
exit(0);
break;
}
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( WinWidth, WinHeight );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
+ Win = glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );