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.
<<attachment: Gradient.jpg>>
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

