From 2a20eb928704fd7f4f99237099be5ef639d65a47 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 16 Sep 2019 18:12:16 +0200 Subject: [PATCH] - deleted vertex buffer drawing and used immediate mode instead. This served no benefit and made cleanup harder than necessary. --- source/build/src/polymost.cpp | 92 +++++++++-------------------------- 1 file changed, 24 insertions(+), 68 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 14ded53e7..3313dc8e8 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -3053,27 +3053,8 @@ do if (nn < 3) continue; - if (nn+drawpolyVertsOffset > (drawpolyVertsSubBufferIndex+1)*drawpolyVertsBufferLength) - { - if (persistentStreamBuffer) - { - // lock this sub buffer - polymost_lockSubBuffer(drawpolyVertsSubBufferIndex); - drawpolyVertsSubBufferIndex = (drawpolyVertsSubBufferIndex+1)%3; - drawpolyVertsOffset = drawpolyVertsSubBufferIndex*drawpolyVertsBufferLength; - // wait for the next sub buffer to become available before writing to it - // our buffer size should be long enough that no waiting is ever necessary - polymost_waitForSubBuffer(drawpolyVertsSubBufferIndex); - } - else - { - glBufferData(GL_ARRAY_BUFFER, sizeof(float)*5*drawpolyVertsBufferLength, NULL, GL_STREAM_DRAW); - drawpolyVertsOffset = 0; - } - } - vec2f_t const invtsiz2 = { 1.f / tsiz2.x, 1.f / tsiz2.y }; - uint32_t off = persistentStreamBuffer ? drawpolyVertsOffset : 0; + glBegin(GL_TRIANGLE_FAN); for (i = 0; i (drawpolyVertsSubBufferIndex+1)*drawpolyVertsBufferLength) - { - if (persistentStreamBuffer) - { - // lock this sub buffer - polymost_lockSubBuffer(drawpolyVertsSubBufferIndex); - drawpolyVertsSubBufferIndex = (drawpolyVertsSubBufferIndex+1)%3; - drawpolyVertsOffset = drawpolyVertsSubBufferIndex*drawpolyVertsBufferLength; - // wait for the next sub buffer to become available before writing to it - // our buffer size should be long enough that no waiting is ever necessary - polymost_waitForSubBuffer(drawpolyVertsSubBufferIndex); - } - else - { - glBufferData(GL_ARRAY_BUFFER, sizeof(float)*5*drawpolyVertsBufferLength, NULL, GL_STREAM_DRAW); - drawpolyVertsOffset = 0; - } - } - vec2f_t const scale = { 1.f / tsiz2.x * hacksc.x, 1.f / tsiz2.y * hacksc.y }; - uint32_t off = persistentStreamBuffer ? drawpolyVertsOffset : 0; - for (bssize_t i = 0; i < npoints; ++i) + glBegin(GL_TRIANGLE_FAN); + for (bssize_t i = 0; i < npoints; ++i) { float const r = 1.f / dd[i]; + //update texcoords + glTexCoord2f( + uu[i] * r * scale.x, + vv[i] * r * scale.y); + //update verts - drawpolyVerts[(off+i)*5] = (px[i] - ghalfx) * r * grhalfxdown10x; - drawpolyVerts[(off+i)*5+1] = (ghoriz - py[i]) * r * grhalfxdown10; - drawpolyVerts[(off+i)*5+2] = r * (1.f / 1024.f); + glVertex3f( + (px[i] - ghalfx) * r * grhalfxdown10x, + (ghoriz - py[i]) * r * grhalfxdown10, + r * (1.f / 1024.f)); - //update texcoords - drawpolyVerts[(off+i)*5+3] = uu[i] * r * scale.x; - drawpolyVerts[(off+i)*5+4] = vv[i] * r * scale.y; } - - if (!persistentStreamBuffer) - { - glBufferSubData(GL_ARRAY_BUFFER, drawpolyVertsOffset*sizeof(float)*5, npoints*sizeof(float)*5, drawpolyVerts); - } - glDrawArrays(GL_TRIANGLE_FAN, drawpolyVertsOffset, npoints); - drawpolyVertsOffset += npoints; - } + glEnd(); + } #ifdef USE_GLEXT