Hi Guy,

The GL_TEXTURE_RECTANGLE extension is independent of the NPOT support
in standard GL_TEXTURE_2D that is found in OpenGL 2.0 onwards, so just
because your hardware lacks support for the later, it doesn't mean
that texture rectangle extension is not supported.

Robert.

On Fri, Dec 4, 2009 at 2:37 PM, Guy Volckaert <[email protected]> wrote:
> Unfortunately, my graphic crad does not support NPOT texture which is why I 
> can't use osg::TextureRectangle.
>
> I also tried ensuring that my Texture2D is always a POT when I change the 
> windows size (see code below).
>
>
> Code:
>
>            int32 nWitdh = viewport->width();
>            int32 nHeight = viewport->height();
>
>            int32 nPOTWidth = ComputeUpperPowerOfTwo( nWidth );
>            int32 nPOTHeight = ComputeUpperPowerOfTwo( nHeight );
>            if( nPOTWidth != pTex2D->getTextureWidth( ) || nPOTHeight != 
> pTex2D->getTextureHeight( ) )
>            {
>                pTex2D->dirtyTextureObject( );
>                pTex2D->setTextureSize( nPOTWidth, nPOTHeight );
>            }
>            else
>            {
>                bDirtyTexture = false;
>            }
>
>            u = double( nWidth ) / nPOTWidth;
>            v = double( nHeight ) / nPOTHeight;
>
>
>
>
> However that does not work. The Texture2D::copyTexImage2D() eventually gets 
> called, but fails to call copyTexSubImage2D() since the width/height passes 
> as paramater do not equal the texture width/height.
>
>
> Code:
>
>        if (width==(int)_textureWidth && height==(int)_textureHeight)
>        {
>            // we have a valid texture object which is the right size
>            // so lets play clever and use copyTexSubImage2D instead.
>            // this allows use to reuse the texture object and avoid
>            // expensive memory allocations.
>            copyTexSubImage2D(state,0 ,0, x, y, width, height);
>            return;
>        }
>
>
>
>
> Near the end of the Texture2D::copyTexImage2D() function, it simply copies 
> the viewport size (width/height) into the texture 
> _textureWidth/_textureHeight and thus it becomes a NPOT texture - hense the 
> problem I am experiencing.
>
>
> Guy
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=20896#20896
>
>
>
>
>
> _______________________________________________
> 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