Added support for 565 textures to osgbluemarble.

Added a osg::Image::scaleImage() version which allows the datatype to be varied.
This commit is contained in:
Robert Osfield 2003-10-29 23:10:11 +00:00
parent 1d81edeaab
commit fd016af34b
3 changed files with 9 additions and 5 deletions

View File

@ -102,7 +102,7 @@ osg::Node* createTile(const std::string& filename, bool leftHemisphere, double x
} else if (use565)
{
image->scaleImage(image->r(),image->s(),image->t(),GL_UNSIGNED_SHORT_5_6_5);
image->scaleImage(image->s(),image->t(),image->r(),GL_UNSIGNED_SHORT_5_6_5);
}

View File

@ -110,7 +110,10 @@ class SG_EXPORT Image : public Object
/** Scale image to specified size. */
void scaleImage(int s,int t,int r);
void scaleImage(int s,int t,int r) { scaleImage(s,t,r, getDataType()); }
/** Scale image to specified size and with specified data type. */
void scaleImage(int s,int t,int r, GLenum newDataType);
/** Copy a source Image into a subpart of this Image at specified position.
* Typically used to copy to an already allocated image, such as creating

View File

@ -426,7 +426,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID)
}
void Image::scaleImage(int s,int t,int r)
void Image::scaleImage(int s,int t,int r, GLenum newDataType)
{
if (_s==s && _t==t && _r==r) return;
@ -444,7 +444,7 @@ void Image::scaleImage(int s,int t,int r)
unsigned int newTotalSize = computeRowWidthInBytes(s,_pixelFormat,_dataType,_packing)*t;
unsigned int newTotalSize = computeRowWidthInBytes(s,_pixelFormat,newDataType,_packing)*t;
// need to sort out what size to really use...
unsigned char* newData = new unsigned char [newTotalSize];
@ -465,7 +465,7 @@ void Image::scaleImage(int s,int t,int r)
_data,
s,
t,
_dataType,
newDataType,
newData);
if (status==0)
@ -474,6 +474,7 @@ void Image::scaleImage(int s,int t,int r)
// free old image.
_s = s;
_t = t;
_dataType = newDataType;
setData(newData,USE_NEW_DELETE);
}
else