1
我每天我運行下面簡單的代碼輸出窗口崩潰OpenGL窗口崩潰
#include <stdio.h>
#include <gl/glut.h>
//#include <gl/glaux.h>
void display(void)
{
glColor3f(255.0f,255.0f,255.0f);
glBegin(GL_QUADS);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(0.0f,5.0f,0.0f);
glVertex3f(5.0f,5.0f,0.0f);
glVertex3f(5.0f,0.0f,0.0f);
glVertex3f(0.0f,0.0f,0.0f);
glEnd();
glFlush();
}
void init(void)
{
glViewport(0,0,400,400);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,4/3,4.0,1000.0);
glMatrixMode(GL_MODELVIEW);
gluLookAt(2.0,2.0,2.0,1.0,2.0,1.0,0.0,1.0,0.0);
}
int main(int argc, char *argv[])
{
glutInit(&argc,argv);
init();
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowPosition(400,400);
glutInitWindowSize(400,400);
glutCreateWindow("Trial");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
我不知道時間是怎麼回事不對任何工作欽傑基於OpenGL在VC6 請幫
爲什麼地球上你還在使用VC6? – 2011-03-04 18:04:51
,我還包括正確的標題'glut.h''gluax.h' – sumanta 2011-03-04 18:11:22
它在哪裏崩潰?確切的線路是什麼? – 2011-03-04 18:13:24