- 分享
- 0
- 人气
- 0
- 主题
- 18
- 帖子
- 235
- UID
- 340594
- 积分
- 256
- 阅读权限
- 14
- 注册时间
- 2010-8-9
- 最后登录
- 2024-9-26
- 在线时间
- 3342 小时
|
为什么不能 run 以下的 coding??
我用 Microsoft Visual C++ 2008。。
谁能帮我。。。
/* ex4.c */
#include <GL/glut.h>
void display (void) {
/* Called when OpenGL needs to update the display */
glClear (GL_COLOR_BUFFER_BIT); /* Clear the window */
glLoadIdentity ();
gluLookAt (0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glBegin (GL_LINE_LOOP); /* Draw a triangle */
glVertex3f(-0.3, -0.3, 0.0);
glVertex3f(0.0, 0.3, 0.0);
glVertex3f(0.3, -0.3, 0.0);
glEnd ();
glFlush (); /* Force update of screen */
}
void keyboard (unsigned char key, int x, int y) {
/* Called when a key is pressed */
if (key == 27) exit (0); /* 27 is the Escape key */
}
void reshape (int width, int height)
{ /* Called when the window is created, moved or resized */
glViewport (0, 0, (GLsizei) width, (GLsizei) height);
glMatrixMode (GL_PROJECTION); /* Select the projection matrix */
glLoadIdentity (); /*Initialise it */
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); /* The unit cube */
glMatrixMode (GL_MODELVIEW); / Select the modelview matrix */
}
int main (int argc, char **argv) {
glutInit (&argc, argv); /* Initialise OpenGL */
glutInitWindowSize (500, 500); /* Set the window size */
glutInitWindowPosition (100, 100); /* Set the window position */
glutCreateWindow (“ex4”); /* Create the window */
glutDisplayFunc (display); /* Register the “display” function */
glutReshapeFunc (reshape); /* Register the “reshape” function */
glutKeyboardFunc (keyboard); /* Register the “keyboard” function */
glutMainLoop (); /* Enter the OpenGL main loop */
return 0;
}
/*end of ex4.c */ |
|