#include<GL/gl.h>
#include<GL/glu.h>
#include<GL/glut.h>
#include<stdlib.h>
GLubyte rasters[]={
0xc0,0xf0,
0xc0,0xf0,
0xc1,0xb0,
0xc1,0xb0,
0xc3,0x30,
0xc3,0x30,
0xc6,0x30,
0xc6,0x30,
0xd8,0x30,
0xd8,0x30,
0xf0,0x30,
0xf0,0x30
};
GLubyte rasters1[]={
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xff,0xf0,
0xff,0xf0,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xff,0xf0,
0xff,0xf0
};
GLubyte rasters2[]={
0x06,0x00,
0x06,0x00,
0x1f,0x80,
0x19,0x80,
0x39,0xc0,
0x39,0xc0,
0x70,0xe0,
0x701,0e00,
0x60,0x60,
0xe0,0x70,
0xe0,0x70,
0xc0,0x30
};
GLubyte rasters3[]={
0xff,0xe0,
0xff,0xf0,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xff,0xf0,
0xff,0xe0
};
GLubyte rasters4[]={
0xff,0xf0,
0xff,0xf0,
0xc0,0x00,
0xc0,0x00,
0xc0,0x00,
0xff,0xc0,
0xff,0xc0,
0xc0,0x00,
0xc0,0x00,
0xc0,0x00,
0xff,0xf0,
0xff,0xf0
};
GLubyte rasters5[]={
0xc0,0x00,
0xc0,0x00,
0xc0,0x00,
0xc0,0x00,
0xc0,0x00,
0xff,0xf0,
0xff,0xf0,
0xc0,0x30,
0xc0,0x30,
0xc0,0x30,
0xff,0xf0,
0xff,0xf0
};
void init(void)
{
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glClearColor(0.0,1.0,1.0,0.0);
}
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);
//glLoadIdentity();
}
void display(void)
{
// glClearColor(0.0,1.0,1.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0,0.0,1.0);
glRasterPos2i(100,100);
glBitmap(12,12,0.0,0.0,15.0,0.0,rasters);
glBitmap(12,12,0.0,0.0,15.0,0.0,rasters1);
glBitmap(12,12,0.0,0.0,15.0,0.0,rasters2);
glBitmap(12,12,0.0,0.0,15.0,0.0,rasters3);
glBitmap(12,12,0.0,0.0,15.0,0.0,rasters4);
glBitmap(12,12,0.0,0.0,15.0,0.0,rasters4);
glBitmap(12,12,0.0,0.0,15.0,0.0,rasters5);
glFlush();
}
int main(int argc,char *argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(600,600);
glutInitWindowPosition(100,100);
glutCreateWindow("bitmapping");
glutReshapeFunc(reshape);
init();
glutDisplayFunc(display);
glutMainLoop();
}
No comments:
Post a Comment