/* ermitejo: ver.990930/000712/000825 */ #include #pragma comment (lib, "winmm.lib") /* link MultiMedia */ #pragma comment (lib, "opengl32.lib") /* link OpenGL */ #pragma comment (lib, "glu32.lib") /* link OpenGL utilites */ #pragma comment (lib, "glut32.lib") /* link Win32 GLUT */ #include #include #include #include #include #define M_PI 3.14159265359 #define M_RAD 0.01745329252 /* pi/180.0 */ #define glcolor3d(r,g,b) glColor3d(r,g,b) #define glrectd(x1,y1,x2,y2) glRectd(x1,y1,x2,y2) #define gdisk() gdisc() #define gpnt3d(x1,y1,z1) gpoint3d(x1,y1,z1) #define right(_angl) _Theta-=(_angl) /* angl: degree */ #define left(_angl) _Theta+=(_angl) #define turn(_angl) _Theta+=(_angl) #define glrasterpos2i glRasterPos2i #define glrasterpos2d glRasterPos2d /* CAPITAL to LOWERCASE */ #define gclearbuffers() glClear(0x00004000|0x00000100) #define gclearbuffer() glClear(0x00004000);/* sgl|dle */ #define glfloat GLfloat #define glutdisplayfunc(func) glutDisplayFunc(func) #define glutidlefunc(func) glutIdleFunc(func) #define glutkeyboardfunc glutKeyboardFunc #define glutmainloop() glutMainLoop() #define glutmousefunc(bt_st_xy) glutMouseFunc(bt_st_xy) #define glutpostredisplay() glutPostRedisplay() #define glutreshapefunc(name) glutReshapeFunc(name) #define glutswapbuffers() glutSwapBuffers() #define glut_left_button 0 #define glut_middle_button 1 #define glut_right_button 2 #define glut_down 0 #define glut_up 1 #define gl_back 0x0405 #define gl_color_buffer_bit 0x00004000 #define gl_cull_face 0x0B44 #define gl_depth_buffer_bit 0x00000100 #define gl_depth_test 0x0B71 #define gl_flat 0x1D00 #define gl_lequal 0x0203 #define gl_lighting 0x0B50 #define gl_smooth 0x1D01 /* Logical operation in GX */ #define gl_color_logic_op GL_COLOR_LOGIC_OP #define gl_and 0x1501 #define gl_xor 0x1506 #define gl_or 0x1507 #define gl_nor 0x1508 #define gl_nand 0x150E #define glclearcolor(r,g,b,a) glClearColor(r,g,b,a) #define glclear(mask) glClear(mask) #define glcullface(mode) glCullFace(mode) #define gldisable glDisable #define glenable glEnable #define glend() glEnd() #define glflush() glFlush() #define glloadidentity() glLoadIdentity() #define gllogicop(lg_op) glLogicOp(lg_op) #define glmatrixmode(mode) glMatrixMode(mode) #define glpointsize(float_size) glPointSize(float_size) #define glpopmatrix() glPopMatrix() #define glpushmatrix() glPushMatrix() #define glrotated(ang,x,y,z) glRotated(ang,x,y,z) #define glrotatef(angle,x,y,z) glRotatef(angle,x,y,z) #define glscaled(x,y,z) glScaled(x,y,z) #define glscalef(x,y,z) glScalef(x,y,z) #define glshademodel(cc) glShadeModel(cc) #define gltranslated(x,y,z) glTranslated(x,y,z) #define gltranslatef(x,y,z) glTranslatef(x,y,z) #define glviewport(x,y,w,h) glViewport(x,y,w,h) #define random(r) Random(r) static int __display_num; double _xturt=0.0, _yturt=0.0, _Theta=0.0; /* Theta: degree */ GLUquadricObj *_qobj; int perif_div=60; double half_dv=30.0; int _wnd_wide=512, _wnd_hite=512; double _Width_Height_size=256.0; double _Fvy=60.0, _zNr=1.0, _zFr=20.0; /* perspective values */ int Random(int r){return(rand()%r);}/* random numb: 0 to r */ void glogicop(int lg_op){ glEnable(GL_COLOR_LOGIC_OP); glLogicOp(lg_op); } void ginit(int bcd){ /* buffer:single/double, rgb,depth */ if (bcd==1){glutInitDisplayMode(0|0);} /* sngl,rgb */ else if(bcd==2){glutInitDisplayMode(2|0);} /* double,rgb */ else if(bcd==3){glutInitDisplayMode(2|0|16);}/*dbl,rgb,dep */ else if(bcd==4){glutInitDisplayMode(0|0|16);}/*sgl,rgb,dep */ glutInitWindowPosition(256,0); /* origin:0,0 */ glutInitWindowSize(_wnd_wide,_wnd_hite);/* int:x,y:512,512 */ glutCreateWindow( "OpenGL" ); /* open the named window */ glClearColor(0.0,0.0,0.0,1.0); /* clear with black */ glClear(GL_COLOR_BUFFER_BIT); /* clear Window */ glColor3d(1.0,1.0,1.0); /* default draw_color: white */ glShadeModel(GL_FLAT); /* or GL_SMOOTH */ } void window_size(double spacesize){ _Width_Height_size=spacesize; glOrtho(-spacesize,spacesize,-spacesize,spacesize,-1.0,1.0); } void ortho_window(int wide, int hite){ double ss=_Width_Height_size; glViewport(0,0,wide,hite); glMatrixMode(GL_PROJECTION); glLoadIdentity(); if(wide<=hite)glOrtho(-ss,ss,-ss*(GLdouble)hite/(GLdouble) wide,ss*(GLdouble)hite/(GLdouble)wide, -ss, ss); else glOrtho(-ss*(GLdouble)wide/(GLdouble)hite, ss*(GLdouble)wide/(GLdouble)hite,-ss,ss,-ss,ss); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void perspect_window(int wide, int hite){ glViewport(0,0,wide,hite); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(_Fvy,(GLfloat)wide/(GLfloat)hite,_zNr,_zFr); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); } void reshapefunc(int op){ if(op==1) glutReshapeFunc(ortho_window); if(op==2) glutReshapeFunc(perspect_window); } void perspective(double fv,double zn,double zf){ _Fvy=fv; _zNr=zn; _zFr=zf; } /*#### 2_D GRAPHICS FUNCTION ####*/ void color16(int c){ switch(c){ case 0: glColor3d(0.0,0.0,0.0); break; /* black */ case 1: glColor3d(0.0,0.0,0.5); break; /* dark_blue */ case 2: glColor3d(0.8,0.3,0.2); break; /* brown */ case 3: glColor3d(0.5,0.0,0.5); break; /* dark_magnt*/ case 4: glColor3d(0.0,0.5,0.0); break; /* dark_green*/ case 5: glColor3d(0.0,0.5,0.5); break; /* dark_cyan */ case 6: glColor3d(0.5,0.5,0.0); break; /* dark_yelw */ case 7: glColor3d(0.5,0.5,0.5); break; /* dark_gray */ case 8: glColor3d(0.7,0.7,0.7); break; /* gray */ case 9: glColor3d(0.0,0.0,1.0); break; /* blue */ case 10: glColor3d(1.0,0.0,0.0); break; /* red */ case 11: glColor3d(1.0,0.0,1.0); break; /* magenta */ case 12: glColor3d(0.0,1.0,0.0); break; /* green */ case 13: glColor3d(0.0,1.0,1.0); break; /* cyan */ case 14: glColor3d(1.0,1.0,0.0); break; /* yellow */ case 15: glColor3d(1.0,1.0,1.0); break; /* white */ default: glColor3d(1.0,1.0,1.0); } } void glcolor(int r,int g,int b){ glColor3ub((char)r,(char)g,(char)b); } void glcolord(double r,double g,double b){ glColor3ub((byte)r,(byte)g,(byte)b); } void gpoint(double x1,double y1 ){ glBegin(GL_POINTS); glVertex2d( x1,y1 ); glEnd(); } void gpnt(int x,int y){ glBegin(GL_POINTS); glVertex2i(x,y); glEnd(); } void gline(double x1,double y1,double x2,double y2){ glBegin(GL_LINES); glVertex2d( x1,y1 ); glVertex2d( x2,y2 ); glEnd(); } void gtriangle(double x1,double y1,double x2, /* NOT PAINTED */ double y2,double x3,double y3){ glBegin(GL_LINE_LOOP); glVertex2d(x1,y1); glVertex2d(x2,y2); glVertex2d(x3,y3); glEnd(); } void gtri(double x1,double y1,double x2,double y2, double x3,double y3){ glBegin(GL_TRIANGLES); glVertex2d(x1,y1); /* PAINTED */ glVertex2d(x2,y2); glVertex2d(x3,y3); glEnd(); } void grectangle(double x1, double y1, double x2, double y2){ glBegin(GL_LINE_LOOP); /* NOT PAINTED */ glVertex2d(x1,y1); glVertex2d(x2,y1); glVertex2d(x2,y2); glVertex2d(x1,y2); glEnd(); } void gquad(double x1, double y1, double x2, double y2){ glBegin(GL_QUADS); /* PAINTED */ glVertex2d(x1,y1); glVertex2d(x2,y1); glVertex2d(x2,y2); glVertex2d(x1,y2); glEnd(); } void gcircle(double xc,double yc, double r){ /* NOT PAINTED */ double xx,yy,rad; int j; rad=M_PI/half_dv; glBegin(GL_LINE_LOOP); for(j=0; j<=perif_div; j++){ xx=xc+r*cos(rad*j); yy=yc+r*sin(rad*j); glVertex2d(xx,yy); } glEnd(); } void gdisc(double xc,double yc, double r){ /* PAINTED */ double xx,yy,rad; int j; rad=M_PI/half_dv; glBegin(GL_POLYGON); for(j=0; j=-10.0;j-=0.25){ gline3d(j,0.0,-10.0, j,0.0,10.0); gline3d(-10.0,0.0,j,10.0,0.0,j); } } /*## TURTLE GRAPHICS FUNCTION ##*/ void initurtle(void){ _xturt=0.0, _yturt=0.0, _Theta=0.0; } int getxturt(){ return(_xturt); } /* get x posit */ int getyturt(){ return(_yturt); } /* get y posit */ void moveto(double x,double y) { _xturt=x; _yturt=y; } void lineto(double x, double y){ gline(_xturt,_yturt,x,y); _xturt=x; _yturt=y; } void move(double L) { /* draw L line with curr. direct */ double x,y; x=_xturt+L*cos(_Theta*M_RAD); y=_yturt+L*sin(_Theta*M_RAD); gline(_xturt,_yturt,x,y); _xturt=x; _yturt=y; } void moverel(double L){ /* move L without line */ _xturt+=L*cos(_Theta*M_RAD); _yturt+=L*sin(_Theta*M_RAD); moveto(_xturt,_yturt); } /*#### GET,PUT IMAGE ####*/ void ggetimage(int x,int y,int wid,int hit,unsigned char *rgbary){ glReadPixels(x+(int)_Width_Height_size,y+(int) _Width_Height_size,wid,hit,GL_RGB,GL_UNSIGNED_BYTE,rgbary); } void gputimage(int x,int y,int wid,int hit,unsigned char *rgbary){ glRasterPos2i(x,y); glDrawPixels(wid,hit,GL_RGB,GL_UNSIGNED_BYTE,rgbary); } /*## BIT MAP CHARACTERs ##*/ void enablebitmapfont(void){ int i; byte bitmaps[][12] = { /* */{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /*!*/{0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18}, /*"*/{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x36,0x36,0x36}, /*#*/{0x00,0x00,0x00,0x66,0x66,0xff,0x66,0x66,0xff,0x66,0x66,0x00}, /*$*/{0x00,0x18,0x7e,0xff,0x1b,0x1f,0x7e,0xf8,0xd8,0xff,0x7e,0x18}, /*%*/{0x00,0x0e,0x1b,0xdb,0x6e,0x30,0x18,0x0c,0x76,0xdb,0xd8,0x70}, /*&*/{0x00,0x7f,0xc6,0xcf,0xd8,0x70,0x70,0xd8,0xcc,0xcc,0x6c,0x38}, /*'*/{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x1c,0x0c,0x0e}, /*(*/{0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0c}, /*)*/{0x00,0x30,0x18,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x18,0x30}, /***/{0x00,0x00,0x00,0x00,0x99,0x5a,0x3c,0xff,0x3c,0x5a,0x99,0x00}, /*+*/{0x00,0x00,0x00,0x18,0x18,0x18,0xff,0xff,0x18,0x18,0x18,0x00}, /*,*/{0x00,0x00,0x30,0x18,0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,0x00}, /*-*/{0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00}, /*.*/{0x00,0x00,0x00,0x38,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /*/*/{0x60,0x60,0x30,0x30,0x18,0x18,0x0c,0x0c,0x06,0x06,0x03,0x03}, /*0*/{0x00,0x3c,0x66,0xc3,0xe3,0xf3,0xdb,0xcf,0xc7,0xc3,0x66,0x3c}, /*1*/{0x00,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78,0x38,0x18}, /*2*/{0x00,0xff,0xc0,0xc0,0x60,0x30,0x18,0x0c,0x06,0x03,0xe7,0x7e}, /*3*/{0x00,0x7e,0xe7,0x03,0x03,0x07,0x7e,0x07,0x03,0x03,0xe7,0x7e}, /*4*/{0x00,0x0c,0x0c,0x0c,0x0c,0x0c,0xff,0xcc,0x6c,0x3c,0x1c,0x0c}, /*5*/{0x00,0x7e,0xe7,0x03,0x03,0x07,0xfe,0xc0,0xc0,0xc0,0xc0,0xff}, /*6*/{0x00,0x7e,0xe7,0xc3,0xc3,0xc7,0xfe,0xc0,0xc0,0xc0,0xe7,0x7e}, /*7*/{0x00,0x30,0x30,0x30,0x30,0x18,0x0c,0x06,0x03,0x03,0x03,0xff}, /*8*/{0x00,0x7e,0xe7,0xc3,0xc3,0xe7,0x7e,0xe7,0xc3,0xc3,0xe7,0x7e}, /*9*/{0x00,0x7e,0xe7,0x03,0x03,0x03,0x7f,0xe7,0xc3,0xc3,0xe7,0x7e}, /*:*/{0x00,0x00,0x00,0x38,0x38,0x00,0x00,0x38,0x38,0x00,0x00,0x00}, /*;*/{0x00,0x00,0x30,0x18,0x1c,0x1c,0x00,0x00,0x1c,0x1c,0x00,0x00}, /*<*/{0x00,0x06,0x0c,0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x0c,0x06}, /*=*/{0x00,0x00,0x00,0x00,0xff,0xff,0x00,0xff,0xff,0x00,0x00,0x00}, /*>*/{0x00,0x60,0x30,0x18,0x0c,0x06,0x03,0x06,0x0c,0x18,0x30,0x60}, /*?*/{0x00,0x18,0x00,0x00,0x18,0x18,0x0c,0x06,0x03,0xc3,0xc3,0x7e}, /*@*/{0x00,0x00,0x3f,0x60,0xcf,0xdb,0xd3,0xdd,0xc3,0x7e,0x00,0x00}, /*A*/{0x00,0xc3,0xc3,0xc3,0xc3,0xff,0xc3,0xc3,0xc3,0x66,0x3c,0x18}, /*B*/{0x00,0xfe,0xc7,0xc3,0xc3,0xc7,0xfe,0xc7,0xc3,0xc3,0xc7,0xfe}, /*C*/{0x00,0x7e,0xe7,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xe7,0x7e}, /*D*/{0x00,0xfc,0xce,0xc7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc7,0xce,0xfc}, /*E*/{0x00,0xff,0xc0,0xc0,0xc0,0xc0,0xfc,0xc0,0xc0,0xc0,0xc0,0xff}, /*F*/{0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xfc,0xc0,0xc0,0xc0,0xff}, /*G*/{0x00,0x7e,0xe7,0xc3,0xc3,0xcf,0xc0,0xc0,0xc0,0xc0,0xe7,0x7e}, /*H*/{0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xff,0xc3,0xc3,0xc3,0xc3,0xc3}, /*I*/{0x00,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7e}, /*J*/{0x00,0x7c,0xee,0xc6,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06}, /*K*/{0x00,0xc3,0xc6,0xcc,0xd8,0xf0,0xe0,0xf0,0xd8,0xcc,0xc6,0xc3}, /*L*/{0x00,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0}, /*M*/{0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xdb,0xff,0xff,0xe7,0xc3}, /*N*/{0x00,0xc7,0xc7,0xcf,0xcf,0xdf,0xdb,0xfb,0xf3,0xf3,0xe3,0xe3}, /*O*/{0x00,0x7e,0xe7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xe7,0x7e}, /*P*/{0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xfe,0xc7,0xc3,0xc3,0xc7,0xfe}, /*Q*/{0x00,0x3f,0x6e,0xdf,0xdb,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x3c}, /*R*/{0x00,0xc3,0xc6,0xcc,0xd8,0xf0,0xfe,0xc7,0xc3,0xc3,0xc7,0xfe}, /*S*/{0x00,0x7e,0xe7,0x03,0x03,0x07,0x7e,0xe0,0xc0,0xc0,0xe7,0x7e}, /*T*/{0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff}, /*U*/{0x00,0x7e,0xe7,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3}, /*V*/{0x00,0x18,0x3c,0x3c,0x66,0x66,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3}, /*W*/{0x00,0xc3,0xe7,0xff,0xff,0xdb,0xdb,0xc3,0xc3,0xc3,0xc3,0xc3}, /*X*/{0x00,0xc3,0x66,0x66,0x3c,0x3c,0x18,0x3c,0x3c,0x66,0x66,0xc3}, /*Y*/{0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x3c,0x66,0x66,0xc3}, /*Z*/{0x00,0xff,0xc0,0xc0,0x60,0x30,0x7e,0x0c,0x06,0x03,0x03,0xff}, /*[*/{0x00,0x3c,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3c}, /*\*/{0x03,0x03,0x06,0x06,0x0c,0x0c,0x18,0x18,0x30,0x30,0x60,0x60}, /*]*/{0x00,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c}, /*^*/{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc3,0x66,0x3c,0x18}, /*_*/{0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /*`*/{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x38,0x30,0x70}, /*a*/{0x00,0x7f,0xc3,0xc3,0x7f,0x03,0xc3,0x7e,0x00,0x00,0x00,0x00}, /*b*/{0x00,0xfe,0xc3,0xc3,0xc3,0xc3,0xfe,0xc0,0xc0,0xc0,0xc0,0xc0}, /*c*/{0x00,0x7e,0xc3,0xc0,0xc0,0xc0,0xc3,0x7e,0x00,0x00,0x00,0x00}, /*d*/{0x00,0x7f,0xc3,0xc3,0xc3,0xc3,0x7f,0x03,0x03,0x03,0x03,0x03}, /*e*/{0x00,0x00,0x7f,0xc0,0xc0,0xfe,0xc3,0xc3,0x7e,0x00,0x00,0x00}, /*f*/{0x00,0x30,0x30,0x30,0x30,0x30,0xfc,0x30,0x30,0x30,0x33,0x1e}, /*g*/{0x7e,0xc3,0x03,0x03,0x7f,0xc3,0xc3,0xc3,0x7e,0x00,0x00,0x00}, /*h*/{0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xfe,0xc0,0xc0,0xc0,0xc0}, /*i*/{0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x18}, /*j*/{0x38,0x6c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x00,0x00,0x0c}, /*k*/{0x00,0xc6,0xcc,0xf8,0xf0,0xd8,0xcc,0xc6,0xc0,0xc0,0xc0,0xc0}, /*l*/{0x00,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x78}, /*n*/{0x00,0x00,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xfe,0x00,0x00,0x00}, /*m*/{0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xfc,0x00,0x00,0x00}, /*o*/{0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00}, /*p*/{0xc0,0xc0,0xc0,0xfe,0xc3,0xc3,0xc3,0xc3,0xfe,0x00,0x00,0x00}, /*q*/{0x03,0x03,0x03,0x7f,0xc3,0xc3,0xc3,0xc3,0x7f,0x00,0x00,0x00}, /*r*/{0x00,0x00,0xc0,0xc0,0xc0,0xc0,0xc0,0xe0,0xfe,0x00,0x00,0x00}, /*s*/{0x00,0x00,0xfe,0x03,0x03,0x7e,0xc0,0xc0,0x7f,0x00,0x00,0x00}, /*t*/{0x00,0x00,0x1c,0x36,0x30,0x30,0x30,0x30,0xfc,0x30,0x30,0x30}, /*u*/{0x00,0x00,0x7e,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00}, /*v*/{0x00,0x00,0x18,0x3c,0x3c,0x66,0x66,0xc3,0xc3,0x00,0x00,0x00}, /*w*/{0x00,0x00,0xc3,0xe7,0xff,0xdb,0xc3,0xc3,0xc3,0x00,0x00,0x00}, /*x*/{0x00,0x00,0xc3,0x66,0x3c,0x18,0x3c,0x66,0xc3,0x00,0x00,0x00}, /*y*/{0xc0,0x60,0x60,0x30,0x18,0x3c,0x66,0x66,0xc3,0x00,0x00,0x00}, /*z*/{0x00,0x00,0xff,0x60,0x30,0x18,0x0c,0x06,0xff,0x00,0x00,0x00}, /*{*/{0x00,0x0f,0x18,0x18,0x18,0x38,0xf0,0x38,0x18,0x18,0x18,0x0f}, /*|*/{0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}, /*}*/{0x00,0xf0,0x18,0x18,0x18,0x1c,0x0f,0x1c,0x18,0x18,0x18,0xf0}, /*~*/{0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x8f,0xf1,0x60,0x00,0x00} }; glPixelStorei(GL_UNPACK_ALIGNMENT,1); __display_num=glGenLists(127); for (i=32; i<127; i++){ glNewList(__display_num+i,GL_COMPILE); glBitmap(8,12,0.0,1.0,10.0,0.0,bitmaps[i-32]); glEndList(); } } void printstring(char *str){ glPushAttrib(GL_LIST_BIT); glListBase(__display_num); glCallLists(strlen(str),GL_BYTE,str); glPopAttrib(); } /*## LIGHT ATRIBUTE ##*/ void lightenable(int light_number){ /* set a light enable */ int ltn; ltn=0x4000+light_number; glEnable(GL_LIGHTING); glEnable(ltn); glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); }