[osg-users] osg::Vec3Array as uniform to Shader

Rômulo Cerqueira romulogcerqueira at gmail.com
Sat Mar 3 21:57:17 PST 2018


Hi,

I found a way to solve this problem: converting the array to texture.

Follows an example:


Code:

osg::ref_ptr<osg::Image> image = new osg::Image;
image->setImage(myVec3Array->size(), 1, 1, GL_RGBA8, GL_RGBA, GL_FLOAT, (unsigned char*) &myVec3Array[0], osg::Image::NO_DELETE);

osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
texture->setImage(image);

...

ss->addUniform( new osg::Uniform("vertexMap", texture) );




... 

Thank you!

Cheers,
Rômulo[/code]

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







More information about the osg-users mailing list