mirror of
https://github.com/UberGames/ioef.git
synced 2025-01-31 13:00:46 +00:00
Misc fixes to IBO code to correctly use sizeof(glIndex_t)
This commit is contained in:
parent
d9485b696e
commit
b0f0376a4f
4 changed files with 10 additions and 13 deletions
|
@ -44,9 +44,9 @@ R_DrawElements
|
||||||
void R_DrawElementsVBO( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex, glIndex_t maxIndex )
|
void R_DrawElementsVBO( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex, glIndex_t maxIndex )
|
||||||
{
|
{
|
||||||
if (glRefConfig.drawRangeElements)
|
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
|
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)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
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_BindNullVBO();
|
||||||
//R_BindNullIBO();
|
//R_BindNullIBO();
|
||||||
|
|
|
@ -437,8 +437,8 @@ static qboolean RB_SurfaceVbo(VBO_t *vbo, IBO_t *ibo, int numVerts, int numIndex
|
||||||
// merge this into any existing multidraw primitives
|
// merge this into any existing multidraw primitives
|
||||||
mergeForward = -1;
|
mergeForward = -1;
|
||||||
mergeBack = -1;
|
mergeBack = -1;
|
||||||
firstIndexOffset = BUFFER_OFFSET(firstIndex * sizeof(GL_INDEX_TYPE));
|
firstIndexOffset = BUFFER_OFFSET(firstIndex * sizeof(glIndex_t));
|
||||||
lastIndexOffset = BUFFER_OFFSET((firstIndex + numIndexes) * sizeof(GL_INDEX_TYPE));
|
lastIndexOffset = BUFFER_OFFSET((firstIndex + numIndexes) * sizeof(glIndex_t));
|
||||||
|
|
||||||
if (r_mergeMultidraws->integer)
|
if (r_mergeMultidraws->integer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -506,12 +506,11 @@ IBO_t *R_CreateIBO2(const char *name, int numTriangles, srfTriangle_t *
|
||||||
IBO_t *ibo;
|
IBO_t *ibo;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
byte *indexes;
|
glIndex_t *indexes;
|
||||||
int indexesSize;
|
int indexesSize;
|
||||||
int indexesOfs;
|
int indexesCount;
|
||||||
|
|
||||||
srfTriangle_t *tri;
|
srfTriangle_t *tri;
|
||||||
glIndex_t index;
|
|
||||||
int glUsage;
|
int glUsage;
|
||||||
|
|
||||||
switch (usage)
|
switch (usage)
|
||||||
|
@ -548,17 +547,15 @@ IBO_t *R_CreateIBO2(const char *name, int numTriangles, srfTriangle_t *
|
||||||
|
|
||||||
Q_strncpyz(ibo->name, name, sizeof(ibo->name));
|
Q_strncpyz(ibo->name, name, sizeof(ibo->name));
|
||||||
|
|
||||||
indexesSize = numTriangles * 3 * sizeof(int);
|
indexesSize = numTriangles * 3 * sizeof(glIndex_t);
|
||||||
indexes = ri.Hunk_AllocateTempMemory(indexesSize);
|
indexes = ri.Hunk_AllocateTempMemory(indexesSize);
|
||||||
indexesOfs = 0;
|
indexesCount = 0;
|
||||||
|
|
||||||
for(i = 0, tri = triangles; i < numTriangles; i++, tri++)
|
for(i = 0, tri = triangles; i < numTriangles; i++, tri++)
|
||||||
{
|
{
|
||||||
for(j = 0; j < 3; j++)
|
for(j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
index = tri->indexes[j];
|
indexes[indexesCount++] = tri->indexes[j];
|
||||||
memcpy(indexes + indexesOfs, &index, sizeof(glIndex_t));
|
|
||||||
indexesOfs += sizeof(glIndex_t);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue