radeon: use bo_is_idle interface for checking if OQ result is available
[mesa.git] / progs / demos / texenv.c
index 705cd2621f90f12acff713d5871c4755bc2893af..c5a8b13f35fbcc692988daadaf8f52b4f55f4bb0 100644 (file)
@@ -76,6 +76,8 @@ int textureWidth = 64;
 int textureHeight = 64;
 
 int winWidth = 580, winHeight = 720;
+static int Win;
+
 
 struct formatInfo {
    GLenum      baseFormat;
@@ -169,7 +171,7 @@ struct baseFormatInfo baseFormats[] =
 };
 
 #define NUM_ENV_COLORS         (sizeof(envColors) / sizeof(envColors[0]))
-int envColor;
+int envColor = 0;
 GLfloat envColors[][4] =
 {
    { 0.0, 0.0, 0.0, 1.0 },
@@ -201,8 +203,6 @@ static void checkErrors( void )
 {
    GLenum error;
 
-   return;
-
    while ( (error = glGetError()) != GL_NO_ERROR ) {
       fprintf( stderr, "Error: %s\n", (char *) gluErrorString( error ) );
    }
@@ -271,7 +271,8 @@ static void keyboard( unsigned char c, int x, int y )
 {
    switch ( c ) {
    case 'c':
-      envColor = (++envColor) % (int) NUM_ENV_COLORS;
+      envColor++;
+      envColor = envColor % (int) NUM_ENV_COLORS;
       break;
    case 'g':
       drawBackground = !drawBackground;
@@ -289,6 +290,7 @@ static void keyboard( unsigned char c, int x, int y )
       displayLevelInfo = !displayLevelInfo;
       break;
    case 27:             /* Escape key should force exit. */
+      glutDestroyWindow(Win);
       exit(0);
       break;
    default:
@@ -355,7 +357,8 @@ static void loadTexture( int width, int height,
       break;
    case GL_INTENSITY:
       luminanceSize = 1;
-      textureFormat = GL_INTENSITY;
+      /* Note: format=GL_INTENSITY for glTexImage is not legal */
+      textureFormat = GL_LUMINANCE;
       break;
    case GL_ALPHA:
       alphaSize = 1;
@@ -785,7 +788,7 @@ int main( int argc, char *argv[] )
 
    glutInitWindowSize( winWidth, winHeight );
    glutInitWindowPosition( 0, 0 );
-   glutCreateWindow( "Texture Environment Test" );
+   Win = glutCreateWindow( "Texture Environment Test" );
 
    initialize();
    instructions();