diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-12-12 19:59:06 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-12-12 19:59:06 +0300 |
commit | d6beaad01cdc0849d4bee840a631ae9d9ef2be46 (patch) | |
tree | 21b6df7a8cc547df55ea07f83ace2770cc4cdf5b | |
parent | 28a0e1dae5f347edc05b0ac1a5af4de5927e0bbf (diff) |
Fix T42875 GLSL display not correct in vertex array mode.
GLSL used a global variable to store the enabled vertex attributes which
were not set for vertex arrays after the VBO refactor.
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 8ac629d0ded..2ac2ca3bf05 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1293,6 +1293,7 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda int i; int elementsize; intptr_t offset = 0; + char *basep; for (i = 0; i < MAX_GPU_ATTRIB_DATA; i++) { if (attribData[i].index != -1) { @@ -1305,26 +1306,24 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda if (buffer->use_vbo) { glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id); - for (i = 0; i < numdata; i++) { - glEnableVertexAttribArrayARB(data[i].index); - glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type, - GL_FALSE, elementsize, (void *)offset); - offset += data[i].size * GPU_typesize(data[i].type); - - attribData[i].index = data[i].index; - attribData[i].size = data[i].size; - attribData[i].type = data[i].type; - } - attribData[numdata].index = -1; + basep = NULL; } else { - for (i = 0; i < numdata; i++) { - glEnableVertexAttribArrayARB(data[i].index); - glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type, - GL_FALSE, elementsize, (char *)buffer->pointer + offset); - offset += data[i].size * GPU_typesize(data[i].type); - } + basep = buffer->pointer; } + + for (i = 0; i < numdata; i++) { + glEnableVertexAttribArrayARB(data[i].index); + glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type, + GL_FALSE, elementsize, (void *)(basep + offset)); + offset += data[i].size * GPU_typesize(data[i].type); + + attribData[i].index = data[i].index; + attribData[i].size = data[i].size; + attribData[i].type = data[i].type; + } + + attribData[numdata].index = -1; } |