Hi Cleo,

There isn't any way I can determine what the problem from the information
given.  I can't rule out an OSG bug, but the only way to be able to find
this out would be to have a compilable application that reproduces the bug
so that I can test it first hand.  It could very easily be a bug in what
you doing, or simply be that a bug in 2.6.1 hid this problem.

The only oddity I can spot from a review is why you are assigning an Image
and subload callback, also the NO_DELETE on the Image, this means that the
OSG doesn't take any responsibility for deleting the data and it's entirely
down to your app.

You don't specify what you are trying to achieve so there is no way I can
say whether it's appropriate or not,

As things stand there is nothing we can do to help until we have a bit more
information about what you are tying to achieve, and a small example to
reproduce the problem.

Robert.


On 25 November 2014 at 18:11, Cleo Saulnier <[email protected]> wrote:

> 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
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to