Hi Robert, All
Bit more info on this bug, well not so much a bug more be bending the OSG in
funny ways :)
So in the function Texture2D::apply right near the top we have
// get the texture object for the current contextID.
TextureObject* textureObject = getTextureObject(contextID);
if (textureObject)
{
if (_image.valid() && getModifiedCount(contextID) !=
_image->getModifiedCount())
{
OSG_WARN << "Tex obj modified" << std::endl;
// compute the internal texture format, this set the
_internalFormat to an appropriate value.
computeInternalFormat();
GLsizei new_width, new_height, new_numMipmapLevels;
// compute the dimensions of the texture.
computeRequiredTextureDimensions(state, *_image, new_width,
new_height, new_numMipmapLevels);
if (!textureObject->match(GL_TEXTURE_2D, new_numMipmapLevels,
_internalFormat, new_width, new_height, 1, _borderWidth))
{
OSG_WARN << "Tex obj released" << std::endl;
Texture::releaseTextureObject(contextID,
_textureObjectBuffer[contextID].get());
_textureObjectBuffer[contextID] = 0;
textureObject = 0;
}
}
}
I think the culprit to be
// compute the dimensions of the texture.
computeRequiredTextureDimensions(state, *_image, new_width,
new_height, new_numMipmapLevels);
if (!textureObject->match(GL_TEXTURE_2D, new_numMipmapLevels,
_internalFormat, new_width, new_height, 1, _borderWidth))
What's happening is that I create a texture that is a power of two size up
but modify with a smaller image. So then the above line detects
the modify and says that our textureObject does not match the dimensions of
the image and releases the texture object, which causes the subsequent load
call.
Robert what do you think to be the best solution to this problem?
Cheers
Tom
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org