Original Post
Hi. I have one GL_TRIANGLES and one GL_QUADS in my scene. The triangle just with a color and the quad with a texture in one dimension of it.But i found that the triangle lost its color which i give it. :( I am a beginner and i need your help! :) the drawing function as follow: int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(-2.0f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0 glRotatef(rtri,1.0f,0.0f,0.0f); // Rotate The Triangle On The Y axis glBegin(GL_TRIANGLES); // Start Drawing A Triangle glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f( 1.0f,-1.0f, -1.0f); // Right Of Triangle (Right) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f( 1.0f,-1.0f, -1.0f); // Left Of Triangle (Back) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f(-1.0f,-1.0f, -1.0f); // Right Of Triangle (Back) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left) glEnd(); // Done Drawing The Pyramid glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(2.0f,0.0f,-9.0f); // Move Right 1.5 Units And Into The Screen 6.0 glRotatef(rquad,0.0f,1.0f,1.0f); // Rotate The Quad On The X axis ( NEW ) glBindTexture(GL_TEXTURE_2D, texture[0]); // Select Our Texture glBegin(GL_QUADS); // Start Drawing A Quad glColor3f(0.5f,0.0f,0.5f); glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left Of The Quad glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right Of The Quad glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right Of The Quad glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left Of The Quad glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 2.0f); // Top Left Of The Quad glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 2.0f); // Top Right Of The Quad glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f, 2.0f); // Bottom Right Of The Quad glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f, 2.0f); // Bottom Left Of The Quad glColor3f(0.5f,0.0f,0.0f); glVertex3f(-1.0f, 1.0f, 2.0f); // Top Left Of The Quad glVertex3f(-1.0f, 1.0f, 0.0f); // Top Right Of The Quad glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Right Of The Quad glVertex3f(-1.0f,-1.0f, 2.0f); // Bottom Left Of The Quad glColor3f(0.0f,0.5f,0.5f); glVertex3f( 1.0f, 1.0f, 0.0f); // Top Left Of The Quad glVertex3f( 1.0f, 1.0f, 2.0f); // Top Right Of The Quad glVertex3f( 1.0f,-1.0f, 2.0f); // Bottom Right Of The Quad glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Left Of The Quad glColor3f(0.5f,0.1f,0.5f); glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left Of The Quad glVertex3f(-1.0f, 1.0f, 2.0f); // Top Right Of The Quad glVertex3f( 1.0f, 1.0f, 0.0f); // Bottom Right Of The Quad glVertex3f( 1.0f, 1.0f, 2.0f); // Bottom Left Of The Quad glColor3f(0.5f,0.0f,4.0f); glVertex3f(-1.0f,-1.0f, 0.0f); // Top Left Of The Quad glVertex3f(-1.0f,-1.0f, 2.0f); // Top Right Of The Quad glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right Of The Quad glVertex3f( 1.0f,-1.0f, 2.0f); // Bottom Left Of The Quad glEnd(); // Done Drawing The Quad rtri-=1.0f; rquad-=0.1f; return TRUE; // Keep Going }