Hello Mourad,
ok, I can change it to GL_UNSIGNED_SHORT and I can change the internal
pixel format to GL_RGB16, but the data value is a pointer to a unsigned
char. Unsigned char is also 8 bit and not 16 bit?
Here the changed version:
const long size = width*height*3;
unsigned char* data = (unsigned char*)calloc(size, sizeof(unsigned short));
for(long i=0; i < size ; i+= 3)
{
data[i] = 65535; //red
data[i+1] = 0; //green
data[i+2] = 0; //blue
}
// image
osg::ref_ptr<osg::Image> image = new osg::Image;
image->allocateImage(width, height, 1, GL_RGB, GL_UNSIGNED_SHORT);
image->setOrigin(osg::Image::BOTTOM_LEFT);
image->setImage(width, height, 1, GL_RGB16, GL_RGB16, GL_UNSIGNED_SHORT,
data, osg::Image::NO_DELETE);
osgDB::writeImageFile(*image, "/home/.../test.jpg");
What type is possible for the data value? And what happens when I use
GL_FLOAT? There are 32 bits?
My main problem is, I don't understand the data value.
Cheers,
Martin
Am 29.07.2009 13:25, schrieb Mourad Boufarguine:
Martin,
And for the second question, yes, you can use 16 bits per channel.
GL_UNSIGNED_BYTE means 8 bits per channel, so GL_UNSIGNED_SHORT is for
16 bits.
Mourad
2009/7/29 Martin Großer <[email protected]
<mailto:[email protected]>>
Year! That is right. I feel awful about this mistake.
First I try GL_FLOAT and I forget to change the value from 1 to 255.
Thanks for your help.
Martin
Am 29.07.2009 11:39, schrieb David Spilling:
Martin,
I think you want this:
data[i] = 255; //red
David
------------------------------------------------------------------------
_______________________________________________ osg-users mailing
list [email protected]
<mailto:[email protected]>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
<mailto:[email protected]>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org