Hello Constantin,

Constantin Müller wrote:
>>> I'm wondering if nobody ever did a readback of the Stencilbuffer, or
>> it's quite possible, since the stencil is usually only needed when
>> trying to achieve a specific effect and even then readback is often not
>> required - for performance reason most people will usually try quite
>> hard to leave the data on the GPU only ;)
>>
> 
> 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));
   }
}

I don't know in which of the four bytes the GPUs store the stencil 
value, but changing stencilByte between 0..3 you can try them all.

        Cheers,
                Carsten

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to