Merge branch 'glindex_size_fixes' of https://github.com/inolen/ioq3 into inolen-glindex_size_fixes

This commit is contained in:
SmileTheory 2013-11-08 22:19:32 -08:00
commit ae57eebf52
4 changed files with 9 additions and 18 deletions

View file

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

View file

@ -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();

View file

@ -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)
{

View file

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