Hi,
I modified the code to convert a wxImage to osg Image as follows. However, for
some reason the resulting osg Image is not accurate. When I apply the resulted
osg Image as a texture, it shows nothing but a gray colored QUAD.
Am I doing something wrong in the code below?
I really appreciate your help!
Code:
wxImageHandler * imgLoader = new wxJPEGHandler();
wxImage::AddHandler(imgLoader);
wxImage wximage;
wximage.LoadFile(_T("pictures/img.JPG"), wxBITMAP_TYPE_JPEG);
unsigned char* datachar = wximage.GetData();
std::stringstream ss;
size_t len = strlen((const char*)datachar);
ss.write((const char*)datachar, len);
osgDB::ReaderWriter* plugin =
osgDB::Registry::instance()->getReaderWriterForExtension("JPEG");
/* tried both ss and ss.str() */
osgDB::ReaderWriter::ReadResult result = plugin->readImage(ss);
// osgDB::ReaderWriter::ReadResult result = plugin->readImage(ss.str());
/* Texture */
osg::Texture2D* KLN89FaceTexture = new osg::Texture2D;
KLN89FaceTexture->setDataVariance(osg::Object::DYNAMIC);
osg::Image* klnFace = result.getImage();
Thank you!
Best Regards,
Lahiru[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32302#32302
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org