summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_noop.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-02-24 15:08:22 +0000
committerBrian Paul <[email protected]>2004-02-24 15:08:22 +0000
commit4d5dddd125ec99f25bc0abafcca90033392a100e (patch)
tree8b4615139924b5832ce6fb0b9b36a45fe8f4458d /src/mesa/main/api_noop.c
parent9d1ff8c1bb56b9ba0d3bf4552351d8bff6620ef2 (diff)
jump through dispatch table instead of calling gl functions directly
Diffstat (limited to 'src/mesa/main/api_noop.c')
-rw-r--r--src/mesa/main/api_noop.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c
index 6b331faa2d5..e7f185a272c 100644
--- a/src/mesa/main/api_noop.c
+++ b/src/mesa/main/api_noop.c
@@ -40,8 +40,10 @@
* These functions provide this service by keeping uptodate the
* 'ctx->Current' struct for all data elements not included in the
* currently enabled hardware vertex.
- *
+ * I.e. these functions would typically be used when outside of glBegin/End.
*/
+
+
void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
{
GET_CURRENT_CONTEXT(ctx);
@@ -593,12 +595,12 @@ void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2
ASSERT_OUTSIDE_BEGIN_END(ctx);
}
- glBegin( GL_QUADS );
- glVertex2f( x1, y1 );
- glVertex2f( x2, y1 );
- glVertex2f( x2, y2 );
- glVertex2f( x1, y2 );
- glEnd();
+ _glapi_Dispatch->Begin( GL_QUADS );
+ _glapi_Dispatch->Vertex2f( x1, y1 );
+ _glapi_Dispatch->Vertex2f( x2, y1 );
+ _glapi_Dispatch->Vertex2f( x2, y2 );
+ _glapi_Dispatch->Vertex2f( x1, y2 );
+ _glapi_Dispatch->End();
}
@@ -614,10 +616,10 @@ void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
return;
- glBegin(mode);
+ _glapi_Dispatch->Begin(mode);
for (i = 0; i < count; i++)
- glArrayElement(start + i);
- glEnd();
+ _glapi_Dispatch->ArrayElement(start + i);
+ _glapi_Dispatch->End();
}
@@ -630,27 +632,27 @@ void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
return;
- glBegin(mode);
+ _glapi_Dispatch->Begin(mode);
switch (type) {
case GL_UNSIGNED_BYTE:
for (i = 0 ; i < count ; i++)
- glArrayElement( ((GLubyte *)indices)[i] );
+ _glapi_Dispatch->ArrayElement( ((GLubyte *)indices)[i] );
break;
case GL_UNSIGNED_SHORT:
for (i = 0 ; i < count ; i++)
- glArrayElement( ((GLushort *)indices)[i] );
+ _glapi_Dispatch->ArrayElement( ((GLushort *)indices)[i] );
break;
case GL_UNSIGNED_INT:
for (i = 0 ; i < count ; i++)
- glArrayElement( ((GLuint *)indices)[i] );
+ _glapi_Dispatch->ArrayElement( ((GLuint *)indices)[i] );
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
break;
}
- glEnd();
+ _glapi_Dispatch->End();
}
void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
@@ -663,7 +665,7 @@ void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
if (_mesa_validate_DrawRangeElements( ctx, mode,
start, end,
count, type, indices ))
- glDrawElements( mode, count, type, indices );
+ _glapi_Dispatch->DrawElements( mode, count, type, indices );
}
/*
@@ -708,11 +710,11 @@ void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
du = ctx->Eval.MapGrid1du;
u = ctx->Eval.MapGrid1u1 + i1 * du;
- glBegin( prim );
+ _glapi_Dispatch->Begin( prim );
for (i=i1;i<=i2;i++,u+=du) {
- glEvalCoord1f( u );
+ _glapi_Dispatch->EvalCoord1f( u );
}
- glEnd();
+ _glapi_Dispatch->End();
}
@@ -747,38 +749,38 @@ void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1,
switch (mode) {
case GL_POINT:
- glBegin( GL_POINTS );
+ _glapi_Dispatch->Begin( GL_POINTS );
for (v=v1,j=j1;j<=j2;j++,v+=dv) {
for (u=u1,i=i1;i<=i2;i++,u+=du) {
- glEvalCoord2f(u, v );
+ _glapi_Dispatch->EvalCoord2f(u, v );
}
}
- glEnd();
+ _glapi_Dispatch->End();
break;
case GL_LINE:
for (v=v1,j=j1;j<=j2;j++,v+=dv) {
- glBegin( GL_LINE_STRIP );
+ _glapi_Dispatch->Begin( GL_LINE_STRIP );
for (u=u1,i=i1;i<=i2;i++,u+=du) {
- glEvalCoord2f(u, v );
+ _glapi_Dispatch->EvalCoord2f(u, v );
}
- glEnd();
+ _glapi_Dispatch->End();
}
for (u=u1,i=i1;i<=i2;i++,u+=du) {
- glBegin( GL_LINE_STRIP );
+ _glapi_Dispatch->Begin( GL_LINE_STRIP );
for (v=v1,j=j1;j<=j2;j++,v+=dv) {
- glEvalCoord2f(u, v );
+ _glapi_Dispatch->EvalCoord2f(u, v );
}
- glEnd();
+ _glapi_Dispatch->End();
}
break;
case GL_FILL:
for (v=v1,j=j1;j<j2;j++,v+=dv) {
- glBegin( GL_TRIANGLE_STRIP );
+ _glapi_Dispatch->Begin( GL_TRIANGLE_STRIP );
for (u=u1,i=i1;i<=i2;i++,u+=du) {
- glEvalCoord2f(u, v );
- glEvalCoord2f(u, v+dv );
+ _glapi_Dispatch->EvalCoord2f(u, v );
+ _glapi_Dispatch->EvalCoord2f(u, v+dv );
}
- glEnd();
+ _glapi_Dispatch->End();
}
break;
default: