I made a square and a triangle and set the color to red two days ago. I used the same method to try to make it blue and no matter what color I try or how many times I try to clear the buffers or reset the color it will not do it.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
glBegin(GL_TRIANGLES); // Drawing Using Triangles
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
glutSetColor(2,0.0f,1.0f,0.0f); glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glutSetColor(3,0.0f,1.0f,0.0f); glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glEnd(); glTranslatef(3.0f,0.0f,0.0f); glBegin(GL_QUADS); // Draw A Quad glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left glColor3f(0.0,1.0f,0.0f); glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right glColor3f(0.0,0.0f,1.0f); glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glColor3f(0.0,0.5f,0.0f); glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glEnd(); glFlush(); glutSwapBuffers();
int main(int argc, char *argv)
glutInitDisplayMode(GLUT_INDEX | GLUT_DOUBLE | GLUT_DEPTH);
that’s what I did. How do I chang colors???