include glut GLubyte rasters 24 0xC0 0x00 0xC0 0x00 0xC0 0x00 0xC0 0x0

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <glut.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 };
void init(void)
{
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glClearColor(0.0,0.0,0.0,0.0);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glRasterPos2i(20,20);
glBitmap(10,12,0.0,0.0,11.0,0.0,rasters);
glBitmap(10,12,0.0,0.0,11.0,0.0,rasters);
glBitmap(10,12,0.0,0.0,11.0,0.0,rasters);
glFlush();
}
void reshape(int w, int h)
{
glViewport(0,0,(GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,w,0,h,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
}
void keyboard(unsigned char key,int x,int y)
{
switch(key)
{
case 27:
exit(0);
break;
}
}
int main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(300,100);
glutCreateWindow("Drawing a Bitmapped Character");
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}