[osg-users] multipass & calculating with shaders

John Donovan john.donovan at embryonicstudios.com
Mon Sep 17 07:54:24 PDT 2007


OSG at dvp.co.il wrote:
> thanks, I'll try that.
> 
> more problems I'm facing is setting the image internal data type, I've seen
> in the examples setting the internal type to 3 or 4. what does it mean? how
> do I set it to float or int?

I use the following code for rendering to a floating-point texture:
_texture = new Texture2D;
_texture->setResizeNonPowerOfTwoHint(false);
_texture->setTextureSize(_totalWidth, _totalHeight);
_texture->setSourceType(GL_FLOAT);
_texture->setSourceFormat(GL_RGB);
_texture->setInternalFormat(GL_RGB32F_ARB);
_texture->setFilter(Texture2D::MIN_FILTER, Texture2D::NEAREST);
_texture->setFilter(Texture2D::MAG_FILTER, Texture2D::NEAREST);


> and I couldn't read from the image even that I used code very similar to
> osgprerender example :(, the image->data() return buffer filled with
> garbage.

If I understand it correctly, the Image associated with a Texture is used for
uploading the data into the texture. If you want to read from the texture,
you'll need to copy it to a buffer. I can't remember how to do that off-hand,
but it'll likely be fairly slow.

-J


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________



More information about the osg-users mailing list