File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1- // Copyright 2019-2024 the openage authors. See copying.md for legal info.
1+ // Copyright 2019-2025 the openage authors. See copying.md for legal info.
22
33#include " presenter.h"
44
@@ -309,12 +309,15 @@ void Presenter::init_final_render_pass() {
309309 });
310310}
311311
312- void Presenter::enable_stencil_for_gui_mask () {
312+ void Presenter::init_stencil_test () {
313313 glEnable (GL_STENCIL_TEST);
314+ glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
314315 glClear (GL_STENCIL_BUFFER_BIT);
316+ }
317+
318+ void Presenter::enable_stencil_for_gui_mask () {
315319 // Replace stencil value with 1 when depth test passes
316320 glStencilFunc (GL_ALWAYS, 1 , 0xFF );
317- glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
318321 glStencilMask (0xFF );
319322 glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
320323}
@@ -338,6 +341,8 @@ void Presenter::render() {
338341 this ->world_renderer ->update ();
339342 this ->hud_renderer ->update ();
340343
344+ this ->init_stencil_test ();
345+
341346 // First Pass: Render GUI to stencil buffer
342347 this ->enable_stencil_for_gui_mask ();
343348 this ->gui ->render ();
Original file line number Diff line number Diff line change 1- // Copyright 2019-2024 the openage authors. See copying.md for legal info.
1+ // Copyright 2019-2025 the openage authors. See copying.md for legal info.
22
33#pragma once
44
@@ -142,6 +142,7 @@ class Presenter {
142142
143143 // void init_audio();
144144
145+ void init_stencil_test ();
145146 void enable_stencil_for_gui_mask ();
146147 void enable_stencil_for_world ();
147148 void disable_stencil ();
You can’t perform that action at this time.
0 commit comments