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.
2
2
3
3
#include " presenter.h"
4
4
@@ -309,12 +309,15 @@ void Presenter::init_final_render_pass() {
309
309
});
310
310
}
311
311
312
- void Presenter::enable_stencil_for_gui_mask () {
312
+ void Presenter::init_stencil_test () {
313
313
glEnable (GL_STENCIL_TEST);
314
+ glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
314
315
glClear (GL_STENCIL_BUFFER_BIT);
316
+ }
317
+
318
+ void Presenter::enable_stencil_for_gui_mask () {
315
319
// Replace stencil value with 1 when depth test passes
316
320
glStencilFunc (GL_ALWAYS, 1 , 0xFF );
317
- glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
318
321
glStencilMask (0xFF );
319
322
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
320
323
}
@@ -338,6 +341,8 @@ void Presenter::render() {
338
341
this ->world_renderer ->update ();
339
342
this ->hud_renderer ->update ();
340
343
344
+ this ->init_stencil_test ();
345
+
341
346
// First Pass: Render GUI to stencil buffer
342
347
this ->enable_stencil_for_gui_mask ();
343
348
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.
2
2
3
3
#pragma once
4
4
@@ -142,6 +142,7 @@ class Presenter {
142
142
143
143
// void init_audio();
144
144
145
+ void init_stencil_test ();
145
146
void enable_stencil_for_gui_mask ();
146
147
void enable_stencil_for_world ();
147
148
void disable_stencil ();
You can’t perform that action at this time.
0 commit comments