23 #ifndef VTK_IMPLEMENT_MESA_CXX
24 # include "vtkOpenGL.h"
27 #define vtkOpenGLCall_glEnable vtkOpenGLStateCache::CurrentGLCache->glEnable
28 #define vtkOpenGLCall_glDisable vtkOpenGLStateCache::CurrentGLCache->glDisable
29 #define vtkOpenGLCall_glAlphaFunc vtkOpenGLStateCache::CurrentGLCache->glAlphaFunc
30 #define vtkOpenGLCall_glBlendFunc vtkOpenGLStateCache::CurrentGLCache->glBlendFunc
31 #define vtkOpenGLCall_glDepthFunc vtkOpenGLStateCache::CurrentGLCache->glDepthFunc
32 #define vtkOpenGLCall_glTexEnvf vtkOpenGLStateCache::CurrentGLCache->glTexEnvf
33 #define vtkOpenGLCall_glLightModeli vtkOpenGLStateCache::CurrentGLCache->glLightModeli
34 #define vtkOpenGLCall_glLightModelfv vtkOpenGLStateCache::CurrentGLCache->glLightMOdelfv
35 #define vtkOpenGLCall_glLightfv vtkOpenGLStateCache::CurrentGLCache->glLightfv
36 #define vtkOpenGLCall_glLightf vtkOpenGLStateCache::CurrentGLCache->glLightf
37 #define vtkOpenGLCall_glLighti vtkOpenGLStateCache::CurrentGLCache->glLighti
38 #define vtkOpenGLCall_glMaterialfv vtkOpenGLStateCache::CurrentGLCache->glMaterialfv
39 #define vtkOpenGLCall_glShadeModel vtkOpenGLStateCache::CurrentGLCache->glShadeModel
40 #define vtkOpenGLCall_glClearColor vtkOpenGLStateCache::CurrentGLCache->glClearColor
41 #define vtkOpenGLCall_glClearDepth vtkOpenGLStateCache::CurrentGLCache->glClearDepth
42 #define vtkOpenGLCall_glDepthMask vtkOpenGLStateCache::CurrentGLCache->glDepthMask
43 #define vtkOpenGLCall_glCullFace vtkOpenGLStateCache::CurrentGLCache->glCullFace
44 #define vtkOpenGLCall_glClear vtkOpenGLStateCache::CurrentGLCache->glClear
45 #define vtkOpenGLCall_glDrawBuffer vtkOpenGLStateCache::CurrentGLCache->glDrawBuffer
46 #define vtkOpenGLCall_glMatrixMode vtkOpenGLStateCache::CurrentGLCache->glMatrixMode
47 #define vtkOpenGLCall_glViewport vtkOpenGLStateCache::CurrentGLCache->glViewport
48 #define vtkOpenGLCall_glScissor vtkOpenGLStateCache::CurrentGLCache->glScissor
49 #define vtkOpenGLCall_glClipPlane vtkOpenGLStateCache::CurrentGLCache->glClipPlane
50 #define vtkOpenGLCall_glColorMaterial vtkOpenGLStateCache::CurrentGLCache->glColorMaterial
51 #define vtkOpenGLCall_glPointSize vtkOpenGLStateCache::CurrentGLCache->glPointSize
52 #define vtkOpenGLCall_glLineWidth vtkOpenGLStateCache::CurrentGLCache->glLineWidth
53 #define vtkOpenGLCall_glLineStipple vtkOpenGLStateCache::CurrentGLCache->glLineStipple
54 #define vtkOpenGLCall_glDepthRange vtkOpenGLStateCache::CurrentGLCache->glDepthRange
55 #define vtkOpenGLCall_glPolygonOffset vtkOpenGLStateCache::CurrentGLCache->glPolygonOffset
57 #define vtkOpenGLCall_glPushMatrix glPushMatrix
58 #define vtkOpenGLCall_glPopMatrix glPopMatrix
59 #define vtkOpenGLCall_glMultMatrixd glMultMatrixd
60 #define vtkOpenGLCall_glLoadMatrixd glLoadMatrixd
61 #define vtkOpenGLCall_glLoadIdentity glLoadIdentity
62 #define vtkOpenGLCall_glSelectBuffer glSelectBuffer
63 #define vtkOpenGLCall_glRenderMode glRenderMode
64 #define vtkOpenGLCall_glInitNames glInitNames
65 #define vtkOpenGLCall_glPushName glPushName
66 #define vtkOpenGLCall_glLoadName glLoadName
67 #define vtkOpenGLCall_glGetIntegerv glGetIntegerv
68 #define vtkOpenGLCall_glIsTexture glIsTexture
69 #define vtkOpenGLCall_glDeleteTextures glDeleteTexture
70 #define vtkOpenGLCall_glGenTextures glGenTextures
71 #define vtkOpenGLCall_glBindTexture glBindTexture
72 #define vtkOpenGLCall_glTexParameterf glTextParameterf
73 #define vtkOpenGLCall_glTexCoord2fv glTexCoord2fv
74 #define vtkOpenGLCall_glVertex3fv glVertex3fv
75 #define vtkOpenGLCall_glNormal3fv glNormal3fv
76 #define vtkOpenGLCall_glColor3f glColor3f
77 #define vtkOpenGLCall_glColor4ubv glColor4ubv
78 #define vtkOpenGLCall_glColor4fv glColor4fv
79 #define vtkOpenGLCall_glBegin glBegin
80 #define vtkOpenGLCall_glEnd glEnd
81 #define vtkOpenGLCall_glTexImage2D glTextImage2D
82 #define vtkOpenGLCall_glDeleteLists glDeleteLists
83 #define vtkOpenGLCall_glIsList glIsList
84 #define vtkOpenGLCall_glGenLists glGenLists
85 #define vtkOpenGLCall_glCallList glCallList
86 #define vtkOpenGLCall_glReadBuffer glReadBuffer
87 #define vtkOpenGLCall_glPixelStorei glPixelStorei
88 #define vtkOpenGLCall_glReadPixels glReadPixels
89 #define vtkOpenGLCall_glRasterPos3f glRasterPos3f
90 #define vtkOpenGLCall_glDrawPixels glDrawPixels
91 #define vtkOpenGLCall_glRasterPos2f glRasterPos2f
92 #define vtkOpenGLCall_glNewList glNewList
93 #define vtkOpenGLCall_glEndList glEndList
131 register char *val=0;
135 if(ex<8) {val=Enable_GL_LIGHT_buckets+ex; }
142 if(ex<8) { val=Enable_GL_CLIP_PLANE_buckets+ex; }
146 if(e>=0xB10 && e<=0xDE1)
149 val=Enable_buckets+ex;
153 printf(
"Error: glEnable of 0x%X failed\n",e);
166 register char *val=0;
170 if(ex<8) { val=Enable_GL_LIGHT_buckets+ex; }
177 if(ex<8) { val=Enable_GL_CLIP_PLANE_buckets+ex; }
181 if(e>=0xB10 && e<=0xDE1)
184 val=Enable_buckets+ex;
188 printf(
"Error: glEnable of 0x%X failed\n",e);
203 if(e==GL_GREATER && cf!=AlphaFunc_bucket)
214 if(e==GL_SRC_ALPHA && e1!=BlendFunc_bucket)
227 if(e!=DepthFunc_bucket)
238 if(e==GL_TEXTURE_ENV && e1==GL_TEXTURE_ENV_MODE)
240 if(f!=TexEnvf_MODE_bucket)
242 TexEnvf_MODE_bucket=f;
253 if(e==GL_LIGHT_MODEL_TWO_SIDE && i!=LightModeli_LIGHT_MODEL_TWO_SIDE_bucket){
254 LightModeli_LIGHT_MODEL_TWO_SIDE_bucket=i;
264 if(e==GL_LIGHT_MODEL_AMBIENT &&
265 (fv[0]!=LightModelfv_LIGHT_MODEL_AMBIENT_bucket[0] ||
266 fv[1]!=LightModelfv_LIGHT_MODEL_AMBIENT_bucket[1] ||
267 fv[2]!=LightModelfv_LIGHT_MODEL_AMBIENT_bucket[2])){
268 fv[0]=LightModelfv_LIGHT_MODEL_AMBIENT_bucket[0];
269 fv[1]=LightModelfv_LIGHT_MODEL_AMBIENT_bucket[1];
270 fv[2]=LightModelfv_LIGHT_MODEL_AMBIENT_bucket[2];
282 inline void glLightfv( GLenum light, GLenum pname,
const GLfloat *params)
284 register GLfloat *val = Lightfv_buckets + ((((int)(pname-0x1201))|((
int)(light-GL_LIGHT0)<<3))<<2);
285 if(params[0]!=val[0] ||
307 inline void glLightf( GLenum light, GLenum pname, GLfloat f){
308 register GLfloat *val=Lightf_buckets+(((int)(light-GL_LIGHT0)<<3)|((
int)(pname-0x1205)));
313 if(pname==GL_SPOT_CUTOFF)
314 Lighti_SPOT_CUTOFF_buckets[light-GL_LIGHT0]=-1;
322 inline void glLighti( GLenum light, GLenum pname, GLint f)
324 if(pname==GL_SPOT_CUTOFF && f!=Lighti_SPOT_CUTOFF_buckets[light-GL_LIGHT0]){
325 Lighti_SPOT_CUTOFF_buckets[light-GL_LIGHT0]=f;
328 Lightf_buckets[((int)(light-GL_LIGHT0)<<3)|0x02] = -1.0f;
344 inline void glMaterialfv(GLenum face, GLenum pname,
const GLfloat *params )
347 register GLfloat *val;
350 idx=pname-0x1600 + 4;
361 val = Materialfv_buckets + ((((face-0x0404)<<3)|idx)<<2);
362 if(val[0]!=params[0] ||
387 if(ShadeModel_bucket!=e)
414 if(d!=ClearDepth_bucket)
424 if(DepthMask_bucket!=e)
436 if(CullFace_bucket!=e)
451 if(e!=DrawBuffer_bucket){
461 if(e!=MatrixMode_bucket){
483 inline void glScissor(GLint llx,GLint lly,GLint u,GLint v){
501 register GLdouble *val=ClipPlane_bucket + ((e-0x3000)<<2);
520 register GLenum *val= ColorMaterial_bucket + (face-0x0404);
528 if(f!=PointSize_bucket){
535 if(f!=LineWidth_bucket){
544 if(factor!=LineStipple_FACTOR_bucket ||
545 pattern!=LineStipple_PATTERN_bucket)
547 LineStipple_FACTOR_bucket=factor;
548 LineStipple_PATTERN_bucket=pattern;
557 if(DepthRange_NEAR_bucket!=nearval ||
558 DepthRange_FAR_bucket!=farval)
560 DepthRange_NEAR_bucket=nearval;
561 DepthRange_FAR_bucket=farval;
566 #ifdef GL_VERSION_1_1
568 GLfloat PolygonOffset_bucket[2];
569 inline void glPolygonOffset( GLfloat f,GLfloat u) {
570 if(PolygonOffset_bucket[0]!=f ||
571 PolygonOffset_bucket[1]!=u){
572 PolygonOffset_bucket[0]=f;
573 PolygonOffset_bucket[1]=u;
574 ::glPolygonOffset(f,u);
void glShadeModel(GLenum e)
void glLineWidth(GLfloat f)
void glDepthFunc(GLenum e)
GLclampf ClearColor_buckets[4]
void glClearColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a)
GLdouble ClipPlane_bucket[4 *GL_MAX_CLIP_PLANES]
GLclampd DepthRange_NEAR_bucket
GLenum ColorMaterial_bucket[8]
void glMatrixMode(GLenum e)
void glLineStipple(GLint factor, GLushort pattern)
GLclampd DepthRange_FAR_bucket
void glAlphaFunc(GLenum e, GLclampf cf)
void glDrawBuffer(GLenum e)
void glLightf(GLenum light, GLenum pname, GLfloat f)
GLfloat TexEnvf_MODE_bucket
void glLighti(GLenum light, GLenum pname, GLint f)
GLint Lighti_SPOT_CUTOFF_buckets[8]
GLint LightModeli_LIGHT_MODEL_TWO_SIDE_bucket
char Enable_buckets[0xDE1-0xB10+1]
GLclampf AlphaFunc_bucket
void glCullFace(GLenum e)
GLfloat LightModelfv_LIGHT_MODEL_AMBIENT_bucket[3]
void glClearDepth(GLclampd d)
GLclampd ClearDepth_bucket
void glTexEnvf(GLenum e, GLenum e1, GLfloat f)
void glLightModelfv(GLenum e, GLfloat *fv)
static vtkOpenGLStateCache * CurrentGLCache
void glScissor(GLint llx, GLint lly, GLint u, GLint v)
void glLightfv(GLenum light, GLenum pname, const GLfloat *params)
void glLightModeli(GLenum e, GLint i)
void glViewport(GLint llx, GLint lly, GLint u, GLint v)
GLushort LineStipple_PATTERN_bucket
void glPointSize(GLfloat f)
GLfloat Lightf_buckets[8 *8]
void glClipPlane(GLenum e, const GLdouble *eqn)
void glDepthRange(GLclampd nearval, GLclampd farval)
void glBlendFunc(GLenum e, GLenum e1)
GLint LineStipple_FACTOR_bucket
void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
void glClear(GLbitfield b)
void glColorMaterial(GLenum face, GLenum mode)
char Enable_GL_CLIP_PLANE_buckets[8]
void glDepthMask(GLenum e)
GLclampf DepthMask_bucket
GLfloat Lightfv_buckets[8 *4 *8]
char Enable_GL_LIGHT_buckets[8]
checks for redundancies in state-change requests
GLfloat Materialfv_buckets[8 *8 *4]