Hello Carsten,
>> how can I get access to the stencil data from the image?
>> I got the packed depth/stencil image, but how can I readout the stencil data?
>> Is there any functionality available for that?
>
> as far as i understand it the stencil data should be in one of the four
> bytes that make up every pixel in the image. Calling img->getPixel(i)
> you can access the individual bytes:
>
> UInt32 stencilByte = 0;
>
> for(UInt32 h = 0; h < img->getHeight(); ++h)
> {
> for(UInt32 w = 0; w < img->getWidth(); ++w)
> {
> UInt8 p = img->getPixel(stencilByte + 4 * w + (h * img->getWidth()
> * 4));
> }
> }
the Code works fine, but I encountered another problem.
The depth/stencil-Image has no pixel data after the rendering.
The colorimage works fine.
Here is my code for the FBO setup:
OSG::RenderBufferRecPtr colorattachment = OSG::RenderBuffer::create();
OSG::RenderBufferRecPtr fboattachment = OSG::RenderBuffer::create();
colorattachment->setReadBack(true);
fboattachment->setReadBack(true);
colorimage = OSG::Image::create();
colorimage->set(OSG::Image::OSG_RGB_PF, sizex, sizey);
depthimage = OSG::Image::create();
depthimage->set(GL_UNSIGNED_INT_24_8_EXT, sizex, sizey);
colorattachment->setImage(colorimage);
colorattachment->setInternalFormat(GL_RGBA);
fboattachment->setImage(depthimage);
fboattachment->setInternalFormat(GL_DEPTH_STENCIL_EXT);
fbo = OSG::FrameBufferObject::create();
fbo->setWidth(sizex);
fbo->setHeight(sizey);
fbo->setPostProcessOnDeactivate(true);
fbo->setDepthAttachment(fboattachment);
fbo->setStencilAttachment(fboattachment);
fbo->clearColorAttachments();
fbo->setColorAttachment(colorattachment, 0);
//fbo->pushToColorAttachments(colorattachment);
fbo->editMFDrawBuffers()->clear();
fbo->editMFDrawBuffers()->push_back(GL_COLOR_ATTACHMENT0_EXT);
stage->setRenderTarget(fbo);
Do I miss something there?
I thought everything is similar to the colorimage, so it has to work
out, but depthimage->isValid() returns false.
Thanks,
Constantin
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users