[osg-users] Get RGB Values from Texture

Tang And Miao 819721810 at qq.com
Thu Nov 9 22:34:06 PST 2017


Hi,

    I met this problem before(can't read RGB from texture when using render to texture.),i don't know why Until now. But i can offer you another way . It's render to image.
    Code like that:
camera->setRenderOrder(osg::Camera::PRE_RENDER);
     osg::Image* image = new osg::Image;
	image->allocateImage(new_s, new_t, 1, GL_RGBA, GL_UNSIGNED_BYTE);
    camera->attach(osg::Camera::COLOR_BUFFER, image,0, 0);
    camera->setFinalDrawCallback(new MyCameraPostDrawCallback());
     Then you can write RGB into picture.If you still can't understand my meaning.You can read this file that i upload or osg Examples(osgprerender).
     Forgiving me for my english. I am chinese and i can't use this Forum expertly . This is my first reply.Hoping to help you.
     Good Luck.

Cheers,
Tang

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







More information about the osg-users mailing list