Merge pull request #1033 from ostermine/fix/modelviewer-transparent-bg

fix modelviewer background is not transparent
This commit is contained in:
MihailRis 2026-10-11 23:12:21 +03:00 • committed by GitHub
commit f8119326ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -120,7 +120,7 @@ void ModelViewer::draw(const DrawContext& pctx, const Assets& assets) {
if (size.x <= 0 || size.y <= 0) {
return;
}
fbo = std::make_unique<Framebuffer>(size.x, size.y);
fbo = std::make_unique<Framebuffer>(size.x, size.y, true);
}
fbo->resize(size.x, size.y);
{
@ -130,7 +130,13 @@ void ModelViewer::draw(const DrawContext& pctx, const Assets& assets) {
ctx.setViewport({size.x, size.y});
ctx.setDepthTest(true);
ctx.setCullFace(true);
GLfloat clearColor[4];
glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
display::clear();
glClearColor(
clearColor[0], clearColor[1], clearColor[2], clearColor[3]
);
auto& ui3dShader = assets.require<Shader>("ui3d");
ui3dShader.use();