我正在使用opengl编程,我想更改摄像头视图:
...
void RenderScene() //Zeichenfunktion
{
glClearColor( 1.0, 0.5, 0.0, 0 );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity ();
//1.Form:
glBegin( GL_POLYGON ); //polygone
glColor3f( 1.0f, 0.0f, 0.0f ); //rot
glVertex3f( -0.5, -0.5, -0.5 ); //unten links 3 =3 koords, f=float
glColor3f( 0.0f, 0.0f, 1.0f ); //blau
glVertex3f( 0.5, -0.5, -0.5 ); //unten rechts
glVertex3f( 0.5, 0.5, -0.5 );//oben rechts
glVertex3f( -0.5, 0.5, -0.5 );//oben links
glEnd();
Wuerfel(0.7); //creates cube with length 0.7
gluLookAt ( 0., 0.3, 1.0, 0., 0.7, 0., 0., 1., 0.);
glFlush(); //Buffer leeren
}
...
当我更改gluLookAt的参数时,没有任何反应,我错了什么? 感谢
答案 0 :(得分:7)
gluLookAt修改当前的变换矩阵,因此它只对调用后呈现的内容产生影响。尝试将gluLookAt放在渲染代码之前。