openGL中绘制位图时,首先要调用glRasterPos2i设置光栅绘图的起点位置,glBitmap中的xorig和yorig指向光栅的起点
而glBitmap中的xMove和yMove表明下次绘图时光栅移动的距离。
#if 1
#include <GLFW/glut.h>
#include <stdlib.h>GLubyte rasters[24] = {
0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0xff, 0xc0, 0xff, 0xc0
};GLubyte rastersx55[24] = {
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55
};
void init(void)
{
glPixelStorei(GL_UNPACK_ALIGNMENT/*GL_UNPACK_SWAP_BYTES*//*GL_PACK_SWAP_BYTES*//*GL_UNPACK_ALIGNMENT*/, 1);
glClearColor(0.0, 0.0, 0.0, 0.0);
}void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);