我正在做我的OpenGL程序,我碰巧有问题,你能找到它的问题吗?
当我使用glOrtho它时,它以y轴为中心旋转一个平面工作正常,但gluPerspective事实并非如此.
这有一些问题,gluPerspective因为当我将角度更改为0时,我只能看到一些东西而不是整个东西.但是当我把它改为45时,屏幕上什么也没有出现,我也没有得到关于远近值的线索.
#include iostream
#include "Xlib.h"
#include "gl.h"
#include "glu.h"
#include "glut.h"
#include math.h
void setupRC()
{
glClearColor(1,0,0,1);
glColor3f(0,0,0);
}
void timerfunc(int value)
{
glutPostRedisplay();
glutTimerFunc(1, timerfunc ,1);
}
void RenderScene()
{
glColor3f(0,0,0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
static GLfloat rot = 0.0f,x =0.0f , y=1.0f , z=0.0f;
rot++;
glPushMatrix();
glRotatef(rot,0.0,1.0,0.0);
glBegin(GL_POLYGON);
glVertex3i(1,-1,0);
glVertex3i(1,1,0);
glVertex3i(-1,1,0);
glVertex3i(-1,-1,0);
glVertex3i(1,-1,0);
glEnd();
glPopMatrix();
if (rot == 360)
rot = 0;
glutSwapBuffers();
}
void ChangeSize(GLint w, GLint h)
{
if(h==0) …Run Code Online (Sandbox Code Playgroud) opengl ×1