Hi, Have you tried to store your mage in an other format than jpg? I have also difficulties to store in jpg format. I personally store screenshots of a 3D scene, and it works well when I use png format, or bmp format, but not with the jpg format.
Maybe the libjpeg used by osg don't work with RGB image? Jean-Baptiste. 2008/4/10, Vincent Bourdier <[EMAIL PROTECTED]>: > > Hi All, > > I have a problem concerning writing image data. > > My code is simple : > > const long size = _x*_y*3; > > > > unsigned char* data = (unsigned char*)calloc(size, sizeof(unsigned > > char)); > > > > for(long i=0; i < size ; i+= 3) > > { > > data[i] = 0; //red > > data[i+1] = 0; //green > > data[i+2] = 0; //blue > > } > > > > osg::ref_ptr<osg::Image> image = new osg::Image; > > image->allocateImage(_x, _y, 1, GL_RGB, GL_UNSIGNED_SHORT); > > image->setOrigin(osg::Image::BOTTOM_LEFT);//start counting pixels on > > the Bottom left of the picture > > image->setImage(_x, _y, 1, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT, data, > > osg::Image::NO_DELETE); > > > > osgDB::writeImageFile(*image, "Z:/autres/Gradient.jpg"); > > > > > the result must be a black picture... but I've a totally different result > (see attached file) > > Does anyone see a mistake ? > > Thanks. > > Regards, > Vincent. > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org