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.
This commit is contained in:
Antonis Ryakiotakis 2014-12-12 17:59:06 +01:00
parent 28a0e1dae5
commit d6beaad01c
Notes: blender-bot 2024-01-31 11:35:08 +01:00
Referenced by issue #42989, Viewing normal map in viewport causes weird colours in UI
Referenced by issue #42889, Error in display units.
Referenced by issue #42875, 2.73 Testbuild 1 is crashes or draws broken UI when using GLSL draw mode with normal mapping
1 changed files with 16 additions and 17 deletions

View File

@ -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;
}