summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-09-17 16:06:49 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-09-17 16:06:49 +0000
commit57d882b6847128fe5f72575f61a2b2dace7ac46c (patch)
tree0b8d61a758d856e9521c03e4c38ed72c29cdd3d1 /src/mesa/main
parent397d1e4d5750bda09e52451cfeb0a69126602a56 (diff)
GL_ARB_vertex_buffer_object working now, at least for non-indexed
vertex arrays.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/api_arrayelt.c11
-rw-r--r--src/mesa/main/imports.h10
-rw-r--r--src/mesa/main/mtypes.h2
3 files changed, 19 insertions, 4 deletions
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 */
};