opengl坐标问题
下面这段是绘图代码:voiddisplay(){GLfloati=0.0f;glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT...
下面这段是绘图代码:
void display()
{
GLfloat i=0.0f;
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1.0f,0.5f,0.7f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0f,0.0f,1.0f,xrot,yrot,zrot,0.0f,1.0f,0.0f);
glBegin(GL_TRIANGLES);
glVertex3f(0.0f,0.3f,0.0f);
glVertex3f(0.3f,0.0f,0.0f);
glVertex3f(-0.3f,0.0f,0.0f);
glEnd();
glColor3f(0.8f,0.5f,0.3f);
glutSolidSphere(0.1f, 30, 30 );
}
当我把glulookat的眼睛位置设置成0.0,0.0,2.0,时就看不到物体了,怎样才能使绘图时的物体坐标不受限制(就是,现在我只能在1到-1的坐标内画图,怎样才能突破这个限制) 展开
void display()
{
GLfloat i=0.0f;
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1.0f,0.5f,0.7f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0f,0.0f,1.0f,xrot,yrot,zrot,0.0f,1.0f,0.0f);
glBegin(GL_TRIANGLES);
glVertex3f(0.0f,0.3f,0.0f);
glVertex3f(0.3f,0.0f,0.0f);
glVertex3f(-0.3f,0.0f,0.0f);
glEnd();
glColor3f(0.8f,0.5f,0.3f);
glutSolidSphere(0.1f, 30, 30 );
}
当我把glulookat的眼睛位置设置成0.0,0.0,2.0,时就看不到物体了,怎样才能使绘图时的物体坐标不受限制(就是,现在我只能在1到-1的坐标内画图,怎样才能突破这个限制) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询