Hi,
Roman Grigoriev wrote:
Hi, J.P.
Now I use this method and it works.
data = new float[256*64*3];
f = fopen("data/transmittance.raw", "rb");
fread(data, 1, 256*64*3*sizeof(float), f);
fclose(f);
osg::Image* image_Transmittance = new osg::Image;
image_Transmittance->allocateImage(64,16,1,GL_RGB16F_ARB, GL_FLOAT,1);
float* dataPtr = (float*)image_Transmittance->data();
for(int i=0;i<256*64*3;i++)
{
*dataPtr++ = data[i];
}
you don't need the loop or allocateImage.
I'm assuming your image is 64x16 RGB.
try this...
data = new float[64*16*3]; // you're already working in floats, no need
to *4
fread(data, 1, 64*16*3*sizeof(float), f); // 3 is for RGB
close(f);
osg::Image* image_Transmittance = new osg::Image;
image_Transmittance->setImage(64,16,1, GL_RGB, GL_RGB32F_ARB, GL_FLOAT,
(unsigned char*)data, osg::Image::NO_DELETE);
now you are responsible for deallocating data. Try this before switching
to 16F_ARB.
jp
And I simply want to use
image->setImage(64,16,1, GL_RGB16F_ARB, GL_RGB16F_ARB, GL_FLOAT, data, osg::Image::USE_NEW_DELETE);
but it doesn't works. In osgprerender I found solution using first method when
you have loops to copy data.
Thank you!
Cheers,
Roman
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=23419#23419
_______________________________________________
osg-users mailing list
[email protected]
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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org