I have two OSG programs that send data between each other via multicast
datagrams. One renders a texture, converts it to a jpeg format, and then
sends it over the wire to another OSG program that uses this texture. My
problem is being able to take the raw buffer of already compressed jpeg
data and using it as the image file for the texture.
I have on the receiving side (and this works, slowly, as I can't figure
how to exactly set the image data from the jpeg buffer read in.):
// receive datagram
BYTE bytebuf[MYBUFSIZE];
recv_count =
mcast_dgram_.recv(&bytebuf,sizeof(bytebuf),local);
// via CXimage lib, - use 3rd party convertor to create
memory file and write to RAMdisk (B:)
CxImage mimage(bytebuf,recv_count,CXIMAGE_FORMAT_JPG);
mimage.Save("b:\\image2.jpg",CXIMAGE_FORMAT_JPG);
// OSG reads image from RAMDisk and pastes texture onto
plane
osg::Image* klnFace =
osgDB::readImageFile("b:\\image2.jpg");
if (recv_count > 0) KLN89FaceTexture->setImage(klnFace);
What I would like to do is something like this:
BYTE bytebuf[MYBUFSIZE];
recv_count =
mcast_dgram_.recv(&bytebuf,sizeof(bytebuf),local);
// OSG gets image data directly from jpeg buffer
osg::Image* klnFace = new osg::Image;
klnFace->setImage(....,bytebuf,...);
if (recv_count > 0) KLN89FaceTexture->setImage(klnFace);
My problem is I can't figure out how to use the sent over jpeg buffer to
fill the image data.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/