PDA

View Full Version : GLSL and npot textures



lobbel
04-29-2010, 12:57 AM
Hello,
in some older post from 2005 I read that you have to use
sampler2DRect when handling with npot textures. Is this
still up to date or can I use sampler2D for npot in glsl ?
For the case I still have to use sampler2DRect, are these
texture coordinates normalized to -1,1 or 0,1 ?

regards,
lobbel

Y-tension
04-29-2010, 07:25 AM
Hey there!
Non power of two textures use sampler2D always, they just have non-power-of-two dimensions. Their coordinates are normalized to {0,1}.
Texture rectangles on the other hand are another fruit entirely. They use sampler2DRect and they can't be mipmapped.
In GLSL 1.10 there's only sampler2D. sampler2DRect is reserved but not used. sampler2Drect becomes relevant only in GLSL 1.40 or openGL 3.1. So if you use rectangles through older extensions with GLSL < 1.4 I guess sampler2D is fine.
Texture coordinates in texture rectangles are normalized to {0, w} {0,h} where w, h the integer width and height of the texture.

lobbel
04-30-2010, 05:46 AM
Thank you,
also figured it out writing a testshader.
It's just that I read on some other pages to use rects when
dealing with npot textures.
Whatever....

regards,
lobbel