diff --git a/code/renderergl2/tr_shade.c b/code/renderergl2/tr_shade.c index 03916819..608de9d8 100644 --- a/code/renderergl2/tr_shade.c +++ b/code/renderergl2/tr_shade.c @@ -44,9 +44,9 @@ R_DrawElements void R_DrawElementsVBO( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex, glIndex_t maxIndex ) { if (glRefConfig.drawRangeElements) - qglDrawRangeElementsEXT(GL_TRIANGLES, minIndex, maxIndex, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(GL_INDEX_TYPE))); + qglDrawRangeElementsEXT(GL_TRIANGLES, minIndex, maxIndex, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(glIndex_t))); else - qglDrawElements(GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(GL_INDEX_TYPE))); + qglDrawElements(GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(glIndex_t))); } diff --git a/code/renderergl2/tr_sky.c b/code/renderergl2/tr_sky.c index 162b9e5e..13eb4042 100644 --- a/code/renderergl2/tr_sky.c +++ b/code/renderergl2/tr_sky.c @@ -468,7 +468,7 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max R_DrawElementsVBO(tess.numIndexes - tess.firstIndex, tess.firstIndex, tess.minIndex, tess.maxIndex); - //qglDrawElements(GL_TRIANGLES, tess.numIndexes - tess.firstIndex, GL_INDEX_TYPE, BUFFER_OFFSET(tess.firstIndex * sizeof(GL_INDEX_TYPE))); + //qglDrawElements(GL_TRIANGLES, tess.numIndexes - tess.firstIndex, GL_INDEX_TYPE, BUFFER_OFFSET(tess.firstIndex * sizeof(glIndex_t))); //R_BindNullVBO(); //R_BindNullIBO(); diff --git a/code/renderergl2/tr_surface.c b/code/renderergl2/tr_surface.c index fd9fb661..46f1c2fe 100644 --- a/code/renderergl2/tr_surface.c +++ b/code/renderergl2/tr_surface.c @@ -435,8 +435,8 @@ static qboolean RB_SurfaceVbo(VBO_t *vbo, IBO_t *ibo, int numVerts, int numIndex // merge this into any existing multidraw primitives mergeForward = -1; mergeBack = -1; - firstIndexOffset = BUFFER_OFFSET(firstIndex * sizeof(GL_INDEX_TYPE)); - lastIndexOffset = BUFFER_OFFSET((firstIndex + numIndexes) * sizeof(GL_INDEX_TYPE)); + firstIndexOffset = BUFFER_OFFSET(firstIndex * sizeof(glIndex_t)); + lastIndexOffset = BUFFER_OFFSET((firstIndex + numIndexes) * sizeof(glIndex_t)); if (r_mergeMultidraws->integer) { diff --git a/code/renderergl2/tr_vbo.c b/code/renderergl2/tr_vbo.c index 44a461a6..a75432f4 100644 --- a/code/renderergl2/tr_vbo.c +++ b/code/renderergl2/tr_vbo.c @@ -504,14 +504,11 @@ R_CreateIBO2 IBO_t *R_CreateIBO2(const char *name, int numIndexes, glIndex_t * inIndexes, vboUsage_t usage) { IBO_t *ibo; - int i, j; + int i; - byte *indexes; + glIndex_t *indexes; int indexesSize; - int indexesOfs; - glIndex_t *tri; - glIndex_t index; int glUsage; switch (usage) @@ -550,16 +547,10 @@ IBO_t *R_CreateIBO2(const char *name, int numIndexes, glIndex_t * inInd indexesSize = numIndexes * sizeof(glIndex_t); indexes = ri.Hunk_AllocateTempMemory(indexesSize); - indexesOfs = 0; - for(i = 0, tri = inIndexes; i < numIndexes; i += 3, tri += 3) + for(i = 0; i < numIndexes; i++) { - for(j = 0; j < 3; j++) - { - index = tri[j]; - memcpy(indexes + indexesOfs, &index, sizeof(glIndex_t)); - indexesOfs += sizeof(glIndex_t); - } + indexes[i] = inIndexes[i]; } ibo->indexesSize = indexesSize;