求助OpenGL一个很初级的问题
代码如下(一个简单的hello.c示例程序):
#include <gl\glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);/* clear all pixels */
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);/* draw white polygon with corners at(0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)*/
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();/* start processing buffered OpenGL routines */
}
void init (void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);/* select clearing color */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);/* initialize viewing values */
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);/*Declare initial display mode(single buffer and RGBA).*/
glutInitWindowSize (250, 250); /*Declare initial window size.*/
glutInitWindowPosition (100, 100);/*Declare initial window position.*/
glutCreateWindow (\"hello\");/*Open window with \"hello\"in its title bar.*/
init ();/*Call initialization routines.*/
glutDisplayFunc(display); /*Register callback function to display graphics.*/
glutMainLoop();/*Enter main loop and process events.*/
return 0; /* ANSI C requires main to return int. */
}
错误提示:
1>e:\windows\hello1\hello1\hello.cpp(2) : fatal error C1083: 无法打开包括文件:“gl\glut.h”: No such file or directory
最后,声明几点:
1.我的文件里面包含了glut.h
2.我也添加了glut.Lib,glut32.lib在lib文件夹里边
3.我在system32里边也添加了glut.dll,glut32.dll