游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1587|回复: 2

求教opengl很基本的问题

[复制链接]

9

主题

12

帖子

12

积分

新手上路

Rank: 1

积分
12
发表于 2007-5-7 15:41:00 | 显示全部楼层 |阅读模式
#include<GL/gl.h>
#include<GL/glu.h>
#include<GL/glaux.h>
#include<stdlib.h>

void myinit()
{
        glClearColor(0,0,0);
}

void CALLBACK display()
{
        glClear(GL_COLOR_BUFFER_BIT);
        glColor4f(0.2,0.6,1.0,1.0);
        glRotate(60,1,1,1);
        auxWireCube(1.0);
        glFlush();
}

void myReshape(GLsizei w,GLsizei h)
{
        glViewport(0,0,w,h);
}

void main()
{
        auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
        auxInitPosition(0,0,400,400);
        auxInitWindow("ss");
        myinit();
        auxReshapeFunc(myReshape);
        auxMainLoop(display);
}

错误提示:
Compiling...
f.cpp
d:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2144: syntax error : missing ';' before type 'void'
d:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
d:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.

系统是XP,开发环境是VC++6.0,集成显卡 [em7]

24

主题

256

帖子

267

积分

中级会员

Rank: 3Rank: 3

积分
267
发表于 2007-5-7 19:22:00 | 显示全部楼层

Re:求教opengl很基本的问题

在最上面加一个
#include <windows.h>

或使用glew

24

主题

256

帖子

267

积分

中级会员

Rank: 3Rank: 3

积分
267
发表于 2007-5-7 19:25:00 | 显示全部楼层

Re:求教opengl很基本的问题

fatal error C1004: unexpected end of file found

有这个错误,看来还得加上一个
#include <stdafx.h>
才行。


-------------------------------------
www.PhysDev.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-26 13:04

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表