mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 14:31:50 +00:00
fix modelviewer background is not transparent
This commit is contained in:
parent
eb2afe822d
commit
e57e6a5cbe
1 changed files with 8 additions and 1 deletions
|
|
@ -120,7 +120,7 @@ void ModelViewer::draw(const DrawContext& pctx, const Assets& assets) {
|
||||||
if (size.x <= 0 || size.y <= 0) {
|
if (size.x <= 0 || size.y <= 0) {
|
||||||
return;
|
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);
|
fbo->resize(size.x, size.y);
|
||||||
{
|
{
|
||||||
|
|
@ -130,7 +130,14 @@ void ModelViewer::draw(const DrawContext& pctx, const Assets& assets) {
|
||||||
ctx.setViewport({size.x, size.y});
|
ctx.setViewport({size.x, size.y});
|
||||||
ctx.setDepthTest(true);
|
ctx.setDepthTest(true);
|
||||||
ctx.setCullFace(true);
|
ctx.setCullFace(true);
|
||||||
|
// transparent background, the screen clear color is restored below
|
||||||
|
GLfloat clearColor[4];
|
||||||
|
glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor);
|
||||||
|
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
display::clear();
|
display::clear();
|
||||||
|
glClearColor(
|
||||||
|
clearColor[0], clearColor[1], clearColor[2], clearColor[3]
|
||||||
|
);
|
||||||
|
|
||||||
auto& ui3dShader = assets.require<Shader>("ui3d");
|
auto& ui3dShader = assets.require<Shader>("ui3d");
|
||||||
ui3dShader.use();
|
ui3dShader.use();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue