Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Depth Test to GL State Backup - GL3 Renderer #629

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Backends/RmlUi_Renderer_GL3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ void RenderInterface_GL3::BeginFrame()
glstate_backup.enable_blend = glIsEnabled(GL_BLEND);
glstate_backup.enable_stencil_test = glIsEnabled(GL_STENCIL_TEST);
glstate_backup.enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
glstate_backup.enable_depth_test = glIsEnabled(GL_DEPTH_TEST);

glGetIntegerv(GL_VIEWPORT, glstate_backup.viewport);
glGetIntegerv(GL_SCISSOR_BOX, glstate_backup.scissor);
Expand Down Expand Up @@ -879,6 +880,8 @@ void RenderInterface_GL3::BeginFrame()
glStencilMask(GLuint(-1));
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

glDisable(GL_DEPTH_TEST);

SetTransform(nullptr);

render_layers.BeginFrame(viewport_width, viewport_height);
Expand Down Expand Up @@ -936,6 +939,11 @@ void RenderInterface_GL3::EndFrame()
else
glDisable(GL_SCISSOR_TEST);

if(glstate_backup.enable_depth_test)
glEnable(GL_DEPTH_TEST);
else
glDisable(GL_DEPTH_TEST);

glViewport(glstate_backup.viewport[0], glstate_backup.viewport[1], glstate_backup.viewport[2], glstate_backup.viewport[3]);
glScissor(glstate_backup.scissor[0], glstate_backup.scissor[1], glstate_backup.scissor[2], glstate_backup.scissor[3]);

Expand Down
1 change: 1 addition & 0 deletions Backends/RmlUi_Renderer_GL3.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class RenderInterface_GL3 : public Rml::RenderInterface {
bool enable_blend;
bool enable_stencil_test;
bool enable_scissor_test;
bool enable_depth_test;

int viewport[4];
int scissor[4];
Expand Down