-
Does Depth Buffer Allow Writing Into When Disabling Depth Test
It seems that it would NOT allow writing depth buffer when just disable depth testing. I use the following sentences:
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
Can anybody tell me the truth?
-
Senior Member
OpenGL Pro
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
Use glDepthFunc(GL_ALWAYS)
It seems that disabling teh depth test will also disable the depth updating in the z-buffer
-
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
What do you mean by using glDepthFunc(GL_ALWAYS)?
It seems cannot make depth buffer writable when disabling depth test and using glDepthFunc(GL_ALWAYS).
-
Senior Member
OpenGL Guru
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
You need to keep depth test enabled, because that's what GL_ALWAYS is; a depth test function.
Disabling depth test completely disables everything related to the depth buffer. That's not what you want, you want the depth buffer writes to happen so you must have it enabled.
-
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
Is it the same for other buffers, such as stencil buffer ?
-
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
I mean that, when you call glDisable(GL_STENCIL_TEST), everthing stencil-buffer-related will be disabled?
-
Advanced Member
Frequent Contributor
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
Correct.
This is all spelled out very clearly in the specification.
-
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
-
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
I find it
, thanks again, I think I should refer to it more frequently later on:
{
4.1.6 Depth Buffer Test
The depth buffer test discards the incoming fragment if a depth comparison fails.The comparison is enabled or disabled with the generic Enable and Disable commands using the symbolic constant DEPTH TEST.
When disabled, the depth comparison and subsequent possible updates to the depth buffer value are bypassed and the fragment is passed to the next operation.
}
-
Advanced Member
Frequent Contributor
Re: Does Depth Buffer Allow Writing Into When Disabling Depth Test
Ok recap time, there is a lot of confusion in this thread, so here is exactly how it is.
glDepthFunc(.....); sets the test to be made against the depthbuffer, normally this should be GL_LEQUAL, GL_ALWAYS is not a good one since it will always pass, even if the fragment is behind previous written depth value.
glDisable(GL_DEPTH_TEST); and glEnable(GL_DEPTH_TEST); controls the discarding the color part of the current fragment, based on the above test.
glDepthMask(....); same as above but for the depth part of the fragment.
(It should really be glEnable(GL_DEPTH_WRITE), but i guess whats done is done.)
So to answer the original question, yes it does.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules