Bill White wrote:
>
> The function ShowDepthBuffer disables depth and stencil testing. However,
> it doesn't include GL_ENABLE_BIT in its bitmask for glPushAttrib. This
> means that the depth and stencil testing is inadvertently disabled by
> ShowDepthBuffer. You can't see it in reflect, since the depth test is
> enabled there explicitly. If you put a ShowDepthBuffer into gears, look
> at the depth buffer, and then look at the color buffer, it displays
> incorrectly.
>
> I'm assuming that the stencil enabled state is not part of the state saved
> by GL_DEPTH_BUFFER_BIT in glPushAttrib. The spec is not clear about
> this, at least to my reading. The Stencil enabled state is saved and
> restored by glPushAttrib/glPopAttrib, with the GL_STENCIL_BUFFER_BIT.
> Several other state enabled/disabled bits are enabled both by GL_ENABLE_BIT
> and GL_MUMBLE_BIT.
>
> In any case, the fix is trivial. Either include GL_ENABLE_BIT in
> ShowDepthBuffer,
> or else restore the depth enabled state in _mesa_PopAttrib. The depth enabled
> state is stored with _mesa_PushAttrib, so restoring it is possible.
OK, I'm about to check in the fix to attrib.c. When popping the
GL_DEPTH_BUFFER_BIT state, I call ctx->Driver.Enable to restore the
depth test enable/disable state.
-Brian
|