Page 1 of 1

Write into depth buffer

Posted: Mon Jan 25, 2021 7:19 pm
by Zeckurbo
Hey,
I was wondering, where the depth buffer is written in the code.
I have a depth sensor in gazebo, which uses ogre to render everything.
In the Code they allways load from the depth buffer but I cant find in Ogre where they write into it.

As far as I understand, the SceneManager should do it, but I dont see any obvious function.

Thank you for any help

Re: Write into depth buffer

Posted: Mon Jan 25, 2021 8:12 pm
by paroj
the same code that writes the color buffer, also writes the depth buffer

Re: Write into depth buffer

Posted: Mon Jan 25, 2021 10:22 pm
by Zeckurbo
Do you know in which class I can search for it, or maybe even whats the name of the function?

Re: Write into depth buffer

Posted: Tue Jan 26, 2021 1:31 am
by paroj
thats rendersystem dependant. E.g. with GL3+ the buffers are set up here:
https://github.com/OGRECave/ogre/blob/a ... ct.cpp#L80

the actual writing takes place when glDraw* is called.

Re: Write into depth buffer

Posted: Tue Jan 26, 2021 2:26 pm
by Zeckurbo
Thank you so much :D

I have found that the depth buffer is now initialized in GL3PlusFrameBufferObject::attachDepthBuffer()
https://github.com/OGRECave/ogre/blob/a ... t.cpp#L278

And I think the depth buffer is set in RenderSystem::setDepthBufferFor()
https://github.com/OGRECave/ogre/blob/a ... m.cpp#L667

Re: Write into depth buffer

Posted: Tue Jan 26, 2021 5:17 pm
by paroj
these are write-only depth-buffers (RenderBuffer in GL terms). If the depth is read somewhere it must go through the code that I linked.