test/testshader.c
changeset 7663 53fe1b64eb2d
parent 7639 9406b7dd2f2d
child 7996 be1526907541
     1.1 --- a/test/testshader.c	Tue Aug 20 19:49:24 2013 -0300
     1.2 +++ b/test/testshader.c	Tue Aug 20 20:34:40 2013 -0300
     1.3 @@ -332,19 +332,19 @@
     1.4  }
     1.5  
     1.6  /* A general OpenGL initialization function.    Sets all of the initial parameters. */
     1.7 -void InitGL(int Width, int Height)                    // We call this right after our OpenGL window is created.
     1.8 +void InitGL(int Width, int Height)                    /* We call this right after our OpenGL window is created. */
     1.9  {
    1.10      GLdouble aspect;
    1.11  
    1.12      glViewport(0, 0, Width, Height);
    1.13 -    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);        // This Will Clear The Background Color To Black
    1.14 -    glClearDepth(1.0);                // Enables Clearing Of The Depth Buffer
    1.15 -    glDepthFunc(GL_LESS);                // The Type Of Depth Test To Do
    1.16 -    glEnable(GL_DEPTH_TEST);            // Enables Depth Testing
    1.17 -    glShadeModel(GL_SMOOTH);            // Enables Smooth Color Shading
    1.18 +    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);        /* This Will Clear The Background Color To Black */
    1.19 +    glClearDepth(1.0);                /* Enables Clearing Of The Depth Buffer */
    1.20 +    glDepthFunc(GL_LESS);                /* The Type Of Depth Test To Do */
    1.21 +    glEnable(GL_DEPTH_TEST);            /* Enables Depth Testing */
    1.22 +    glShadeModel(GL_SMOOTH);            /* Enables Smooth Color Shading */
    1.23  
    1.24      glMatrixMode(GL_PROJECTION);
    1.25 -    glLoadIdentity();                // Reset The Projection Matrix
    1.26 +    glLoadIdentity();                /* Reset The Projection Matrix */
    1.27  
    1.28      aspect = (GLdouble)Width / Height;
    1.29      glOrtho(-3.0, 3.0, -3.0 / aspect, 3.0 / aspect, 0.0, 1.0);
    1.30 @@ -363,29 +363,29 @@
    1.31          MAXY
    1.32      };
    1.33  
    1.34 -    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);        // Clear The Screen And The Depth Buffer
    1.35 -    glLoadIdentity();                // Reset The View
    1.36 +    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);        /* Clear The Screen And The Depth Buffer */
    1.37 +    glLoadIdentity();                /* Reset The View */
    1.38  
    1.39 -    glTranslatef(-1.5f,0.0f,0.0f);        // Move Left 1.5 Units
    1.40 +    glTranslatef(-1.5f,0.0f,0.0f);        /* Move Left 1.5 Units */
    1.41  
    1.42 -    // draw a triangle (in smooth coloring mode)
    1.43 -    glBegin(GL_POLYGON);                // start drawing a polygon
    1.44 -    glColor3f(1.0f,0.0f,0.0f);            // Set The Color To Red
    1.45 -    glVertex3f( 0.0f, 1.0f, 0.0f);        // Top
    1.46 -    glColor3f(0.0f,1.0f,0.0f);            // Set The Color To Green
    1.47 -    glVertex3f( 1.0f,-1.0f, 0.0f);        // Bottom Right
    1.48 -    glColor3f(0.0f,0.0f,1.0f);            // Set The Color To Blue
    1.49 -    glVertex3f(-1.0f,-1.0f, 0.0f);        // Bottom Left
    1.50 -    glEnd();                    // we're done with the polygon (smooth color interpolation)
    1.51 +    /* draw a triangle (in smooth coloring mode) */
    1.52 +    glBegin(GL_POLYGON);                /* start drawing a polygon */
    1.53 +    glColor3f(1.0f,0.0f,0.0f);            /* Set The Color To Red */
    1.54 +    glVertex3f( 0.0f, 1.0f, 0.0f);        /* Top */
    1.55 +    glColor3f(0.0f,1.0f,0.0f);            /* Set The Color To Green */
    1.56 +    glVertex3f( 1.0f,-1.0f, 0.0f);        /* Bottom Right */
    1.57 +    glColor3f(0.0f,0.0f,1.0f);            /* Set The Color To Blue */
    1.58 +    glVertex3f(-1.0f,-1.0f, 0.0f);        /* Bottom Left */
    1.59 +    glEnd();                    /* we're done with the polygon (smooth color interpolation) */
    1.60  
    1.61 -    glTranslatef(3.0f,0.0f,0.0f);         // Move Right 3 Units
    1.62 +    glTranslatef(3.0f,0.0f,0.0f);         /* Move Right 3 Units */
    1.63  
    1.64 -    // Enable blending
    1.65 +    /* Enable blending */
    1.66      glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    1.67      glEnable(GL_BLEND);
    1.68      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    1.69  
    1.70 -    // draw a textured square (quadrilateral)
    1.71 +    /* draw a textured square (quadrilateral) */
    1.72      glEnable(GL_TEXTURE_2D);
    1.73      glBindTexture(GL_TEXTURE_2D, texture);
    1.74      glColor3f(1.0f,1.0f,1.0f);
    1.75 @@ -393,23 +393,23 @@
    1.76          glUseProgramObjectARB(shaders[current_shader].program);
    1.77      }
    1.78  
    1.79 -    glBegin(GL_QUADS);                // start drawing a polygon (4 sided)
    1.80 +    glBegin(GL_QUADS);                /* start drawing a polygon (4 sided) */
    1.81      glTexCoord2f(texcoord[MINX], texcoord[MINY]);
    1.82 -    glVertex3f(-1.0f, 1.0f, 0.0f);        // Top Left
    1.83 +    glVertex3f(-1.0f, 1.0f, 0.0f);        /* Top Left */
    1.84      glTexCoord2f(texcoord[MAXX], texcoord[MINY]);
    1.85 -    glVertex3f( 1.0f, 1.0f, 0.0f);        // Top Right
    1.86 +    glVertex3f( 1.0f, 1.0f, 0.0f);        /* Top Right */
    1.87      glTexCoord2f(texcoord[MAXX], texcoord[MAXY]);
    1.88 -    glVertex3f( 1.0f,-1.0f, 0.0f);        // Bottom Right
    1.89 +    glVertex3f( 1.0f,-1.0f, 0.0f);        /* Bottom Right */
    1.90      glTexCoord2f(texcoord[MINX], texcoord[MAXY]);
    1.91 -    glVertex3f(-1.0f,-1.0f, 0.0f);        // Bottom Left
    1.92 -    glEnd();                    // done with the polygon
    1.93 +    glVertex3f(-1.0f,-1.0f, 0.0f);        /* Bottom Left */
    1.94 +    glEnd();                    /* done with the polygon */
    1.95  
    1.96      if (shaders_supported) {
    1.97          glUseProgramObjectARB(0);
    1.98      }
    1.99      glDisable(GL_TEXTURE_2D);
   1.100  
   1.101 -    // swap buffers to display, since we're double buffered.
   1.102 +    /* swap buffers to display, since we're double buffered. */
   1.103      SDL_GL_SwapWindow(window);
   1.104  }
   1.105