Route default clear through renderer GL

This commit is contained in:
2026-06-03 05:50:36 +02:00
parent 103fe4fb12
commit 2a030318b1
6 changed files with 113 additions and 10 deletions

View File

@@ -55,6 +55,16 @@ void set_opengl_blend_equation_separate(std::uint32_t color_equation, std::uint3
glBlendEquationSeparate(static_cast<GLenum>(color_equation), static_cast<GLenum>(alpha_equation));
}
void clear_opengl_color(float r, float g, float b, float a) noexcept
{
glClearColor(r, g, b, a);
}
void clear_opengl_buffers(std::uint32_t mask) noexcept
{
glClear(static_cast<GLbitfield>(mask));
}
[[nodiscard]] GLint rgba8_internal_format() noexcept
{
return static_cast<GLint>(pp::renderer::gl::rgba8_internal_format());
@@ -85,11 +95,6 @@ void set_opengl_blend_equation_separate(std::uint32_t color_equation, std::uint3
return static_cast<GLuint>(pp::renderer::gl::default_framebuffer_id());
}
[[nodiscard]] GLbitfield framebuffer_color_buffer_mask() noexcept
{
return static_cast<GLbitfield>(pp::renderer::gl::framebuffer_color_buffer_mask());
}
}
std::thread App::render_thread;
std::thread::id App::render_thread_id;
@@ -208,8 +213,13 @@ bool App::request_close()
void App::clear()
{
glClearColor(.1f, .1f, .1f, 1.f);
glClear(framebuffer_color_buffer_mask());
const auto status = pp::renderer::gl::clear_panopainter_default_target(
pp::renderer::gl::OpenGlClearDispatch {
.clear_color = clear_opengl_color,
.clear = clear_opengl_buffers,
});
if (!status.ok())
LOG("OpenGL clear failed: %s", status.message);
}
void App::initAssets()