From 2f7dd87d8b9e173b5f31ebe36425539dfe58c6f8 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Fri, 25 Aug 2023 14:07:25 +0200 Subject: [PATCH] fix IBO generation...oops --- BBGE/VertexBuffer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/BBGE/VertexBuffer.cpp b/BBGE/VertexBuffer.cpp index 764b07e..4d3fdb6 100644 --- a/BBGE/VertexBuffer.cpp +++ b/BBGE/VertexBuffer.cpp @@ -327,8 +327,7 @@ size_t DynamicGPUBuffer::initGridIndices_Triangles(size_t w, size_t h, bool inve // top to bottom for(size_t y = 0; y < quadsy; ++y) { - size_t i = y * w; - for(size_t x = 0; x < quadsx; ++x) + for(size_t x = 0, i = y * w; x < quadsx; ++x, ++i) { *p++ = (unsigned short)(i); // 0 *p++ = (unsigned short)(i + 1); // 1 @@ -345,8 +344,7 @@ size_t DynamicGPUBuffer::initGridIndices_Triangles(size_t w, size_t h, bool inve // bottom to top for(size_t y = quadsy; y --> 0; ) { - size_t i = y * w; - for(size_t x = 0; x < quadsx; ++x) + for(size_t x = 0, i = y * w; x < quadsx; ++x, ++i) { *p++ = (unsigned short)(i); // 0 *p++ = (unsigned short)(i + 1); // 1