From d2afb39d1997e9f2e3c64fc9fa49393e2839d8a1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Sep 2003 18:15:13 +0000 Subject: Implement GL_ELEMENT_ARRAY_BUFFER_ARB for buffer objects. --- src/mesa/tnl/t_array_api.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/mesa/tnl/t_array_api.c') diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index 95bc293bee..229371fc0a 100644 --- a/src/mesa/tnl/t_array_api.c +++ b/src/mesa/tnl/t_array_api.c @@ -62,8 +62,14 @@ static void fallback_drawelements( GLcontext *ctx, GLenum mode, GLsizei count, { if (_tnl_hard_begin(ctx, mode)) { GLint i; - for (i = 0 ; i < count ; i++) - glArrayElement( indices[i] ); + if (ctx->Array.ElementArrayBufferObj->Name) { + /* use indices in the buffer object */ + ASSERT(ctx->Array.ElementArrayBufferObj->Data); + indices = (const GLuint *) ctx->Array.ElementArrayBufferObj->Data; + } + for (i = 0 ; i < count ; i++) { + glArrayElement( indices[i] ); + } glEnd(); } } @@ -260,6 +266,12 @@ _tnl_DrawRangeElements(GLenum mode, if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(NULL, "_tnl_DrawRangeElements %d %d %d\n", start, end, count); + if (ctx->Array.ElementArrayBufferObj->Name) { + /* use indices in the buffer object */ + ASSERT(ctx->Array.ElementArrayBufferObj->Data); + indices = (GLuint *) ctx->Array.ElementArrayBufferObj->Data; + } + /* Check arguments, etc. */ if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, @@ -327,6 +339,12 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(NULL, "_tnl_DrawElements %d\n", count); + if (ctx->Array.ElementArrayBufferObj->Name) { + /* use indices in the buffer object */ + ASSERT(ctx->Array.ElementArrayBufferObj->Data); + indices = (const GLvoid *) ctx->Array.ElementArrayBufferObj->Data; + } + /* Check arguments, etc. */ if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) -- cgit v1.2.3