diff options
Diffstat (limited to 'src/renderergl2/tr_vbo.c')
-rw-r--r-- | src/renderergl2/tr_vbo.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/renderergl2/tr_vbo.c b/src/renderergl2/tr_vbo.c index 7433b5b1..44c66d01 100644 --- a/src/renderergl2/tr_vbo.c +++ b/src/renderergl2/tr_vbo.c @@ -501,7 +501,7 @@ IBO_t *R_CreateIBO(const char *name, byte * indexes, int indexesSize, v R_CreateIBO2 ============ */ -IBO_t *R_CreateIBO2(const char *name, int numTriangles, srfTriangle_t * triangles, vboUsage_t usage) +IBO_t *R_CreateIBO2(const char *name, int numIndexes, glIndex_t * inIndexes, vboUsage_t usage) { IBO_t *ibo; int i, j; @@ -510,7 +510,8 @@ IBO_t *R_CreateIBO2(const char *name, int numTriangles, srfTriangle_t * int indexesSize; int indexesCount; - srfTriangle_t *tri; + glIndex_t *tri; + glIndex_t index; int glUsage; switch (usage) @@ -528,7 +529,7 @@ IBO_t *R_CreateIBO2(const char *name, int numTriangles, srfTriangle_t * return NULL; } - if(!numTriangles) + if(!numIndexes) return NULL; if(strlen(name) >= MAX_QPATH) @@ -547,15 +548,17 @@ IBO_t *R_CreateIBO2(const char *name, int numTriangles, srfTriangle_t * Q_strncpyz(ibo->name, name, sizeof(ibo->name)); - indexesSize = numTriangles * 3 * sizeof(glIndex_t); + indexesSize = numIndexes * sizeof(glIndex_t); indexes = ri.Hunk_AllocateTempMemory(indexesSize); indexesCount = 0; - for(i = 0, tri = triangles; i < numTriangles; i++, tri++) + for(i = 0, tri = inIndexes; i < numIndexes; i += 3, tri += 3) { for(j = 0; j < 3; j++) { - indexes[indexesCount++] = tri->indexes[j]; + index = tri[j]; + memcpy(indexes + indexesOfs, &index, sizeof(glIndex_t)); + indexesOfs += sizeof(glIndex_t); } } |