[osg-users] compressed textures (DDS) and texture rectangles

Robert Osfield robert.osfield at gmail.com
Sun Sep 2 11:22:22 PDT 2007


HI Sherman,

I can't think of any problem with doing this.  If it works great! And
please send in the changes so I can get it in OSG svn :-)

FYI, use of TextureRectangle is no longer required for modern graphics
cards as they all support non power of two textures, which
osg::Texture2D supports as well - its turned off by default due to
historical problems with determining whether the feature is hardware
accelerated or not, but you can enable by setting

   texture->setResizeNonPowerOfTwoHint(false);

NPOT works on Nvidia 6 series onwards, not sure about the NVidia equivilant.

Robert.


On 9/2/07, sherman wilcox <wilcox.sherman at gmail.com> wrote:
> OSG doesn't support compressed textures when using texture rectangles, does it?
> Earlier today I tried to load some DDS files using the
> osg::TextureRectangle....didn't work. Thought it was something I was
> doing wrong so I started digging and ran across this comment in
> texturerectangle.cpp:
>
> // UH: ignoring compressed for now.
>
> Yep, that was the first clue! Anyway, I hacked in a quick change, just
> not sure how robust it is. Here tis:
>
> *********old code************
>
>      // UH: ignoring compressed for now.
>      glTexImage2D(target, 0, _internalFormat,
>        image->s(), image->t(), 0,
>        (GLenum)image->getPixelFormat(),
>        (GLenum)image->getDataType(),
>        image->data() - dataMinusOffset + dataPlusOffset );
>
>
> *********new code************
>    if(isCompressedInternalFormat(_internalFormat) &&
> extensions->isCompressedTexImage2DSupported())
>    {
>      extensions->glCompressedTexImage2D(target, 0, _internalFormat,
>        image->s(), image->t(), 0,
>        image->getImageSizeInBytes(),
>        image->data() - dataMinusOffset + dataPlusOffset);
>    }
>    else
>    {
>      // UH: ignoring compressed for now.
>      glTexImage2D(target, 0, _internalFormat,
>        image->s(), image->t(), 0,
>        (GLenum)image->getPixelFormat(),
>        (GLenum)image->getDataType(),
>        image->data() - dataMinusOffset + dataPlusOffset );
>    }
>
> In my limited testing with DXT5 DDS files, this quick change appears
> to work. Admittedly, I didn't spend too much time on this, it's late
> and I'm tired. So, if anyone sees a problem or would simply like to
> offer suggestions...
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list