[osg-users] Render depth into texture with 32 bits

155 views
Skip to first unread message

"Martin Großer"

unread,
Jul 4, 2012, 6:06:59 AM7/4/12
to osg-...@lists.openscenegraph.org
Hello,

how many bits are used by the GL_DEPTH_COMPONENT? I want to render the depth buffer value into a texture and use the internal texture format GL_DEPTH_COMPONENT. I would like use 24 or 32 bits for this value so I try GL_DEPTH_COMPONENT24 and GL_DEPTH_COMPONENT32 as internal format, but the rendering doesn't work. Only the GL_DEPTH_COMPONENT works, but I don't know how many bits are used. Is the number of bits depending on the Z-Buffer? My Z-Buffer use 24 bits.

Following the error message of GL_DEPTH_COMPONENT24:
---------------------------------------------------------------------
Using host libthread_db library "/lib64/libthread_db.so.1".
RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd6
Warning: FrameBufferObject: could not create the FBO
RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x0
Warning: FrameBufferObject: could not create the FBO
RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x0
FRAGMENT glCompileShader "" FAILED
FRAGMENT glCompileShader "" FAILED
glLinkProgram "" FAILED

Cheers

Martin
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Sergey Polischuk

unread,
Jul 4, 2012, 6:13:11 AM7/4/12
to OpenSceneGraph Users
Hi, Martin

try this:

texture2D->setSourceFormat(GL_DEPTH_COMPONENT);
texture2D->setInternalFormat(GL_DEPTH_COMPONENT32);
texture2D->setSourceType(GL_UNSIGNED_INT);

Cheers,
Sergey.

04.07.2012, 14:06, "Martin Groer" <Grosser...@gmx.de>:

"Martin Großer"

unread,
Jul 4, 2012, 6:30:32 AM7/4/12
to OpenSceneGraph Users
Hello Sergey,

thanks, it works! :-)

Should I change the number of depth buffer bits? GL_DEPTH_BITS is 24, so I think it doesn't make sense to save this into 32 bit. Or is this independent if the GL_DEPTH_BITS?

Cheers

Martin


-------- Original-Nachricht --------
> Datum: Wed, 04 Jul 2012 14:13:11 +0400
> Von: Sergey Polischuk <pol...@yandex.ru>
> An: OpenSceneGraph Users <osg-...@lists.openscenegraph.org>
> Betreff: Re: [osg-users] Render depth into texture with 32 bits

Sergey Polischuk

unread,
Jul 4, 2012, 6:57:14 AM7/4/12
to OpenSceneGraph Users
Hi

I think if you render to fbo bit depth depends of internal texture format, in case of rendering to framebuffer idk.

Cheers.

04.07.2012, 14:30, "Martin Groer" <Grosser...@gmx.de>:

Frederic Bouvier

unread,
Jul 4, 2012, 11:56:16 AM7/4/12
to OpenSceneGraph Users
Hi,

sourceFormat and sourceType are used if you read back the texture in CPU memory. To ease my debug in gDebugger, I use sourceType=GL_FLOAT
It doesn't change how the fbo works, but I can read floats between 0 and 1 in the debugger.

Regards,
-Fred


----- Mail original -----
De: "Sergey Polischuk" <pol...@yandex.ru>
À: "OpenSceneGraph Users" <osg-...@lists.openscenegraph.org>
Envoyé: Mercredi 4 Juillet 2012 12:57:14
Objet: Re: [osg-users] Render depth into texture with 32 bits

Reply all
Reply to author
Forward
0 new messages