PDA

View Full Version : Any performsnce hits for GL_TEXTURE_RECTANGLE_ARB and Non power of 2 textures ?



glBomb
04-30-2007, 12:17 PM
Hi,
I am designing a 2D game like Age of Empires.I was advised to use GL_TEXTURE_RECTANGLE_ARB for avoiding the 0...1 texture co-ord range.

1. i would like to know if there are any performance hits with using this

2.Is it widely supported in most comps today?

3.Will it also allow me to use Non power of 2 image sizes

Zengar
04-30-2007, 02:04 PM
Today I did some testing on my card (GF7900GS) and found out that NPOT textures (TEXTURE_2D but not POT) are actually 1-2% faster then the ARB_texture_rectangle ones. I wouldn't call that a performance hit :) It is aviable for cards like Geforce FX and up and also for ATi cards with recent drivers, but I am not sure which Radeons do offer support it.

Also, there is no real reason to avoid the 0..1 coords range, while it is true, tha only few cards support real NPOT textures.

Hope it helps...

Korval
04-30-2007, 03:06 PM
I was advised to use GL_TEXTURE_RECTANGLE_ARB for avoiding the 0...1 texture co-ord range.No, that was a piece of advice for avoiding it.


1. i would like to know if there are any performance hits with using thisYes. Perhaps.

On cards that actually natively have the concept (ie, anything nVidia makes), then there can be a performance penalty. On cards that emulate the functionality (ie, by using a regular texture and modifying the shader to convert the texture coordinate range back to [0,1]), then the only penalty is in the conversion, which should be fairly negligable.

In either case, I would strongly suggest not bothering with texture rectangles simply because you don't like using the [0,1] texture coordinate range.

zed
05-01-2007, 01:10 AM
note gffx doesnt support non power of 2 textures.
ill get around to testing the speed soon (tommorrow morning prolly)

zed
05-01-2007, 01:47 AM
sooner than i expected (timings arent 100% accurate, music playing in background) but good enuf
(25 iterations btw on nvidia 7600gs)

(with texture_rect using texcoords of 1024x? thus visually the same as 0..1 for texture_2d)

GL_TEXTURE_RECTANGLE_ARB 1024x1024 36.7 GL_TEXTURE_RECTANGLE_ARB 1024x1023 36.6
GL_TEXTURE_RECTANGLE_ARB 1024x1020 36.5
GL_TEXTURE_2D 1024x1024 40.6
GL_TEXTURE_2D 1024x1023 36.4 npot
GL_TEXTURE_2D 1024x1020 36.5 npot