[osg-users] how to set a texture 1D of floats ?

Art Tevs stud_info2 at yahoo.de
Wed Sep 12 07:11:04 PDT 2007


If you setup your internalFormat and pixelFormat
correctly, then the code should work.

Art


--- Mael Blanchard <maelblanc at gmail.com> schrieb:

> Hi all,
> I have an array of floats (float tab[taille])  I
> would like to set a OSG
> texture 1D of float but i am not sure if my method
> is good : see the
> parameters of setImage mention below :
> 
> float  * tab = new float [taille];
> [...]
> 
>     osg::ref_ptr<osg::Image> imageOSG = new
> osg::Image();
> 
>     GLint internalTextureformat=1;
>     GLenum pixelFormat=GL_LUMINANCE;
> 
>     imageOSG->setImage (taille,
>                             1,
>                             1,
>                             internalTextureformat,
>                             pixelFormat,
>                             GL_FLOAT,
>                             (unsigned char *)tab,
>                            
> osg::Image::USE_NEW_DELETE);
> 
>     // Attach the image in a Texture2D object
>     osg::ref_ptr<osg::Texture1D> texOSG = new
> osg::Texture1D;
>     texOSG->setImage( imageOSG.get() );
> 
> 
> Thanks,
> 
> Mael
> > _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 



       __________________________________ 
Yahoo! Clever - Der einfachste Weg, Fragen zu stellen und Wissenswertes mit Anderen zu teilen. www.yahoo.de/clever




More information about the osg-users mailing list