[osg-users] Floating Point Textures

2011-09-14 Thread Paul Leopard
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


Re: [osg-users] Floating Point Textures

2011-09-14 Thread Paul Leopard
I used NO_DELETE since memory management of the array was handled outside of 
the image. When I copy the data to a new array and use USE_NEW_DELETE the seg 
fault goes away ... Is there a bug in the NO_DELETE option or am I missing 
something?

Thanks,
Paul

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org