gl/examples: fixup sdl example for gluPerspective removal

This commit is contained in:
Matthew Waters 2014-12-10 12:48:33 +11:00 committed by Tim-Philipp Müller
parent 67b47921ca
commit b99d53e0ff

View file

@ -84,17 +84,17 @@ DrawGLScene (GstBuffer * buf)
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity (); // Reset The View
glTranslatef (-1.5f, 0.0f, -6.0f); // Move Left 1.5 Units And Into The Screen 6.0
glTranslatef (-0.4f, 0.0f, 0.0f); // Move Left 1.5 Units And Into The Screen 6.0
glRotatef (rtri, 0.0f, 1.0f, 0.0f); // Rotate The Triangle On The Y axis
// draw a triangle (in smooth coloring mode)
glBegin (GL_POLYGON); // start drawing a polygon
glColor3f (1.0f, 0.0f, 0.0f); // Set The Color To Red
glVertex3f (0.0f, 1.0f, 0.0f); // Top
glVertex3f (0.0f, 0.4f, 0.0f); // Top
glColor3f (0.0f, 1.0f, 0.0f); // Set The Color To Green
glVertex3f (1.0f, -1.0f, 0.0f); // Bottom Right
glVertex3f (0.4f, -0.4f, 0.0f); // Bottom Right
glColor3f (0.0f, 0.0f, 1.0f); // Set The Color To Blue
glVertex3f (-1.0f, -1.0f, 0.0f); // Bottom Left
glVertex3f (-0.4f, -0.4f, 0.0f); // Bottom Left
glEnd (); // we're done with the polygon (smooth color interpolation)
glEnable (GL_TEXTURE_2D);
@ -106,20 +106,20 @@ DrawGLScene (GstBuffer * buf)
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glLoadIdentity (); // make sure we're no longer rotated.
glTranslatef (1.5f, 0.0f, -6.0f); // Move Right 3 Units, and back into the screen 6.0
glTranslatef (0.5f, 0.0f, 0.0f); // Move Right 3 Units, and back into the screen 6.0
glRotatef (rquad, 1.0f, 0.0f, 0.0f); // Rotate The Quad On The X axis
// draw a square (quadrilateral)
glColor3f (0.5f, 0.5f, 1.0f); // set color to a blue shade.
glColor3f (0.4f, 0.4f, 1.0f); // set color to a blue shade.
glBegin (GL_QUADS); // start drawing a polygon (4 sided)
glTexCoord3f (0.0f, 1.0f, 0.0f);
glVertex3f (-1.0f, 1.0f, 0.0f); // Top Left
glVertex3f (-0.4f, 0.4f, 0.0f); // Top Left
glTexCoord3f (1.0f, 1.0f, 0.0f);
glVertex3f (1.0f, 1.0f, 0.0f); // Top Right
glVertex3f (0.4f, 0.4f, 0.0f); // Top Right
glTexCoord3f (1.0f, 0.0f, 0.0f);
glVertex3f (1.0f, -1.0f, 0.0f); // Bottom Right
glVertex3f (0.4f, -0.4f, 0.0f); // Bottom Right
glTexCoord3f (0.0f, 0.0f, 0.0f);
glVertex3f (-1.0f, -1.0f, 0.0f); // Bottom Left
glVertex3f (-0.4f, -0.4f, 0.0f); // Bottom Left
glEnd (); // done with the polygon
glBindTexture (GL_TEXTURE_2D, 0);