[nostalgia/core/opengl] Cleanup

This commit is contained in:
Gary Talent 2023-06-18 17:58:01 -05:00
parent 0f797a17d5
commit de45e7a075

View File

@ -346,7 +346,8 @@ ox::Error initGfx(
const auto spriteFshad = ox::sfmt(renderer::spritefshadTmpl, glutils::GlslVersion);
auto &gctx = static_cast<GlContext&>(*ctx);
oxReturnError(glutils::buildShaderProgram(bgVshad.c_str(), bgFshad.c_str()).moveTo(&gctx.bgShader));
oxReturnError(glutils::buildShaderProgram(spriteVshad.c_str(), spriteFshad.c_str()).moveTo(&gctx.spriteShader));
oxReturnError(
glutils::buildShaderProgram(spriteVshad.c_str(), spriteFshad.c_str()).moveTo(&gctx.spriteShader));
for (auto &bg : gctx.cbbs) {
initBackgroundBufferset(ctx, gctx.bgShader, &bg);
}
@ -435,6 +436,7 @@ void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept {
setTile(ctx, 0, static_cast<int>(col + i), row, static_cast<uint8_t>(charMap[static_cast<uint8_t>(str[i])]));
}
}
void setBgCbb(Context *ctx, unsigned bgIdx, unsigned cbbIdx) noexcept {
auto &gctx = static_cast<GlContext&>(*ctx);
auto &bg = gctx.backgrounds[bgIdx];
@ -577,9 +579,7 @@ namespace gl {
void drawMainView(core::Context *ctx, ox::Size const&renderSz) noexcept {
glViewport(0, 0, renderSz.width, renderSz.height);
// clear screen
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glutils::clearScreen();
auto &gctx = static_cast<GlContext&>(*ctx);
renderer::drawBackgrounds(&gctx, renderSz);
if (gctx.spriteBlocks.tex) {