I'm trying to use a float32 image for a texture in a plugin I have written. All
goes well with the setup (the plugin exits without error) but upon rendering I
get a seg fault. I initially wrote my code to load a BMP file for the texture
to verify that there were no issues unrelated to the texture data source. Next
I dumped my float32 2D array to a file and loaded it into ImageJ to verify that
there were no issues with my intended texture data. I then replaced the BMP
loading code with osg::Image::setImage(...) using the float32 2D array as the
image data as follows:
Code:
osg::Image* texImg = new osg::Image();
const float32* pRadiance = frad.mData.get();
const unsigned char* pData = reinterpret_castconst unsigned
char*(pRadiance);
unsigned char* pData1 = const_castunsigned char*(pData);
texImg-setImage(frad.mXWidth,frad.mYHeight,1,GL_LUMINANCE,GL_LUMINANCE,GL_FLOAT,pData1,osg::Image::NO_DELETE,1);
osg::ref_ptrosg::Texture2D texture = new osg::Texture2D;
texture-setDataVariance(osg::Object::DYNAMIC);
texture-setImage(texImg);
Anyone see something here that would cause a seg fault?
Regards,
Paul
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=42760#42760
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org