Changd unsigned int's to unsigned char* to fix gcc3.4 64 bit issues.
This commit is contained in:
@@ -99,7 +99,7 @@ class OSG_EXPORT Image : public Object
|
|||||||
void setImage(int s,int t,int r,
|
void setImage(int s,int t,int r,
|
||||||
GLint internalTextureformat,
|
GLint internalTextureformat,
|
||||||
GLenum pixelFormat,GLenum type,
|
GLenum pixelFormat,GLenum type,
|
||||||
unsigned char *data,
|
unsigned char* data,
|
||||||
AllocationMode mode,
|
AllocationMode mode,
|
||||||
int packing=1);
|
int packing=1);
|
||||||
|
|
||||||
@@ -169,10 +169,10 @@ class OSG_EXPORT Image : public Object
|
|||||||
bool valid() const { return _s!=0 && _t!=0 && _r!=0 && _data!=0 && _dataType!=0; }
|
bool valid() const { return _s!=0 && _t!=0 && _r!=0 && _data!=0 && _dataType!=0; }
|
||||||
|
|
||||||
/** Raw image data. */
|
/** Raw image data. */
|
||||||
inline unsigned char *data() { return _data; }
|
inline unsigned char* data() { return _data; }
|
||||||
|
|
||||||
/** Raw const image data. */
|
/** Raw const image data. */
|
||||||
inline const unsigned char *data() const { return _data; }
|
inline const unsigned char* data() const { return _data; }
|
||||||
|
|
||||||
|
|
||||||
inline unsigned char* data(int column, int row=0,int image=0)
|
inline unsigned char* data(int column, int row=0,int image=0)
|
||||||
@@ -279,11 +279,11 @@ class OSG_EXPORT Image : public Object
|
|||||||
unsigned int _packing;
|
unsigned int _packing;
|
||||||
|
|
||||||
AllocationMode _allocationMode;
|
AllocationMode _allocationMode;
|
||||||
unsigned char *_data;
|
unsigned char* _data;
|
||||||
|
|
||||||
void deallocateData();
|
void deallocateData();
|
||||||
|
|
||||||
void setData(unsigned char *data,AllocationMode allocationMode);
|
void setData(unsigned char* data,AllocationMode allocationMode);
|
||||||
|
|
||||||
unsigned int _modifiedCount;
|
unsigned int _modifiedCount;
|
||||||
|
|
||||||
|
|||||||
@@ -842,17 +842,16 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int dataMinusOffset=0;
|
unsigned char* dataMinusOffset = 0;
|
||||||
unsigned int dataPlusOffset=0;
|
unsigned char* dataPlusOffset = 0;
|
||||||
|
|
||||||
|
|
||||||
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
||||||
if (pbo && pbo->isBufferObjectSupported(contextID) && !needImageRescale)
|
if (pbo && pbo->isBufferObjectSupported(contextID) && !needImageRescale)
|
||||||
{
|
{
|
||||||
pbo->compileBuffer(state);
|
pbo->compileBuffer(state);
|
||||||
pbo->bindBuffer(contextID);
|
pbo->bindBuffer(contextID);
|
||||||
dataMinusOffset = (unsigned int) data;
|
dataMinusOffset = data;
|
||||||
dataPlusOffset=pbo->offset(); // -dataMinusOffset+dataPlusOffset
|
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
|
||||||
#ifdef DO_TIMING
|
#ifdef DO_TIMING
|
||||||
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
||||||
#endif
|
#endif
|
||||||
@@ -1082,16 +1081,16 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
|
|||||||
|
|
||||||
bool useHardwareMipMapGeneration = !image->isMipmap() && _useHardwareMipMapGeneration && generateMipMapSupported;
|
bool useHardwareMipMapGeneration = !image->isMipmap() && _useHardwareMipMapGeneration && generateMipMapSupported;
|
||||||
|
|
||||||
unsigned int dataMinusOffset=0;
|
unsigned char* dataMinusOffset=0;
|
||||||
unsigned int dataPlusOffset=0;
|
unsigned char* dataPlusOffset=0;
|
||||||
|
|
||||||
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
||||||
if (pbo && pbo->isBufferObjectSupported(contextID) && !needImageRescale)
|
if (pbo && pbo->isBufferObjectSupported(contextID) && !needImageRescale)
|
||||||
{
|
{
|
||||||
pbo->compileBuffer(state);
|
pbo->compileBuffer(state);
|
||||||
pbo->bindBuffer(contextID);
|
pbo->bindBuffer(contextID);
|
||||||
dataMinusOffset = (unsigned int) data;
|
dataMinusOffset = data;
|
||||||
dataPlusOffset=pbo->offset(); // -dataMinusOffset+dataPlusOffset
|
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
|
||||||
#ifdef DO_TIMING
|
#ifdef DO_TIMING
|
||||||
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -244,16 +244,16 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int dataMinusOffset=0;
|
unsigned char* dataMinusOffset = 0;
|
||||||
unsigned int dataPlusOffset=0;
|
unsigned char* dataPlusOffset = 0;
|
||||||
|
|
||||||
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
||||||
if (pbo && pbo->isBufferObjectSupported(contextID))
|
if (pbo && pbo->isBufferObjectSupported(contextID))
|
||||||
{
|
{
|
||||||
pbo->compileBuffer(state);
|
pbo->compileBuffer(state);
|
||||||
pbo->bindBuffer(contextID);
|
pbo->bindBuffer(contextID);
|
||||||
dataMinusOffset=(unsigned int)image->data();
|
dataMinusOffset = image->data();
|
||||||
dataPlusOffset=pbo->offset(); // -dataMinusOffset+dataPlusOffset
|
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -265,7 +265,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
|
|||||||
image->s(), image->t(), 0,
|
image->s(), image->t(), 0,
|
||||||
(GLenum)image->getPixelFormat(),
|
(GLenum)image->getPixelFormat(),
|
||||||
(GLenum)image->getDataType(),
|
(GLenum)image->getDataType(),
|
||||||
image->data() + dataPlusOffset-dataMinusOffset);
|
image->data() - dataMinusOffset + dataPlusOffset );
|
||||||
|
|
||||||
|
|
||||||
if (pbo)
|
if (pbo)
|
||||||
@@ -311,16 +311,16 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
|
|||||||
osg::Timer_t start_tick = osg::Timer::instance()->tick();
|
osg::Timer_t start_tick = osg::Timer::instance()->tick();
|
||||||
osg::notify(osg::NOTICE)<<"glTexSubImage2D pixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl;
|
osg::notify(osg::NOTICE)<<"glTexSubImage2D pixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl;
|
||||||
#endif
|
#endif
|
||||||
unsigned int dataMinusOffset=0;
|
unsigned char* dataMinusOffset = 0;
|
||||||
unsigned int dataPlusOffset=0;
|
unsigned char* dataPlusOffset = 0;
|
||||||
|
|
||||||
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
||||||
if (pbo && pbo->isBufferObjectSupported(contextID))
|
if (pbo && pbo->isBufferObjectSupported(contextID))
|
||||||
{
|
{
|
||||||
pbo->compileBuffer(state);
|
pbo->compileBuffer(state);
|
||||||
pbo->bindBuffer(contextID);
|
pbo->bindBuffer(contextID);
|
||||||
dataMinusOffset=(unsigned int)image->data();
|
dataMinusOffset = image->data();
|
||||||
dataPlusOffset=pbo->offset(); // -dataMinusOffset+dataPlusOffset
|
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset()); // -dataMinusOffset+dataPlusOffset
|
||||||
|
|
||||||
#ifdef DO_TIMING
|
#ifdef DO_TIMING
|
||||||
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
||||||
@@ -332,13 +332,14 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
|
|||||||
pbo = 0;
|
pbo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// UH: ignoring compressed for now.
|
// UH: ignoring compressed for now.
|
||||||
glTexSubImage2D(target, 0,
|
glTexSubImage2D(target, 0,
|
||||||
0,0,
|
0,0,
|
||||||
image->s(), image->t(),
|
image->s(), image->t(),
|
||||||
(GLenum)image->getPixelFormat(),
|
(GLenum)image->getPixelFormat(),
|
||||||
(GLenum)image->getDataType(),
|
(GLenum)image->getDataType(),
|
||||||
image->data() + dataPlusOffset-dataMinusOffset);
|
image->data() - dataMinusOffset + dataPlusOffset );
|
||||||
|
|
||||||
if (pbo)
|
if (pbo)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user