thank Jhon.

I want to read the buffer from the texture only for debug purposes. In the
final program I won't do it. I need to  associate image with the texture to
set it's initial values, and later some passes in the multipass sequences
are updating this data. The problem is that after associating image with the
texture, I think the image reads automatically the texture buffer (take the
osgprerender example for instance, there is an image and in the post render
they play with it's buffer, which means the image read the current texture),
and this might slow down the program.

Another thing is as I mentioned earlier: I need to set the initial values of
the texture, and the only way I know how to do it is using images, so the
question is how do I set images internal type, pixel type and gltype, to be
float, long, etc... (unsigned char appears in the examples).

btw, I offset the point by half and it worked for one pass that renders
about 3 pixels. it didn't work for other pass that renders 1 pixel. is there
a problem when the viewport is 1x1?

thanks a lot,
 Guy.
----- Original Message -----
From: "John Donovan" <[EMAIL PROTECTED]>
To: "OpenSceneGraph Users" <[email protected]>
Sent: Monday, September 17, 2007 4:54 PM
Subject: Re: [osg-users] multipass & calculating with shaders


> [EMAIL PROTECTED] 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
> ______________________________________________________________________
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to