Re: [osg-users] Get RGB Values from Textrue

2017-11-13 Thread Sebastian Messerschmidt


Hi Maxim,


Hi,

I have a osg::Texture2D that I'm using as a render to texture target.
I can see that it is working on the screen, but I need to have access to the 
RGB values of the texture itself so I can also copy them to another API.

How can I access the RGB values?


set a postDrawCallback to the pass/camera that writes to the texture.


In the callback:

virtual void operator () (osg::RenderInfo& render_info) const
{
osg::State* state=render_info.getState();
state->apply(render_info.getCurrentCamera()->getStateSet());
state->applyTextureAttribute(0, mTexture);
mTexture->apply(*state);
	mImage->readImageFromCurrentTexture(render_info.getContextID(),true, 
GL_FLOAT ); //change the GL_FLOAT to your needs

}

the mTexture is passed to the callback using the original texture 
attached to the MRT.


Cheers
Sebastian






After rendering a frame, if I access _image in the texture2D class, it is null, 
but I do see that the Texture of texture2D has an array size of 1.
How and where are the RGB values stored?

Thank you!

Maxim


Thank you,
--Maxim

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72322#72322





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Get RGB Values from Textrue

2017-11-07 Thread Maxim Stere
Hi,

I have a osg::Texture2D that I'm using as a render to texture target. 
I can see that it is working on the screen, but I need to have access to the 
RGB values of the texture itself so I can also copy them to another API. 

How can I access the RGB values?

After rendering a frame, if I access _image in the texture2D class, it is null, 
but I do see that the Texture of texture2D has an array size of 1. 
How and where are the RGB values stored?

Thank you!

Maxim


Thank you,
--Maxim

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72322#72322





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org