opengl glulookat 无法调节视角
见主要代码voidDrawGLScene(GLvoid){glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);glLoadI...
见主要代码
void DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(18.0f, -20.0f, -92.0f);//Host
glPushMatrix();
//GLdouble eqn[4] = { -1.0, 0.0, 0.0, 0.0 };
glClipPlane(GL_CLIP_PLANE0, eqn);
glScalef(8, 16, 24);
ID = LoadBitmap("HostFront.bmp");
glBindTexture(GL_TEXTURE_2D, ID);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0, 0, 1);//前
glTexCoord2f(1.0f, 0.0f); glVertex3f(1, 0, 1);
glTexCoord2f(1.0f, 1.0f); glVertex3f(1, 1, 1);
glTexCoord2f(0.0f, 1.0f); glVertex3f(0, 1, 1);
glEnd();
//....由于字数限制 此处省去五个面的点画
glPopMatrix();
glFlush();
glutSwapBuffers();
}
//************************* main function *************************//
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(0, 0);
glutInitWindowSize(1024, 768);
glutCreateWindow("Chen Anqi-Host ");
InitGL();
glutDisplayFunc(&DrawGLScene);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(3, 1.5, 3, 0,0, 0, 0, 1, 0);
glutMainLoop();
return 0;
} 展开
void DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(18.0f, -20.0f, -92.0f);//Host
glPushMatrix();
//GLdouble eqn[4] = { -1.0, 0.0, 0.0, 0.0 };
glClipPlane(GL_CLIP_PLANE0, eqn);
glScalef(8, 16, 24);
ID = LoadBitmap("HostFront.bmp");
glBindTexture(GL_TEXTURE_2D, ID);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0, 0, 1);//前
glTexCoord2f(1.0f, 0.0f); glVertex3f(1, 0, 1);
glTexCoord2f(1.0f, 1.0f); glVertex3f(1, 1, 1);
glTexCoord2f(0.0f, 1.0f); glVertex3f(0, 1, 1);
glEnd();
//....由于字数限制 此处省去五个面的点画
glPopMatrix();
glFlush();
glutSwapBuffers();
}
//************************* main function *************************//
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(0, 0);
glutInitWindowSize(1024, 768);
glutCreateWindow("Chen Anqi-Host ");
InitGL();
glutDisplayFunc(&DrawGLScene);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(3, 1.5, 3, 0,0, 0, 0, 1, 0);
glutMainLoop();
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询