OpenGL2: Fix world VAO cache drawing when glIndex_t is unsigned short
OpenGL ES is only required to support unsigned short for element buffer values. R_DrawElements() firstIndex argument was glIndex_t which caused element indexes to wrap around to 0 when glIndex_t is an unsigned short. (glIndex_t is an index into the vertexes buffer, not element buffer.) Change it to 'int' like tess.firstIndex which is passed to R_DrawElements(). World VAO cache buffer size allowed storing more vertexes than unsigned short glIndex_t could reference. This resulted in the vertex indexes in the element buffer wrapping around to 0.
This commit is contained in:
1 parent
658165cfbb
commit
14cc4cc6cb
3 files changed
+7
-2
No files matched your search
@@ -38,7 +38,7 @@ R_DrawElements
|
||||
==================
|
||||
*/
|
||||
|
||||
void R_DrawElements( int numIndexes, glIndex_t firstIndex)
|
||||
void R_DrawElements( int numIndexes, int firstIndex )
|
||||
{
|
||||
qglDrawElements(GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(glIndex_t)));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user