Skip to content

Commit

Permalink
From Colin McDonald, "Upgrading to OpenSceneGraph 3.0.1, texture mip …
Browse files Browse the repository at this point in the history
…mapping stopped

working on some junk low-end graphics cards which I still have to
support.  They worked ok with osg 2.8 and earlier.

The problem turned out to be with gl proxy textures, which are
unreliable on those devices.  Proxy textures are used by the glu
mipmap build routines to determine if a texture size is
supported. The external glu library had a nice fallback
behaviour, so that if proxy textures didn't work then the mipmap
texture was still created.  But in the work on the new embedded
glu routines that fallback behaviour has been inadvertently
lost.  I have restored the fallback in
src/osg/glu/libutil/mipmap.cpp.  It doesn't add any extra
complexity."
  • Loading branch information
robertosfield committed Feb 10, 2012
1 parent 5fbba08 commit 059dedb
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/osg/glu/libutil/mipmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3492,35 +3492,36 @@ static void closestFit(GLenum target, GLint width, GLint height,
* that we will never be aware of when this happens
* since it will silently branch out.
*/
*newWidth= 0;
*newHeight= 0;
return;
break;
}
widthPowerOf2= widthAtLevelOne;
heightPowerOf2= heightAtLevelOne;
}
/* else it does fit */
} while (proxyWidth == 0);
/* loop must terminate! */

/* return the width & height at level 0 that fits */
*newWidth= widthPowerOf2;
*newHeight= heightPowerOf2;
if ( proxyWidth > 0 )
{
*newWidth= widthPowerOf2;
*newHeight= heightPowerOf2;
/*printf("Proxy Textures\n");*/
return;
}
} /* if gluCheckExtension() */
else
#endif // end of #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
{ /* no texture extension, so do this instead */
GLint maxsize;

glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
/* clamp user's texture sizes to maximum sizes, if necessary */
*newWidth = nearestPower(width);
if (*newWidth > maxsize) *newWidth = maxsize;
*newHeight = nearestPower(height);
if (*newHeight > maxsize) *newHeight = maxsize;

/* no texture extension, or proxy textures not working, so do this instead */

GLint maxsize;

glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
/* clamp user's texture sizes to maximum sizes, if necessary */
*newWidth = nearestPower(width);
if (*newWidth > maxsize) *newWidth = maxsize;
*newHeight = nearestPower(height);
if (*newHeight > maxsize) *newHeight = maxsize;
/*printf("NO proxy textures\n");*/
}
} /* closestFit() */

GLint GLAPIENTRY
Expand Down

0 comments on commit 059dedb

Please sign in to comment.