← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/disable_gl_depth into lp:widelands

 

SirVer has proposed merging lp:~widelands-dev/widelands/disable_gl_depth into lp:widelands.

Commit message:
Disable GL_DEPTH testing for most operations and only enable it temporarily when everything is drawn onto the screen. 

Historically, WIdelands always implicitly defined the z-ordering by drawing stuff in the right order. With the render queue this has been changed: items are batched together and open gl takes care of the correct draw order. As a side effect, we enabled DEPTH testing also for offscreen surfaces - but there we are still working on the old assumption that order defines Z layer. Also, we never clear the Z buffer before starting to draw. Maybe this is causing the z-layering issues we see on Windows.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1535732 in widelands: "Most texts not displayed correctly"
  https://bugs.launchpad.net/widelands/+bug/1535732

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/disable_gl_depth/+merge/283353

See commit message.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/disable_gl_depth into lp:widelands.
=== modified file 'src/graphic/graphic.cc'
--- src/graphic/graphic.cc	2016-01-16 15:19:32 +0000
+++ src/graphic/graphic.cc	2016-01-20 20:10:57 +0000
@@ -120,7 +120,7 @@
 
 	glDrawBuffer(GL_BACK);
 
-	glEnable(GL_DEPTH_TEST);
+	glDisable(GL_DEPTH_TEST);
 	glDepthFunc(GL_LEQUAL);
 
 	glEnable(GL_BLEND);

=== modified file 'src/graphic/render_queue.cc'
--- src/graphic/render_queue.cc	2016-01-13 07:27:55 +0000
+++ src/graphic/render_queue.cc	2016-01-20 20:10:57 +0000
@@ -196,6 +196,7 @@
 	Gl::State::instance().bind_framebuffer(0, 0);
 	glViewport(0, 0, screen_width, screen_height);
 
+	glEnable(GL_DEPTH_TEST);
 	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
 
 	glDisable(GL_BLEND);
@@ -212,6 +213,7 @@
 	blended_items_.clear();
 
 	glDepthMask(GL_TRUE);
+	glDisable(GL_DEPTH_TEST);
 	next_z_ = 1;
 }
 


Follow ups