Skip to content

Commit 42fd52f

Browse files
committed
OpenGL2: Fix OpenArena speed powerup drawing solid black
OpenArena's speed powerup model uses rgbGen vertex but MD3 models don't provide a vertex color. The opengl1 renderer uses whatever previous vertex color was set (and changed based on surface draw order). There isn't a simple way to emulate that in the OpenGL2 renderer so use white vertex color.
1 parent 9e596b1 commit 42fd52f

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

code/renderercommon/qgl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
188188
GLE(void, UniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) \
189189
GLE(void, ValidateProgram, GLuint program) \
190190
GLE(void, VertexAttribPointer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) \
191+
GLE(void, VertexAttrib4fv, GLuint index, const GLfloat *values) \
191192

192193
// GL_NVX_gpu_memory_info
193194
#ifndef GL_NVX_gpu_memory_info

code/renderergl2/tr_vbo.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ void Vao_SetVertexPointers(vao_t *vao)
9090

9191
if (!glRefConfig.vertexArrayObject || vao == tess.vao)
9292
glState.vertexAttribsEnabled &= ~attribBit;
93+
94+
// set vertex color to white for models without vertex colors
95+
if (attribIndex == ATTR_INDEX_COLOR) {
96+
float white[4] = { 1, 1, 1, 1 };
97+
qglVertexAttrib4fv(attribIndex, white);
98+
}
9399
}
94100
}
95101
}

0 commit comments

Comments
 (0)