Replaced allocateMipmap code with warning message as mipmaps aren't support for TextureRectangle.

This commit is contained in:
Robert Osfield
2007-09-11 16:56:21 +00:00
parent 66cc306f18
commit 041afdc303

View File

@@ -543,45 +543,8 @@ void TextureRectangle::copyTexSubImage2D(State& state, int xoffset, int yoffset,
}
}
void TextureRectangle::allocateMipmap(State& state) const
void TextureRectangle::allocateMipmap(State&) const
{
const unsigned int contextID = state.getContextID();
// get the texture object for the current contextID.
TextureObject* textureObject = getTextureObject(contextID);
if (textureObject && _textureWidth != 0 && _textureHeight != 0)
{
// bind texture
textureObject->bind();
// compute number of mipmap levels
int width = _textureWidth;
int height = _textureHeight;
int numMipmapLevels = 1 + (int)floor(log2(maximum(width, height)));
// we do not reallocate the level 0, since it was already allocated
width >>= 1;
height >>= 1;
for( GLsizei k = 1; k < numMipmapLevels && (width || height); k++)
{
if (width == 0)
width = 1;
if (height == 0)
height = 1;
glTexImage2D( GL_TEXTURE_RECTANGLE, k, _internalFormat,
width, height, _borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat,
_sourceType ? _sourceType : GL_UNSIGNED_BYTE, NULL);
width >>= 1;
height >>= 1;
}
// inform state that this texture is the current one bound.
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
}
osg::notify(osg::NOTICE)<<"Warning: TextureRectangle::allocateMipmap(State&) called eroneously, GL_TEXTURE_RECTANGLE does not support mipmapping."<<std::endl;
}