Yes, but GL_UNSIGNED_CHAR doesn't exist.

so I don't know what to use...

2008/4/10, J.P. Delport <[EMAIL PROTECTED]>:
>
> Hi,
>
> sizeof(unsigned char) != sizeof(GL_UNSIGNED_SHORT)
>
> try GL_UNSIGNED_CHAR
>
> jp
>
>
> Vincent Bourdier wrote:
> > 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
>
> --
> This message is subject to the CSIR's copyright terms and conditions,
> e-mail legal notice, and implemented Open Document Format (ODF) standard.
> The full disclaimer details can be found at
> http://www.csir.co.za/disclaimer.html.
>
> This message has been scanned for viruses and dangerous content by
> MailScanner,
> and is believed to be clean.  MailScanner thanks Transtec Computers for
> their support.
>
> _______________________________________________
> 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

Reply via email to