Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411520 Posts in 69380 Topics- by 58436 Members - Latest Member: GlitchyPSI

May 01, 2024, 03:03:48 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Power-of-two vs NPOT textures in OpenGL
Poll
Question: Do you use non-power-of-two textures?
Yes, I don't want to have to resize/preprocess images - 5 (13.9%)
No, I stick to powers of two to be safe - 23 (63.9%)
I do both - 6 (16.7%)
I don't understand what you're talking about - 2 (5.6%)
Total Voters: 30

Pages: [1]
Print
Author Topic: Power-of-two vs NPOT textures in OpenGL  (Read 5700 times)
Draknek
Level 6
*


"Alan Hazelden" for short


View Profile WWW
« on: March 30, 2010, 03:30:42 PM »

So I'm having a discussion about this on another forum.

I'm of the opinion that you should always use textures which are powers of two, because then you don't have to worry about it potentially not working.

The other person is saying that because NPOT textures should be supported everywhere, you should use them because they're more convenient and you don't need to do any texture coordinate manipulation.

BUT, in practice it appears that the convenient GL_ARB_texture_non_power_of_two extension (which would mean you can just use NPOT textures exactly as you would normally) is not guaranteed to be implemented (even though it's been part of the spec since 2004 or something). The GL_ARB_texture_rectangle extension is more widely available (to the point that you don't need to check for it?) but requires different code to use it.

I did a search and found two highly informative posts by Saint about this:
http://forums.tigsource.com/index.php?topic=2670.msg70163#msg70163
http://forums.tigsource.com/index.php?topic=2670.msg70163#msg70163
They go into a lot more detail than I have here.

So, does anyone have opinions? Advice?
« Last Edit: March 30, 2010, 03:54:14 PM by Draknek » Logged

zacaj
Level 3
***


void main()


View Profile WWW
« Reply #1 on: March 30, 2010, 04:32:26 PM »

The iphone doesnt support NPOT's, and neither does my brand new Radeon HD 5770 <- *surprised
Logged

My twitter: @zacaj_

Quote from: mcc
Well let's just take a look at this "getting started" page and see--
Quote
Download and install cmake
Noooooooo
increpare
Guest
« Reply #2 on: March 30, 2010, 04:44:24 PM »

I always stick to power of two.  Bad things historically have happened otherwise.  Not very technical response, I'm afraid.  HO-humm.
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #3 on: March 30, 2010, 05:05:55 PM »

I do the best of both worlds.  My image loading function includes a call to gluScaleImage to make the texture power of 2 when I load it.  Then the issue is pretty much irrelevant to me.
Logged



What would John Carmack do?
LemonScented
Level 7
**



View Profile
« Reply #4 on: March 30, 2010, 05:38:02 PM »

Even on platforms that support non power of two textures, I'm pretty sure that there's a performance hit for doing so. Given that, as a creator of games, you have complete control over the assets that go into them, it doesn't make much sense to not use power of two textures.
Logged

moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #5 on: March 30, 2010, 05:48:10 PM »

I ALWAYS use power of 2 textures, even when the engine doesn't need it (flixel for eaxmple), because I'm like that.
I remember a time when all you had was 8x8 characters for making your games and game making was more fun.
Logged

subsystems   subsystems   subsystems
mjau
Level 3
***



View Profile
« Reply #6 on: March 30, 2010, 06:59:50 PM »

i use power of two textures along with some texture packing code i wrote to pack multiple images into one texture with no distortion and with minimum waste of space.  (well, not technically minimum as i think that would require brute force, but close enough)
Logged
Saint
Level 3
***



View Profile WWW
« Reply #7 on: March 31, 2010, 12:16:54 AM »

We had some more discussions of the subject in this thread.

Considering the performance hit and the unreliability of NPOT textures (trying to use anything above GL 1.1 will still give you different results on different hardware, sadly), I try to stick to POT textures when possible. In order to facilitate a smoother workflow I usually assume ARB_TEXTURE_NON_POWER_OF_TWO on development machines and use a content compile step to assemble NPOT textures into POT texture atlases. We discussed this briefly in this thread  Smiley
Logged
Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #8 on: April 01, 2010, 01:36:00 AM »

I remember a time when all you had was 8x8 characters for making your games and game making was more fun.

Haha I love you moi.
Logged

slembcke
Level 3
***



View Profile WWW
« Reply #9 on: April 14, 2010, 07:59:23 AM »

We used rectangle textures for a lot of things in CrayonBall. For things that need to scale nicely we used POT textures so we could mipmap them.

As it turns out this was a terrible idea as cheap laptops from as little as a year or two ago did not support GL_ARB_TEXTURE_RECTANGLE! There are new netbooks that still don't support it either. This was a bit of a shock having ported Crayon Ball over from the Mac where even the low end hardware has supported rectangle textures since at least 2003. We figured that was something that we could count on. Undecided
Logged

Scott - Howling Moon Software Chipmunk Physics Library - A fast and lightweight 2D physics engine.
Glaiel-Gamer
Guest
« Reply #10 on: April 14, 2010, 09:12:25 AM »

my texture class:

contains the texture, and a crop box (x, y, width, height), then functions u() and v() which map [0, 1] to [x, x+width] (simple transformaton, float u(float x){return x*cropbox.x+cropbox.width;} )

non power of 2 textures get padded to be power of 2, and as long as i interface with the tetxure to get texture coordinates I'm fine.

that transformation could also be done on a shader if you don't want to do it on the cpu.
Logged
slembcke
Level 3
***



View Profile WWW
« Reply #11 on: April 25, 2010, 07:23:43 PM »

I just got a cheap Dell mini 10v last week that I hackintoshed and it has an integrated GMA 950 GPU in it. It seems the Intel/Win7 OpenGL drivers do not support rectangle textures, but the OS X drivers for the same GPU do. How awful is that? The hardware supports the feature but they just decided to cut corners with the driver and not implement features that nVidia and ATI have supported for years now. Worse still is that this is pretty much a brand new machine (albeit a very very low end one).
* slembcke shakes fist
Logged

Scott - Howling Moon Software Chipmunk Physics Library - A fast and lightweight 2D physics engine.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic