void glColor4fv(GLfloat *v) { GLParam p[8]; p[0].op=OP_Color; p[1].f=v[0]; p[2].f=v[1]; p[3].f=v[2]; p[4].f=v[3]; /* direct convertion to integer to go faster if no shading */ p[5].ui = (unsigned int) (sll2int( slladd( sllmul(v[0], int2sll(ZB_POINT_RED_MAX - ZB_POINT_RED_MIN)), int2sll(ZB_POINT_RED_MIN) ) ) ); p[6].ui = (unsigned int) (sll2int( slladd( sllmul(v[1], int2sll(ZB_POINT_GREEN_MAX - ZB_POINT_GREEN_MIN)), int2sll(ZB_POINT_GREEN_MIN) ) ) ); p[7].ui = (unsigned int) (sll2int( slladd( sllmul(v[2], int2sll(ZB_POINT_BLUE_MAX - ZB_POINT_BLUE_MIN)), int2sll(ZB_POINT_BLUE_MIN) ) ) ); gl_add_op(p); }
void glColor4f(GLfloat r,GLfloat g,GLfloat b,GLfloat a) { GLParam p[8]; p[0].op=OP_Color; p[1].f=r; p[2].f=g; p[3].f=b; p[4].f=a; /* direct convertion to integer to go faster if no shading */ p[5].ui = (unsigned int) (sll2int( slladd( sllmul(r,int2sll(ZB_POINT_RED_MAX - ZB_POINT_RED_MIN)), int2sll(ZB_POINT_RED_MIN) ) ) ); p[6].ui = (unsigned int) (sll2int( slladd( sllmul(g, int2sll(ZB_POINT_GREEN_MAX - ZB_POINT_GREEN_MIN)), int2sll(ZB_POINT_GREEN_MIN) ) ) ); p[7].ui = (unsigned int) (sll2int( slladd( sllmul(b, int2sll(ZB_POINT_BLUE_MAX - ZB_POINT_BLUE_MIN)), int2sll(ZB_POINT_BLUE_MIN) ) ) ); gl_add_op(p); }
void glEnableClientState(GLenum array) { GLParam p[2]; p[0].op = OP_EnableClientState; switch(array) { case GL_VERTEX_ARRAY: p[1].i = VERTEX_ARRAY; break; case GL_NORMAL_ARRAY: p[1].i = NORMAL_ARRAY; break; case GL_COLOR_ARRAY: p[1].i = COLOR_ARRAY; break; case GL_TEXTURE_COORD_ARRAY: p[1].i = TEXCOORD_ARRAY; break; default: assert(0); break; } gl_add_op(p); }
void glArrayElement(GLint i) { GLParam p[2]; p[0].op = OP_ArrayElement; p[1].i = i; gl_add_op(p); }
void tglEdgeFlag(int flag) { TinyGL::GLParam p[2]; p[0].op = TinyGL::OP_EdgeFlag; p[1].i = flag; gl_add_op(p); }
void tglLoadName(unsigned int name) { TinyGL::GLParam p[2]; p[0].op = TinyGL::OP_LoadName; p[1].i = name; gl_add_op(p); }
void glInitNames(void) { GLParam p[1]; p[0].op=OP_InitNames; gl_add_op(p); }
void glPopMatrix(void) { GLParam p[1]; p[0].op=OP_PopMatrix; gl_add_op(p); }
void glEnd(void) { GLParam p[1]; p[0].op=OP_End; gl_add_op(p); }
void glLoadIdentity(void) { GLParam p[1]; p[0].op=OP_LoadIdentity; gl_add_op(p); }
void glPopName(void) { GLParam p[1]; p[0].op=OP_PopName; gl_add_op(p); }
void glEdgeFlag(int flag) { GLParam p[2]; p[0].op=OP_EdgeFlag; p[1].i=flag; gl_add_op(p); }
void glPolygonOffset(GLfloat factor, GLfloat units) { GLParam p[3]; p[0].op = OP_PolygonOffset; p[1].f = factor; p[2].f = units; gl_add_op(p); }
void glMatrixMode(int mode) { GLParam p[2]; p[0].op=OP_MatrixMode; p[1].i=mode; gl_add_op(p); }
void glBegin(int mode) { GLParam p[2]; p[0].op=OP_Begin; p[1].i=mode; gl_add_op(p); }
void glClearDepth(double depth) { GLParam p[2]; p[0].op=OP_ClearDepth; p[1].f=depth; gl_add_op(p); }
void glClear(int mask) { GLParam p[2]; p[0].op=OP_Clear; p[1].i=mask; gl_add_op(p); }
void glColorPointer(TGLint size, TGLenum type, TGLsizei stride, const TGLvoid *pointer) { GLParam p[4]; assert(type == TGL_FLOAT); p[0].op = OP_ColorPointer; p[1].i = size; p[2].i = stride; p[3].p = const_cast<void *>(pointer); gl_add_op(p); }
void glCallList(unsigned int list) { GLParam p[2]; p[0].op=OP_CallList; p[1].i=list; gl_add_op(p); }
void glLoadName(unsigned int name) { GLParam p[2]; p[0].op=OP_LoadName; p[1].i=name; gl_add_op(p); }
void glMultMatrixf(const float *m) { GLParam p[17]; int i; p[0].op=OP_MultMatrix; for(i=0;i<16;i++) p[i+1].f=m[i]; gl_add_op(p); }
void glHint(int target,int mode) { GLParam p[3]; p[0].op=OP_Hint; p[1].i=target; p[2].i=mode; gl_add_op(p); }
void glDisable(int cap) { GLParam p[3]; p[0].op=OP_EnableDisable; p[1].i=cap; p[2].i=0; gl_add_op(p); }
void tglScalef(float x, float y, float z) { TinyGL::GLParam p[4]; p[0].op = TinyGL::OP_Scale; p[1].f = x; p[2].f = y; p[3].f = z; gl_add_op(p); }
void glPixelStorei(int pname,int param) { GLParam p[3]; p[0].op=OP_PixelStore; p[1].i=pname; p[2].i=param; gl_add_op(p); }
void glBindTexture(int target,int texture) { GLParam p[3]; p[0].op=OP_BindTexture; p[1].i=target; p[2].i=texture; gl_add_op(p); }
void glColorMaterial(int mode,int type) { GLParam p[3]; p[0].op=OP_ColorMaterial; p[1].i=mode; p[2].i=type; gl_add_op(p); }
void glDrawArrays(GLenum mode, GLint first, GLsizei count) { GLParam p[4]; p[0].op = OP_DrawArrays; p[1].i = mode; p[2].i = first; p[3].i = count; gl_add_op(p); }
void tglClearColor(float r, float g, float b, float a) { TinyGL::GLParam p[5]; p[0].op = TinyGL::OP_ClearColor; p[1].f = r; p[2].f = g; p[3].f = b; p[4].f = a; gl_add_op(p); }
void tglViewport(int x, int y, int width, int height) { TinyGL::GLParam p[5]; p[0].op = TinyGL::OP_Viewport; p[1].i = x; p[2].i = y; p[3].i = width; p[4].i = height; gl_add_op(p); }