Added missing setDataType and setPacking functions

This commit is contained in:
Robert Osfield 2006-08-25 15:49:29 +00:00
parent ff61a20315
commit 179f6100a0
2 changed files with 19 additions and 1 deletions

View File

@ -141,8 +141,10 @@ class OSG_EXPORT Image : public Object
void setPixelFormat(GLenum pixelFormat);
inline GLenum getPixelFormat() const { return _pixelFormat; }
void setDataType(GLenum dataType);
inline GLenum getDataType() const { return _dataType; }
void setPacking(unsigned int packing) { _packing = packing; }
inline unsigned int getPacking() const { return _packing; }
/** Return the number of bits required for each pixel. */

View File

@ -334,7 +334,7 @@ void Image::setPixelFormat(GLenum pixelFormat)
{
if (_pixelFormat==pixelFormat) return; // do nothing if the same.
if (computeNumComponents(_pixelFormat)==computeNumComponents(pixelFormat))
if (_pixelFormat==0 || computeNumComponents(_pixelFormat)==computeNumComponents(pixelFormat))
{
// if the two formats have the same number of componets then
// we can do a straight swap.
@ -346,6 +346,22 @@ void Image::setPixelFormat(GLenum pixelFormat)
}
}
void Image::setDataType(GLenum dataType)
{
if (_dataType==dataType) return; // do nothing if the same.
if (_dataType==0)
{
// setting the datatype for the first time
_dataType = dataType;
}
else
{
notify(WARN)<<"Image::setDataType(..) - warning, attempt to reset the data type not permitted."<<std::endl;
}
}
void Image::allocateImage(int s,int t,int r,
GLenum format,GLenum type,
int packing)