From Sukender, "I experienced as some users before: I tried to rescale an image without a valid rendering context... And had problems to unserstand what the "GL_OUT_OF_MEMORY" meant! So I added a few comments for future users."

This commit is contained in:
Robert Osfield
2009-12-08 17:25:45 +00:00
parent d54b6907b8
commit 248386861b
2 changed files with 9 additions and 5 deletions

View File

@@ -135,10 +135,14 @@ class OSG_EXPORT Image : public BufferData
virtual void readImageFromCurrentTexture(unsigned int contextID, bool copyMipMapsIfAvailable, GLenum type = GL_UNSIGNED_BYTE);
/** Scale image to specified size. */
/** Scale image to specified size.
* \warning The method uses gluScaleImage() and thus needs a valid rendering context.
*/
void scaleImage(int s,int t,int r) { scaleImage(s,t,r, getDataType()); }
/** Scale image to specified size and with specified data type. */
/** Scale image to specified size and with specified data type.
* \warning The method uses gluScaleImage() and thus needs a valid rendering context.
*/
virtual void scaleImage(int s,int t,int r, GLenum newDataType);
/** Copy a source Image into a subpart of this Image at specified position.

View File

@@ -960,9 +960,9 @@ void Image::scaleImage(int s,int t,int r, GLenum newDataType)
}
else
{
delete [] newData;
delete [] newData;
notify(WARN) << "Error Image::scaleImage() did not succeed : errorString = "<<gluErrorString((GLenum)status)<<std::endl;
notify(WARN) << "Error Image::scaleImage() did not succeed : errorString = "<< gluErrorString((GLenum)status) << ". The rendering context may be invalid." << std::endl;
}
dirty();
@@ -1023,7 +1023,7 @@ void Image::copySubImage(int s_offset, int t_offset, int r_offset, const osg::Im
if (status!=0)
{
notify(WARN) << "Error Image::scaleImage() do not succeed : errorString = "<<gluErrorString((GLenum)status)<<std::endl;
notify(WARN) << "Error Image::scaleImage() did not succeed : errorString = "<< gluErrorString((GLenum)status) << ". The rendering context may be invalid." << std::endl;
}
#else
osg::notify(osg::NOTICE)<<"Warning: Image::copySubImage(int, int, int, const osg::Image*)) not supported."<<std::endl;