[nostalgia/core/opengl] Unbind vertex arrays when done with them

This commit is contained in:
Gary Talent 2024-04-21 10:22:32 -05:00
parent a02566697a
commit 272eabc732

View File

@ -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<void*>(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<void*>(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<GLsizei>(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<GLsizei>(sb.elements.size()), GL_UNSIGNED_INT, nullptr);
glBindVertexArray(0);
}
static void loadPalette(