[773] | 1 | /* gl.h |
---|
| 2 | |
---|
| 3 | GL to OpenGL translator. |
---|
| 4 | If you include this, you might be able to port old GL programs. |
---|
| 5 | There are also much better emulators available on the net. |
---|
| 6 | |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include <fltk/gl.h> |
---|
| 10 | #include "gl_draw.h" |
---|
| 11 | |
---|
| 12 | inline void clear() {glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);} |
---|
| 13 | #define RGBcolor(r,g,b) glColor3ub(r,g,b) |
---|
| 14 | #define bgnline() glBegin(GL_LINE_STRIP) |
---|
| 15 | #define bgnpolygon() glBegin(GL_POLYGON) |
---|
| 16 | #define bgnclosedline() glBegin(GL_LINE_LOOP) |
---|
| 17 | #define endline() glEnd() |
---|
| 18 | #define endpolygon() glEnd() |
---|
| 19 | #define endclosedline() glEnd() |
---|
| 20 | #define v2f(v) glVertex2fv(v) |
---|
| 21 | #define v2s(v) glVertex2sv(v) |
---|
| 22 | #define cmov(x,y,z) glRasterPos3f(x,y,z) |
---|
| 23 | #define charstr(s) gl_draw(s) |
---|
| 24 | #define fmprstr(s) gl_draw(s) |
---|
| 25 | typedef float Matrix[4][4]; |
---|
| 26 | inline void pushmatrix() {glPushMatrix();} |
---|
| 27 | inline void popmatrix() {glPopMatrix();} |
---|
| 28 | inline void multmatrix(Matrix m) {glMultMatrixf((float *)m);} |
---|
| 29 | inline void color(int n) {glIndexi(n);} |
---|
| 30 | inline void rect(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);} |
---|
| 31 | inline void rectf(int x,int y,int r,int t) {glRectf(x,y,r+1,t+1);} |
---|
| 32 | inline void recti(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);} |
---|
| 33 | inline void rectfi(int x,int y,int r,int t) {glRecti(x,y,r+1,t+1);} |
---|
| 34 | inline void rects(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);} |
---|
| 35 | inline void rectfs(int x,int y,int r,int t) {glRects(x,y,r+1,t+1);} |
---|