#include <stdlib.h>
#include <GL/glut.h>
/* Letter f*/
Glubyte f_rasters[12] = {0XC0,0XC0,0XC0,0XC0,0XC0,0XFC,
0XFC,0XC0,0XC0,0XC0,0XFF,0XFF};
/* Letter i*/
Glubyte i_rasters[12] = {0xff,0xff,0x18,0x18,0x18,0x18,
0X18,0X18,0X18,0X18,0XFF,0XFF};
/* Letter l*/
Glubyte l_rasters[12] = {0xff,0xff,0xc0,0xc0,0xc0,0xc0,
0XC0,0XC0,0XC0,0XC0,0XC0,0XC0};
/* Letter e*/
Glubyte e_rasters[12] = {0xff,0xff,0xc0,0xc0,0xc0,0xff,
0XFF,0XC0,0XC0,0XC0,0XFF,0XFF};
void Myinit (void)
{
Glpixelstorei (gl_unpack_alignment,1);//set pixel storage mode
Glclearcolor (1.0,1.0,1.0,1.0);/Set Background to White
}
void Mydisplay ()
{
Glclear (Gl_color_buffer_bit);
glcolor3f (0.0,0.0,0.0);//set pixel color to black
Glrasterpos2i (20,20);//Specify Position for pixel
/* Draw Bitmap * *
Glbitmap (8,12,0.0,0.0,14.0,0.0,f_rasters);
Glbitmap (8,12,0.0,0.0,14.0,0.0,i_rasters);
Glbitmap (8,12,0.0,0.0,14.0,0.0,l_rasters);
Glbitmap (8,12,0.0,0.0,14.0,0.0,e_rasters);
Glflush ();
}
void Myreshape (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);
Glloadidentity ();
}
int main (int argc,char * * argv)
{
/* Initialize * *
Glutinit (&ARGC,ARGV);
Glutinitdisplaymode (glut_single| GLUT_RGB);
Glutinitwindowsize (500,400);
Glutinitwindowposition (100,100);
/* Create window * *
Glutcreatewindow ("BitMap");
/* Draw Graphics * *
Myinit ();
Glutreshapefunc (Myreshape);
Glutdisplayfunc (Mydisplay);
Glutmainloop ()//Enter GLUT event handling loop
return 0;
} |