opengl下怎么画立方体使用vc,用c++编程,应该怎么样画出哥立方体啊,请大侠给个详细的代码
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/29 07:07:57
opengl下怎么画立方体使用vc,用c++编程,应该怎么样画出哥立方体啊,请大侠给个详细的代码
opengl下怎么画立方体
使用vc,用c++编程,应该怎么样画出哥立方体啊,请大侠给个详细的代码
opengl下怎么画立方体使用vc,用c++编程,应该怎么样画出哥立方体啊,请大侠给个详细的代码
#include
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0);
glutWireCube(0.5);
glutSwapBuffers();
}
void reshape(int w,int h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-4.0,4.0,-4.0,4.0,-4.0,4.0);
}
void init()
{
glClearColor(1.0,1.0,1.0,1.0);
glColor3f(0.0,0.0,0.0);
}
int main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("cube");
glutReshapeFunc(reshape);
glutDisplayFunc(display);
init();
glutMainLoop();
}