Hi Robert,
the current NVTTProcessor.cpp crashed on my system in the convertRGBAToBGRA
method. For me it looks as if it accidentially uses the n variable to access
the red channel. I fixed it by reading column*4+0 as it is done for the other
channels. The error was introduced with the change to non-contiguous images in
OSG
old code:
[code]
// Convert RGBA to BGRA : nvtt only accepts BGRA pixel format
void NVTTProcessor::convertRGBAToBGRA( std::vector<unsigned char>& outputData,
const osg::Image& image )
{
unsigned int n=0;
for(int row=0; row<image.t(); ++row)
{
const unsigned char* data = image.data(0,row);
for(int column=0; column<image.s(); ++column)
{
outputData[n] = data[column*4+2];
outputData[n+1] = data[column*4+1];
outputData[n+2] = data[column*4+n]; // TG crash here
outputData[n+3] = data[column*4+3];
n+=4;
}
}
}
[/code]
fixed code:
[code]
// Convert RGBA to BGRA : nvtt only accepts BGRA pixel format
void NVTTProcessor::convertRGBAToBGRA( std::vector<unsigned char>& outputData,
const osg::Image& image )
{
unsigned int n=0;
for(int row=0; row<image.t(); ++row)
{
const unsigned char* data = image.data(0,row);
for(int column=0; column<image.s(); ++column)
{
outputData[n] = data[column*4+2];
outputData[n+1] = data[column*4+1];
outputData[n+2] = data[column*4+0]; // works for me
outputData[n+3] = data[column*4+3];
n+=4;
}
}
}
[/code]
You can reproduce the error with osgdem and the puget dataset:
[code]
osgdem --compressor-nvtt --xx 10 --yy 10 -t ps_texture_16k.tif --xx 10 --yy 10
-d ps_height_16k.tif -l 4 -v 0.1 -o puget.osgb
[/code]
Thank you!
Cheers,
Tassilo[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47744#47744
Attachments:
http://forum.openscenegraph.org//files/nvtt_fix_147.zip
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org