My call to glClear (to clear the depth buffer, to place the

background image behind everything) seems to do bad things for
whatever reason. So get rid of that, and instead to a glDepthRange
to force that at the back.

[git-p4: depot-paths = "//depot/solvespace/": change = 2079]
This commit is contained in:
Jonathan Westhues 2009-11-20 00:43:10 -08:00
parent 4cfe7eea64
commit b352ca785c

View File

@ -479,6 +479,8 @@ void GraphicsWindow::Paint(int w, int h) {
ForceTextWindowShown(); ForceTextWindowShown();
} }
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glClearDepth(1.0);
glClear(GL_DEPTH_BUFFER_BIT);
if(SS.bgImage.fromFile) { if(SS.bgImage.fromFile) {
// If a background image is loaded, then we draw it now as a texture. // If a background image is loaded, then we draw it now as a texture.
@ -508,6 +510,9 @@ void GraphicsWindow::Paint(int w, int h) {
origin.z = (offset.ScaledBy(-1)).Dot(n); origin.z = (offset.ScaledBy(-1)).Dot(n);
origin = origin.ScaleOutOfCsys(projRight, projUp, n); origin = origin.ScaleOutOfCsys(projRight, projUp, n);
// Place the background at the very back of the Z order, though, by
// mucking with the depth range.
glDepthRange(1, 1);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glTexCoord2d(0, 0); glTexCoord2d(0, 0);
@ -525,11 +530,7 @@ void GraphicsWindow::Paint(int w, int h) {
glEnd(); glEnd();
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
glxDepthRangeOffset(0);
// Now clear the depth; so the background color and image are both at
// the very back of everything.
glClearDepth(1.0);
glClear(GL_DEPTH_BUFFER_BIT);
// Nasty case when we're reloading the imported files; could be that // Nasty case when we're reloading the imported files; could be that
// we get an error, so a dialog pops up, and a message loop starts, and // we get an error, so a dialog pops up, and a message loop starts, and