Hi,
I recently upgraded from osg 2.6 to 3.2.1. I noticed that the
SubloadCallback::load() now gets called exclusively and eats up all
memory until the machine crashes. subload() never gets called anymore. I
changed my Texture2D instance to use 1 mipmap level and forced it have
zero levels with opengl directly in the load() method and this seems to
work. Why can I not set the number of mipmap levels to be zero when
using SubloadCallback? I only use this to upload tiles in the texture.
Only the one texture has the callback.
I thought it had something to do with the TextureObject, but it seems to
make no difference what the mipmap count is in the TextureObject when I
override generateTextureObject().
This is the code I'm using:
m_tileTexture = new osg::Texture2D();
// Apparent bug in OSG where only SubloadCallback::load() will
be called.
// This should be set to 0 when fixed.
m_tileTexture->setNumMipmapLevels(1); // When 0, runs out of RAM
m_tileTexture->setTextureSize(kTileNum * kTileSize, kTileNum *
kTileSize); // 4096x4096
m_tileTexture->setFilter(osg::Texture::MIN_FILTER,
osg::Texture::LINEAR);
m_tileTexture->setFilter(osg::Texture::MAG_FILTER,
osg::Texture::LINEAR);
m_tileTexture->setWrap(osg::Texture::WRAP_S,
osg::Texture::CLAMP_TO_EDGE);
m_tileTexture->setWrap(osg::Texture::WRAP_T,
osg::Texture::CLAMP_TO_EDGE);
m_tileData = // custom allocation code omitted. Allocates
4096x4096x4 bytes.
m_tileImage = new osg::Image();
m_tileImage->setImage(kTileNum * kTileSize, kTileNum *
kTileSize, 1, GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE,
reinterpret_cast<unsigned char*>(m_tileData->getDataPtr()),
osg::Image::NO_DELETE);
m_tileTexture->setImage(m_tileImage.get());
m_tileTexture->setSubloadCallback(new SubLoadCallback(*this));
SubloadCallback::load() just calls glTexImage2D() with the settings
obtained from the texture's image.
Thanks,
Cléo
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org