From 6f765fbde42a4f729780aa39d2b0ed9d736dd5a8 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 17 Aug 2007 15:26:33 +0100 Subject: added vbo_use_buffer_objects() to specify that immediate mode data should be put into bufferobjects --- src/mesa/vbo/vbo_exec_draw.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/mesa/vbo/vbo_exec_draw.c') diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 86155d220d..557a43bb87 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -182,13 +182,24 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) * arrays of floats. */ for (attr = 0; attr < VERT_ATTRIB_MAX ; attr++) { - GLuint src = map[attr]; + const GLuint src = map[attr]; if (exec->vtx.attrsz[src]) { /* override the default array set above */ exec->vtx.inputs[attr] = &arrays[attr]; - arrays[attr].Ptr = (void *)data; + if (exec->vtx.bufferobj->Name) { + /* a real buffer obj: Ptr is an offset, not a pointer*/ + int offset; + assert(exec->vtx.bufferobj->Pointer); /* buf should be mapped */ + offset = (GLbyte *) data - (GLbyte *) exec->vtx.bufferobj->Pointer; + assert(offset >= 0); + arrays[attr].Ptr = (void *) offset; + } + else { + /* Ptr into ordinary app memory */ + arrays[attr].Ptr = (void *) data; + } arrays[attr].Size = exec->vtx.attrsz[src]; arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat); arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat); -- cgit v1.2.3