PDA

View Full Version : Detecting ability to texture with arbitrary sizes.



CRasterImage
10-31-2007, 09:44 AM
Is searching for "GL_ARB_texture_non_power_of_two" in the extensions info string the best way to determine whether or not a driver can handle textures of arbitrary pixel width and height?

Mark Shaxted
10-31-2007, 10:12 AM
Or check the version - 2.0 or greater supports non power of two textures.

Also, depending on your requirments, EXT_TEXTURE_RECTANGLE is a commonly supported extension.

CRasterImage
10-31-2007, 11:26 AM
Thanks for the 2.0 tip.

Next question: What about the dimentions of an FBO?

One of my test machines is an NVIDIA GeForce FX 5700 Ultra.

Which seems to support arbitrary dimentions. It doesn't mention "GL_ARB_texture_non_power_of_two" in the extensions list, but it's opengl version is 2.0.3. glTexImage2D() doesn't cause an error when the dimentions are not powers of 2.

However, when a non-power-of-2 texture is attached to an FBO via glFramebufferTexture2DEXT(), glCheckFramebufferStatusEXT() reports an error: GL_FRAMEBUFFER_UNSUPPORTED_EXT.

The FBO works fine with textures that are a power of 2. (other machines have no problem either way, it is just this card)

Cany anyone think of a way to check the extensions for that limitation?

CRasterImage
10-31-2007, 07:41 PM
Update: For now, I am determining whether or not an FBO can handle textures with dimensions that are not powers of 2 by writing my own test function.

A test function which... (get ready for it) attempts to attach a texture to an FBO, with dimensions that are not powers of 2.

If there is no other elegant way of determining it, then I will just go with that.

Since a lot of people around here seem to be using FBOs, I thought you all might want to know about this issue.

CRasterImage
10-31-2007, 10:42 PM
Ack!

One more problem:

I have another machine with a Radeon card that supports only OpenGL version 1.4 and it's extensions string does not mention power of 2 anywhere.

However, it is capable of working with arbitrary sized images.

So, it ends up hamstringing itself with inflated textures unnecessarily.

There has to be a well-established method for making this determination! What is it?

ZbuffeR
11-01-2007, 03:05 AM
Beware, in fact it is exposed as GL_ARB_texture_non_power_of_two (instead of GL_EXT_ ). And then there is the *_texture_rectangle extensions which are similar, and have better support on ATI cards.
what Radeon card is it precisely ?

http://delphi3d.net/hardware/extsupport.php?extension=GL_ARB_texture_rectangle
http://delphi3d.net/hardware/extsupport.php?extension=GL_EXT_texture_rectangle
http://delphi3d.net/hardware/extsupport.php?extension=GL_ARB_texture_non_power_ of_two

CRasterImage
11-01-2007, 09:32 AM
Unfortunately, texture rectangles do not support mipmapping.

How does everyone deal with this? Does everyone just use textures that are sized a power of two and leave it at that?