Robert,

I tracked the problem down to where it is failing down in
Texture::mipmapAfterTexImage(), which ultimately gets called from the
call to applyTexImage2D_load() in Texure2D::apply().

void Texture::mipmapAfterTexImage(State& state, GenerateMipmapMode
beforeResult) const
{
    switch (beforeResult)
    {
    case GENERATE_MIPMAP:
        {
            unsigned int contextID = state.getContextID();
            TextureObject* textureObject = getTextureObject(contextID);
            if (textureObject)  <=== IS NULL
            {
                osg::FBOExtensions* fbo_ext =
osg::FBOExtensions::instance(contextID, true);
                fbo_ext->glGenerateMipmapEXT(textureObject->_target);
            }
        }
        break;
        o
        o
        o
}

The passed in value of beforeResult is GENERATE_MIPMAP.  The call to
getTextureObject(contextID) simply returns:

        /** Returns a pointer to the texture object for the current
context. */
        inline TextureObject* getTextureObject(unsigned int contextID)
const
        {
            return _textureObjectBuffer[contextID].get();
        }

Since r8606 moved the assignment of _textureObjectBuffer[contextID] to
*after* the call to applyTexImage2D_load() it's returning a NULL pointer
so the call to glGenerateMipmapEXT never occurs.  No error message is
displayed so we're none the wiser.

Considering that the assignment to _textureObjectBuffer[contextID] was
moved in order to avoid a crash, where should the assignment occur in
order to avoid crashes while still properly generating MipMaps?

-- Dan
 

> -----Original Message-----
> From: Gilbert, Daniel R. 
> Sent: Thursday, February 26, 2009 7:17 AM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] Problems with non-resized NPOT 
> texturesandtrilinear min filter
> 
> Robert,
> 
> Thanks for confirming that it isn't just me.  Well, at least 
> on machines
> with an Nvidia card.  Does anyone with an ATI card experience 
> this same
> issue with the samples I posted?
> 
> I'll try digging deeper as you suggest, though like I mentioned in my
> original post I was able to make it work simply by reverting the
> location of the _textureObjectBuffer assignment in 
> Texture2D.cpp back to
> where it was before r8606.
> 
> -- Dan
> 
> > -----Original Message-----
> > From: Robert Osfield [mailto:robert.osfi...@gmail.com] 
> > Sent: Thursday, February 26, 2009 12:58 AM
> > To: OpenSceneGraph Users
> > Subject: Re: [osg-users] Problems with non-resized NPOT 
> > textures andtrilinear min filter
> > 
> > Hi Dan,
> > 
> > On Wed, Feb 25, 2009 at 10:02 PM, Gilbert, Daniel R.
> > <daniel.r.gilb...@saic.com> wrote:
> > > Are others able to reproduce this same behavior using my 
> > attached sample?
> > 
> > Just tried the test models on my Kubuntu 8.10/Gefore8800GTS 
> > cards and I get:
> > 
> > npot_skydome_linear_noresize.osg   works.
> > npot_skydome_trilinear_noresize.osg fails.
> > npot_skydome_trilinear_resize.osg works.
> > 
> > I also don't get any OpenGL errors when
> > npot_skydome_trilinear_noresize.osg fails.
> > 
> > > Any thoughts on how to attempt a fix?
> > 
> > It could well be a driver issue, but also might be an OSG issue...
> > 
> > When you have a model without mipmaps you have to generate them,
> > either by using gluScaleImage or using the one of the two hardware
> > mipmap extension.  It'd be worth digging into osg::Texture/Texture2D
> > to see what code paths it's taking to ask for the mipmap generation.
> > 
> > Robert.
> > 
> > 
> 
> 
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to