From 272eabc73260605573b6144d63955e7de0e12282 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 21 Apr 2024 10:22:32 -0500 Subject: [PATCH] [nostalgia/core/opengl] Unbind vertex arrays when done with them --- src/nostalgia/modules/core/src/opengl/gfx.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nostalgia/modules/core/src/opengl/gfx.cpp b/src/nostalgia/modules/core/src/opengl/gfx.cpp index 2a5add06..5a220c30 100644 --- a/src/nostalgia/modules/core/src/opengl/gfx.cpp +++ b/src/nostalgia/modules/core/src/opengl/gfx.cpp @@ -239,6 +239,7 @@ static void initSpritesBufferset(Context &ctx) noexcept { glEnableVertexAttribArray(texCoordAttr); glVertexAttribPointer(texCoordAttr, 2, GL_FLOAT, GL_FALSE, SpriteVertexVboRowLength * sizeof(float), std::bit_cast(uintptr_t{4 * sizeof(float)})); + glBindVertexArray(0); } static void initBackgroundBufferset( @@ -272,6 +273,7 @@ static void initBackgroundBufferset( glVertexAttribPointer( palBankAttr, 1, GL_FLOAT, GL_FALSE, BgVertexVboRowLength * sizeof(float), std::bit_cast(uintptr_t{6 * sizeof(float)})); + glBindVertexArray(0); } static glutils::GLTexture createTexture( @@ -301,6 +303,7 @@ static void drawBackground(CBB &cbb) noexcept { } glBindTexture(GL_TEXTURE_2D, cbb.tex); glDrawElements(GL_TRIANGLES, static_cast(cbb.elements.size()), GL_UNSIGNED_INT, nullptr); + glBindVertexArray(0); } static void drawBackgrounds( @@ -354,6 +357,7 @@ static void drawSprites(Context &ctx, ox::Size const&renderSz) noexcept { // draw glBindTexture(GL_TEXTURE_2D, sb.tex); glDrawElements(GL_TRIANGLES, static_cast(sb.elements.size()), GL_UNSIGNED_INT, nullptr); + glBindVertexArray(0); } static void loadPalette(