Hi,

With osg::image normally you can setup a 3d image , but there is a problem for 
the length .... someone know what is wrong with these declaration :

I want to create an image of 100x100x100


Code:

//creation of the data 
int height=100;
int width=100;
int length=100;
const long size = width*height*length;
unsigned short* data = (unsigned short*)calloc(size, sizeof(unsigned short));

for(long i=0; i < size ; i+= 3)
{
data[i]=255;//red
data[i+1]=0;//green
data[i+2]=0;//blue
}



// declaration and allocation of the 3d image (size : 100,100,100)
osg::ref_ptr<osg::Image> image = new osg::Image;
image->allocateImage(width, height, length, GL_RGB, GL_UNSIGNED_SHORT);
image->setOrigin(osg::Image::BOTTOM_LEFT);
image->setImage(width, height, length,GL_RGB,GL_RGB,GL_UNSIGNED_SHORT, 
(unsigned char*)data,osg::Image::NO_DELETE);





Thank you!

Cheers,
Thomas[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=21547#21547





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to