用opengl写立方体,不知道头文件哪错了,请大家帮忙改下~
#include<stdio.h>#include <stdlib.h>
#include<GL/glut.h>
void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
glshadeModel(GL_FLAT);//关闭渐变效果计算,两顶点之间的点与设置一个点相同
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glLoadIdentity();//透视投影
gluLookAt(0.0,0.0,5.0,0.0,0.0,0.0,0.0,0.0,0.0);//观看视点在Z轴上方5
gluScalef(1.0,2.0,1.0);
glutWireCube(1.0);
glFlush();
}
void reshape(int w,int h)
{
glViewPoint(0.0,(GLsizei)h,(GLsizei)w);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0,1.0,-1.0,1.0,1.5,20.0);//??
glMatrixMode(GL_MODELVIEW);
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GULT_SINGLE|GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPostion(100,100);
glutCreatWindow(argv[0]);
init();
glutDisplayFunc(display);
glutreshapeFunc(reshape);
glutMainLoop();
return 0;
}
提示没有标识符,但不知道怎么改,自学中,请大虾帮忙