您的位置:首页 > 移动开发 > 微信开发

初学OpenGL,我写的一个小程序:输出“中国加油”

2009-12-30 16:44 232 查看
#include
#include
#include
#include

void myinit(void);
void CALLBACK myReshape(GLsizei w,GLsizei h);
void CALLBACK display(void);

GLubyte rasters1[12]={
0x10,0x10,0x10,0x10,0xff,0x91,
0x91,0x91,0xff,0x10,0x10,0x10
};

GLubyte rasters2[12]={
0xff,0x81,0x81,0xff,0x93,0x95,
0x91,0xff,0x91,0xff,0x81,0xff
};

GLubyte rasters3[12]={
0x00,0x00,0x00,0x00,0x10,0x97,
0x55,0x31,0xf7,0x20,0x00,0x00
};

GLubyte rasters4[12]={
0x00,0x00,0x1f,0x55,0x35,0x3f,
0x55,0x35,0x5f,0x04,0x04,0x00
};

void myinit(void)
{
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
}

void CALLBACK display(void)
{
glColor3f(1.0,0.0,1.0);
glRasterPos2i(100,200);
glBitmap(8,12,0.0,0.0,20.0,0.0,rasters1);
glBitmap(8,12,0.0,0.0,20.0,0.0,rasters2);
glBitmap(8,12,0.0,0.0,20.0,0.0,rasters3);
glBitmap(8,12,0.0,0.0,0.0,0.0,rasters4);

glFlush();
}

void CALLBACK myReshape(GLsizei w,GLsizei h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,w,0,h,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
}

void main()
{
auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
auxInitPosition(0,0,500,500);
auxInitWindow("yangliqiang");

myinit();

auxReshapeFunc(myReshape);
auxMainLoop(display);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  callback alignment buffer
相关文章推荐