使用glrotatef()
函数可以将图形绕原点旋转指定角度。如何在不手动使用变换矩阵的情况下,将同一图形绕另一点旋转?谢谢!
void display(){
glClear(GL_COLOR_BUFFER_BIT);
gluOrtho2D(0,499,0,499);
glMatrixMode(GL_PROJECTION);
glColor3f(1,0,0);
drawhouse();
glFlush();
glColor3f(0,0,1);
glTranslatef(0.5 ,0.5,0.5);
glRotatef(45,1,1,1);
glTranslatef(-0.5 ,-0.5,-0.5);
drawhouse();
glFlush();
}
这里是一个截图,显示了发生的情况。 http://postimage.org/image/q81bhupw/
glRotatef
时,您实际上正在使用旋转矩阵,但您可能没有意识到。但我知道您的意思,John的答案将是您的首选方法。 - Christian Rau