[osg-users] 32bit DEPTH for RTT
Trajce Nikolov NICK
trajce.nikolov.nick at gmail.com
Thu Oct 20 03:08:20 PDT 2016
Hi Voerman,
Yes, GL_DEPTH_COMPONENT32 was what I was missing ... Thanks a lot!
Trajce
On Thu, Oct 20, 2016 at 9:25 AM, Voerman, L. <l.voerman at rug.nl> wrote:
> Hi Trajce,
> maybe this sniplet helps?
> _textureDepthBuffer = new osg::Texture2D;
> _textureDepthBuffer->setTextureSize(_width+2.0f*_width*_guardBandPercentage,
> _height+2.0f*_height*_guardBandPercentage);
> _textureDepthBuffer->setSourceFormat(GL_DEPTH_COMPONENT);
> _textureDepthBuffer->setInternalFormat(GL_DEPTH_COMPONENT32);
> _textureDepthBuffer->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::
> NEAREST);
> _textureDepthBuffer->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::
> NEAREST);
> _textureDepthBuffer->setShadowComparison(false);
> _textureDepthBuffer->setWrap(osg::Texture::WRAP_R,osg::
> Texture::CLAMP_TO_EDGE);
> _textureDepthBuffer->setWrap(osg::Texture::WRAP_S,osg::
> Texture::CLAMP_TO_EDGE);
>
> // camera
> _colorDepthCamera = new osg::Camera;
> _colorDepthCamera->setStats(new osg::Stats("Camera"));
> _colorDepthCamera->setName("colorDepth");
> _colorDepthCamera->setClearMask(GL_COLOR_BUFFER_BIT |
> GL_DEPTH_BUFFER_BIT);
> _colorDepthCamera->setReferenceFrame(osg::Transform::RELATIVE_RF);
> // set viewport
> _colorDepthCamera->setViewport(0,0,_width+2.0f*_
> width*_guardBandPercentage,_height+2.0f*_height*_guardBandPercentage);
> _colorDepthCamera->setRenderOrder(osg::Camera::PRE_RENDER,0);
> _colorDepthCamera->setRenderTargetImplementation(
> osg::Camera::FRAME_BUFFER_OBJECT);
> _colorDepthCamera->attach(osg::Camera::DEPTH_BUFFER,
> _textureDepthBuffer.get(),0,0,false,0,0); // depth
> _colorDepthCamera->attach(osg::Camera::COLOR_BUFFER,
> _textureColorBuffer.get(),0,0,false,_msaa,_msaa); // color
> regards, Laurens.
>
> On Wed, Oct 19, 2016 at 11:15 PM, Trajce Nikolov NICK <
> trajce.nikolov.nick at gmail.com> wrote:
>
>> Hi Community,
>>
>> anyone with clue how to set RTT osg::Texture with 32bit DEPTH?
>>
>> Thanks a bunch as always!
>> Cheers,
>> Nick
>>
>> --
>> trajce nikolov nick
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
--
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161020/04acf1f7/attachment-0003.htm>
More information about the osg-users
mailing list