From 57d882b6847128fe5f72575f61a2b2dace7ac46c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Sep 2003 16:06:49 +0000 Subject: GL_ARB_vertex_buffer_object working now, at least for non-indexed vertex arrays. --- src/mesa/main/api_arrayelt.c | 11 ++++++++--- src/mesa/main/imports.h | 10 ++++++++++ src/mesa/main/mtypes.h | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index edfa8e53cf..e4533713cd 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1,4 +1,3 @@ - /* * Mesa 3-D graphics library * Version: 5.1 @@ -346,13 +345,19 @@ void _ae_loopback_array_elt( GLint elt ) _ae_update_state( ctx ); for (ta = actx->texarrays ; ta->func ; ta++) { - ta->func( ta->unit + GL_TEXTURE0_ARB, (char *)ta->array->Ptr + elt * ta->array->StrideB ); + GLubyte *src = ta->array->BufferObj->Data + + (GLuint) ta->array->Ptr + + elt * ta->array->StrideB; + ta->func( ta->unit + GL_TEXTURE0_ARB, src); } /* Must be last */ for (aa = actx->arrays ; aa->func ; aa++) { - aa->func( (char *)aa->array->Ptr + elt * aa->array->StrideB ); + GLubyte *src = aa->array->BufferObj->Data + + (GLuint) aa->array->Ptr + + elt * aa->array->StrideB; + aa->func( src ); } } diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 532649a354..df0d6d771d 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -92,6 +92,16 @@ extern "C" { /*@}*/ +/* + * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers + * as offsets into buffer stores. Since the vertex array pointer and + * buffer store pointer are both pointers and we need to add them, we use + * this macro. + * Both pointers/offsets are expressed in bytes. + */ +#define ADD_POINTERS(A, B) ( (A) + (unsigned long) (B) ) + + /**********************************************************************/ /** \name [Pseudo] static array declaration. * diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 341a028ee6..36954675c8 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1262,7 +1262,7 @@ struct gl_buffer_object { GLenum Access; GLvoid *Pointer; /**< Only valid while buffer is mapped */ GLuint Size; /**< Size of data array in bytes */ - GLubyte *Data; /**< The storage */ + GLubyte *Data; /**< The storage */ }; -- cgit v1.2.3