summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_array_api.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-12-04 03:16:27 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-12-04 03:16:27 +0000
commit03e29a5f77c13b7b888bd8443cb2752850e47d6a (patch)
tree277c83ddb69e36a166c63c1988988791f95435b3 /src/mesa/tnl/t_array_api.c
parent6ff60049a4ab1abac46e5c8e317b0dd842e088c2 (diff)
Fix some problems with glDrawElements and vertex buffer objects.
Diffstat (limited to 'src/mesa/tnl/t_array_api.c')
-rw-r--r--src/mesa/tnl/t_array_api.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c
index 2b10a9d1c2..802133dc2d 100644
--- a/src/mesa/tnl/t_array_api.c
+++ b/src/mesa/tnl/t_array_api.c
@@ -309,7 +309,10 @@ _tnl_DrawRangeElements(GLenum mode,
"DrawRangeElements with empty vertex elements buffer!");
return;
}
- indices = (GLvoid *) ctx->Array.ElementArrayBufferObj->Data;
+ /* actual address is the sum of pointers */
+ indices = (const GLvoid *)
+ ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data,
+ (const GLubyte *) indices);
}
/* Check arguments, etc.
@@ -376,20 +379,17 @@ _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 */
- if (!ctx->Array.ElementArrayBufferObj->Data) {
- _mesa_warning(ctx, "DrawElements with empty vertex elements buffer!");
- return;
- }
- indices = (const GLvoid *) ctx->Array.ElementArrayBufferObj->Data;
- }
-
- /* Check arguments, etc.
- */
+ /* Check arguments, etc. */
if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
return;
+ if (ctx->Array.ElementArrayBufferObj->Name) {
+ /* actual address is the sum of pointers */
+ indices = (const GLvoid *)
+ ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data,
+ (const GLubyte *) indices);
+ }
+
ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT,
count, type, indices );