glPushMatrix ();
// view pos:
glTranslated (0.1,1.0,0.3);
// view rotate (add arcball here) :
glRotatef (theta, 0.0f, 0.0f, 1.0f);
// fixed grid
glBegin (GL_LINE_LOOP);
glColor3f (1.0f, 0.0f, 0.0f); glVertex2f (0.0f, 0.80f);
glColor3f (1.0f, 0.0f, 0.0f); glVertex2f (0.87f, -0.7f);
glColor3f (1.0f, 0.0f, 0.0f); glVertex2f (-0.87f, -0.7f);
glEnd ();
// moved object :
// object pos:
glTranslated (0.1,0.5,0.3);
// object rotate:
// glRotatef (theta, 0.0f, 0.0f, 1.0f);
glBegin (GL_TRIANGLES);
glColor3f (1.0f, 0.0f, 0.0f); glVertex2f (0.0f, 1.0f);
glColor3f (0.0f, 1.0f, 0.0f); glVertex2f (0.87f, -0.5f);
glColor3f (0.0f, 0.0f, 1.0f); glVertex2f (-0.87f, -0.5f);
glEnd ();
glPopMatrix ();