Hi,
I just started programming in OpenGL. And I decided to write a short little program which has two colored squares and rotates only one of them. This is for Win98 by the way. The thing is, as I am just a beginner, I don’t know how to make only one polygon rotate! Here is the code I am using:
void Display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glRotatef(1.0, 1.0, 1.0, 0.0);
glBegin(GL_QUADS);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(-2.0, 2.0, 0.0);
glVertex3f(0.0, 2.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(-2.0, 0.0, 0.0);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(2.0, 0.0, 0.0);
glVertex3f(2.0, -2.0, 0.0);
glVertex3f(0.0, -2.0, 0.0);
glEnd();
glFlush();
SwapBuffers(hDC);
return;
}
This will make both polygons rotate, but I only want the second one to. Someone suggested putting a glLoadIdentity() before the rotate function, but this only produced a GPF on my system. I am using Borland C++ 4.5 on Win98. Hopefully, someone can shed light on a newbie and show me how to make only polygon rotate.