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

Mael Blanchard maelblanc at gmail.com
Wed Sep 12 06:54:11 PDT 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070912/dfde599b/attachment-0002.htm>


More information about the osg-users mailing list