1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glBindTexture(GL_TEXTURE_2D, TextureID);
glLoadIdentity();
//Move to offset
glTranslatef( rPlayer.x , rPlayer.y , 0 );
//Start quad
glBegin( GL_QUADS );
//Set color to white
// glColor4f( 1.0, 1.0, 1.0, 1.0 );
//Draw square
glTexCoord2f(0, 0); glVertex3f( 0, 0, 0 );
glTexCoord2f(1, 0); glVertex3f( SQUARE_WIDTH, 0, 0 );
glTexCoord2f(1, 1); glVertex3f( SQUARE_WIDTH, SQUARE_HEIGHT, 0 );
glTexCoord2f(0, 1); glVertex3f( 0, SQUARE_HEIGHT, 0 );
//End quad
glEnd();
glLoadIdentity();
//Move to offset
glTranslatef( 20 , 200 , 0 );
//Start quad
glBegin( GL_QUADS );
//Set color to white
glColor4f( 1.0, 1.0, 1.0, 1.0 );
//Draw square
glVertex3f( 0, 0, 0 );
glVertex3f( SQUARE_WIDTH, 0, 0 );
glVertex3f( SQUARE_WIDTH, SQUARE_HEIGHT, 0 );
glVertex3f( 0, SQUARE_HEIGHT, 0 );
//End quad
glEnd();
|