Hi,All.I want to draw 4 rectangles in a line and then rotate them(as fig.a,b,c in result.jpg show,this image is manually edited by Gimp,I haven’t got the result yet).However,my result is as fig.d in result.jpg.I follow the examples in SuperBible 4ed,and I step in GLFrame::ApplyActorTransform() when debugging,found that the GetMatrix() function in line1Frame.ApplyActorTransform() didn’t return the identity matrix,it return a matrix like this:
-1 0 0 0
0 1 0 0
0 0-1 0
0 0 0 1
I think this matrix rotate my rectangle incorrectly.How can I fix it? Thanks for any reply!
here is part of my source code,GLFrame.h is also attached.
GLFrame line1Frame;
GLFrame line2Frame;
GLFrame line3Frame;
GLFrame line4Frame;
void RenderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
line1Frame.ApplyActorTransform();
//line1Frame.ApplyCameraTransform();
glColor3f(0.30f,0.00f,0.00f);
drawMyRectangle();
//line2Frame.ApplyCameraTransform();
line2Frame.ApplyActorTransform();
glColor3f(0.60f,0.00f,0.00f);
drawMyRectangle();
//line3Frame.ApplyCameraTransform();
line3Frame.ApplyActorTransform();
glColor3f(0.90f,0.00f,0.00f);
drawMyRectangle();
//line4Frame.ApplyCameraTransform();
line4Frame.ApplyActorTransform();
glColor3f(1.00f,0.00f,0.80f);
drawMyRectangle();
glPopMatrix();
// Flush drawing commands
glutSwapBuffers();
}
// This function does any needed initialization on the rendering
// context.
void SetupRC()
{
// Black background
glClearColor(0.0f, 0.0f, 0.0f, 1.0f );
line2Frame.MoveUp(10);
line3Frame.MoveUp(10);
line4Frame.MoveUp(10);
glLineWidth(1);
}