Write into depth buffer

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
Zeckurbo
Gnoblar
Posts: 9
Joined: Wed Nov 11, 2020 6:13 pm

Write into depth buffer

Post 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
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Write into depth buffer

Post by paroj »

the same code that writes the color buffer, also writes the depth buffer
User avatar
Zeckurbo
Gnoblar
Posts: 9
Joined: Wed Nov 11, 2020 6:13 pm

Re: Write into depth buffer

Post by Zeckurbo »

Do you know in which class I can search for it, or maybe even whats the name of the function?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Write into depth buffer

Post 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.
User avatar
Zeckurbo
Gnoblar
Posts: 9
Joined: Wed Nov 11, 2020 6:13 pm

Re: Write into depth buffer

Post 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
paroj
OGRE Team Member
OGRE Team Member
Posts: 1993
Joined: Sun Mar 30, 2014 2:51 pm
x 1073
Contact:

Re: Write into depth buffer

Post 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.
Post Reply