Ok, I modified my code and now my object in my second viewport draws, but it does NOT rotate. Viewport #2 needs rotate simultaneously with Viewport #1.
Here’s my code:
SetProjection();
// clear background to white and clear depth buffer
glClearColorfv( m_fvClearColor );
glClearDepth( 1.0 );
glEnable( GL_DEPTH_TEST );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glFlush();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslated(x,y,z);
glRotated(dRotation, 0.0, 0.0, 1.0);
// draw object in the first viewport
glPushAttrib( GL_ALL_ATTRIB_BITS );
glEnable( GL_CULL_FACE );
glCullFace( GL_BACK );
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
glPushMatrix();
//here’s drawing code for the object itself, in the first view port (it’s simply a disk)
quadObj = gluNewQuadric();
gluQuadricOrientation( quadObj, GLU_INSIDE );
gluQuadricDrawStyle( quadObj, GLU_FILL );
gluQuadricNormals( quadObj, GLU_SMOOTH );
gluDisk( quadObj, 0.0, dLength, 16, 8);
gluDeleteQuadric( quadObj );
glPopMatrix();
glPopAttrib();
glPopMatrix();
//NOW I HANDLE THE VIEWPORT #2
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport();//set viewport #2
gluPerspective( m_dFOV, dAspectRatio, .1, 6.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//draw the object in viewport #2
…
…
glClear (GL_DEPTH_BUFFER_BIT);
SwapBuffers(wglGetCurrentDC());
Again, viewport #1 is perfect, rotates correctly, etc. Viewport #2 is ok, except that the object does not rotate whatsoever. It should rotate when the object in viewport #1 is rotated by the user.
Thanks again.