|
|
#include "glos.h"
#include <GL/gl.h>
#include <GL/glaux.h>
#include "windows.h"
void main(void)
{
/*初始化:*/
auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
//窗口显示单缓存和RGB(彩色)模式
auxInitPosition(0,0,500,500);
//大小x=500 y=500 (0,0)是屏幕左上点
auxInitWindow("sample1");
//窗口初始化,参数是标题
glClearColor(0.0,0.0,0.0,0.0);
//将窗口清为黑色
glClear(GL_COLOR_BUFFER_BIT);
//将颜色缓存清为glClearColor命令所设置的颜色
//即背景色
/*绘图*/
glColor3f(1.0,0.0,0.0);
//选颜色(R,G,B),参数0<x<1,这里就是红色
glRectf(-0.5,-0.5,0.5,0.5);
//画个方块
glFlush();
//强制绘图,不驻留缓存
sleep(1000);
//windows函数,显示1秒(单位是毫秒)
}
编译的时候提示的错误如下:
--------------------Configuration: sample01 - Win32 Debug--------------------
Compiling...
opengl.cpp
F:\小强\游戏开发\练习\最简单的OpenGL例子\sample01\opengl.cpp(29) : error C2065: 'sleep' : undeclared identifier
Error executing cl.exe.
sample01.exe - 1 error(s), 0 warning(s)
请各位高手帮帮忙!
谢谢
! |
|