关于opengl的一个小问题~~

yaoshuwen 2006-07-17 03:57:23
代码:
#include <Gl/Gl.H>
#include <Gl/GLU.H>
#include <Gl/glut.h>

void redn(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
void main(void)
{
glutIntDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("temp");
glutDisplayFunc(glClear(GL_COLOR_BUFFER_BIT););
glClearColor(0.0f,1.0f,1.2f,1.5f);
glutMainLoop();
}

然后报错误
:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2144: syntax error : missing ';' before type 'void'
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found

我还缺点什么东西?
...全文
559 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
lucaowei 2006-11-04
  • 打赏
  • 举报
回复
要加#include <windows.h>
billwillman 2006-10-28
  • 打赏
  • 举报
回复
#include <windows.h>
#include <GL/gl.h>
#include <GL/glaux.h>
#pragma comment(lib,"OpenGL32.lib")
#pragma comment(lib,"GLu32.lib")
#pragma comment(lib,"GlAux.Lib")
#pragma comment(lib,"glut32.lib")
anachronism 2006-10-19
  • 打赏
  • 举报
回复
这个问题我也遇到过,一般把gl.h和glu.h去掉,只包含glut.h就可以了,但具体原因也不太清楚
higter 2006-09-21
  • 打赏
  • 举报
回复
#include <Gl/glut.h>
#include <Gl/Gl.H>
#include <Gl/GLU.H>

void redn(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
void main(void)
{

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("temp");
glutDisplayFunc(redn);
glClearColor(0.0f,1.0f,1.2f,1.5f);
glutMainLoop();
}

yanlingevol 2006-09-21
  • 打赏
  • 举报
回复
确保opengl的库已经设置好,有了glut.h之后,glu.h和gl.h就不用加了,windows.h也不需要。
CD2006 2006-07-20
  • 打赏
  • 举报
回复
如果已经#include <gl/glut.h>就不需要前面的gl.h和glu.h了
glut会保证这两个库被引用,在windows下需要windows.h, 如楼上各层所述,呵呵
dingounan 2006-07-18
  • 打赏
  • 举报
回复
在gl.h文件的结尾打上一个回车试试
ftkghost 2006-07-18
  • 打赏
  • 举报
回复
加上 #include<windows.h>或者#define WINGDIAPI
你的gl.h和glu.h是MS的,里面定义使用了WINGDIAPI宏

还有你的glutDisplayFunc(glClear(GL_COLOR_BUFFER_BIT););错了
改成glutDisplayFunc(redn);
redn是你用于渲染的函数
yaoshuwen 2006-07-17
  • 打赏
  • 举报
回复
no,不是windows.h,似乎是一个后缀名.SRC的文件
dayforever 2006-07-17
  • 打赏
  • 举报
回复
windows.h ?

8,303

社区成员

发帖
与我相关
我的任务
社区描述
游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧