Page 1 of 1

set the depth buffer's clear value

Posted: Mon Oct 05, 2009 10:18 pm
by cyrfer
Hi,
I'm trying to do some sanity testing while writing shaders. It would be great if I could specify the clear value of the depth buffer so I can check it in my shader. In OpenGL, this is done with 'glClearDepth' as far as I can tell, not sure about D3D. It seems like the right place would be in the Viewport class. Maybe the interface would look like this?

Code: Select all

@param value the value to initialize all pixels in the depth buffer with
void Viewport::setDepthClear(double value);
Thanks :)

Re: set the depth buffer's clear value

Posted: Tue Oct 06, 2009 1:18 am
by Kojack
If you don't mind clearing manually rather than using the auto clear, you can call Viewport::clear which takes a colour, depth and stencil value to clear the buffer with.

Re: set the depth buffer's clear value

Posted: Tue Oct 06, 2009 11:36 am
by haffax
I see, Viewport::clear is new in SVN trunk. I added it to the changelog in the CthugaNotes in the wiki.

Anyway, having a getter/setter for a depth value is still nice and not hard to do and doesn't need any adjustments design wise.
Cryfer, if you still need it, best implement it yourself and submit a patch.

Re: set the depth buffer's clear value

Posted: Thu Mar 04, 2010 5:14 am
by dark_sylinc
haffax wrote:Anyway, having a getter/setter for a depth value is still nice and not hard to do and doesn't need any adjustments design wise.
Cryfer, if you still need it, best implement it yourself and submit a patch.
I'm not Cyfer, but done.