PDA

View Full Version : Non-POW2 textures



NitroGL
07-16-2002, 01:21 PM
Ok, I was reading the spec for the NV_texture_rectangle extension, and it says that you have to use a clamp mode (no repeat), and no mipmapping. What is the point of this extension?

Why not just use the glTexSubImage2D trick, you still can't use repeat, and at least you can get mipmapping.

Not to rag on nVidia, but I don't really seen the point of the extension...

knackered
07-16-2002, 01:35 PM
Saves texture memory. Say you're subimaging the contents of a non-pow2 sized window into a texture - your texture would have to be significantly bigger than the window...this extension means it doesn't. Not sure why texture coordinates have to be in actual image dimensions, though (I haven't thought the reasoning through).

NitroGL
07-16-2002, 02:05 PM
lol, I forgot about that (been using a 64MB card too long http://www.opengl.org/discussion_boards/ubb/smile.gif)

[This message has been edited by NitroGL (edited 07-16-2002).]

Zeno
07-16-2002, 02:27 PM
Trust me, a 64 MB card is no solution for running out of texture memory. 128 is only a marginal improvement.

Anyway, I too am curious why they chose to use non-normalized texture coordinates for rectangular textures. Anyone know?

-- Zeno

Korval
07-16-2002, 04:18 PM
Anyway, I too am curious why they chose to use non-normalized texture coordinates for rectangular textures. Anyone know?

It's probably something that anyone who knows can't talk about. I would guess, however, that it could be that the way they implement rectangular textures is with some odd hardware hack. One of the limitations of the specific hack may simply be that one can not utilize normalized texture coordinates.

cass
07-16-2002, 06:46 PM
One thing to remember is that render-to-texture will usually be faster when rendering to a texture rectangle.

As for the unnormalized coordinates, there have been some numerical arguments made that I have never found extremely compelling one way or the other. I will say that this indexing scheme will turn out to be handy in the future. http://www.opengl.org/discussion_boards/ubb/smile.gif

Cass

knackered
07-16-2002, 10:51 PM
Think of a texture as a 'lookup table' (or maybe, a framebuffer), eh cass? http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by knackered (edited 07-17-2002).]

Bob
07-17-2002, 02:07 AM
NV_texture_rectangle can be good for rendering fonts for example. No mipmaps or repeating needed there.

V-man
07-17-2002, 11:51 AM
Originally posted by cass:

As for the unnormalized coordinates, there have been some numerical arguments made that I have never found extremely compelling one way or the other. I will say that this indexing scheme will turn out to be handy in the future. http://www.opengl.org/discussion_boards/ubb/smile.gif

Cass




Tex coordinates can be scaled easily, but why the weird restrictions like no mipmaping, clamp only and I think no anisotropic filtering either.

Besides, to prevent waste, tile textures!

V-man

Korval
07-17-2002, 12:14 PM
Well, the no-mipmapping restriction is obvious: if I have a 201x201 texture, what is the next mipmap size? 100 or 101? Not only that, mipmaping works great and fast as-is because it is dividing numbers that are powers of 2 by 2 each time; this is just a bit-shift. Dividing a real float by 2 is a more expensive operation. The lack of anisotropic stems from the lack of mipmapping, most likely.

As for clamp-only, that is also a fairly reasonable restriction. Having to wrap denormalized texture coordinates may not be a simple task with nVidia hardware. The registers that know the width/height of the texture may not be easily/quickly accessible in the wrapping logic, since wrapping is done in normalized texcoords.

davepermen
07-17-2002, 12:28 PM
anysotropic filtering works i thought.. and once again, its mostly for rendering onto a fullscreenquad, bind this again as texture and rerender it onto screen with some image post processing. and for this you need only a bilinear filter, if at all.. (yes sure you can need more depending on what you do, but for the simple tasks..)

PaulJacobs
07-17-2002, 12:35 PM
Originally posted by NitroGL:
Ok, I was reading the spec for the NV_texture_rectangle extension, and it says that you have to use a clamp mode (no repeat), and no mipmapping. What is the point of this extension?

Why not just use the glTexSubImage2D trick, you still can't use repeat, and at least you can get mipmapping.

Not to rag on nVidia, but I don't really seen the point of the extension...

It's handy for things like creating shadow maps that are matched to odd window sizes...

Moshe Nissim
07-17-2002, 08:37 PM
Originally posted by Korval:

As for clamp-only, that is also a fairly reasonable restriction. Having to wrap denormalized texture coordinates may not be a simple task with nVidia hardware. The registers that know the width/height of the texture may not be easily/quickly accessible in the wrapping logic, since wrapping is done in normalized texcoords.

I think the reason is much simpler. Doing a modulo x where x is a power of 2 is just bit masking. Doing it where x is general needs division...



[This message has been edited by Moshe Nissim (edited 07-17-2002).]

V-man
07-18-2002, 05:46 PM
Wouldn't it be possible to turn the textures into power of 2 internally if it's a question of performance.

This extension would be much more interesting if it solved the old "must be power of 2" problem with no restrictions

Anyway, I'm sure nvidia considered things and had to make restrictions. Too bad ...

V-man

[This message has been edited by V-man (edited 07-18-2002).]

Won
07-18-2002, 10:22 PM
I would guess that one difference between normal textures and rectangle textures is that rectangle textures aren't swizzled so, (in general) have worse texel coherence. The cases of render to texture, and using the texture so that it's orientation matches the screen would be notable exceptions.

I suppose it would be easy enough to test if this were so. Then again, I don't work for a company that makes PC video graphics boards, so I'm not necessarily clued in on the nitty-gritty internal workings.

-Won