Archived

This topic is now archived and is closed to further replies.

TerraX

Power of 2??? (Simple answer:)

Recommended Posts

TerraX    180
A quik question ............. OpenGL textures have to be to the power of 2...... BUT... what does that mean? TerraX<---Fik I know textures have to be 16x16, 128x128, 512x128 etc But What I''m asking is, what exactly does "The power of" mean? A simple math question I know, but I#ve forgotten!!!

Share this post


Link to post
Share on other sites
GKW    200
2^0 = 1
2^1 = 2
2^2 = 2 * 2 = 4
2^3 = 2 * 2 * 2 = 8
2^4 = 2 * 2 * 2 * 2 = 16
2^5 = 2 * 2 * 2 * 2 * 2 = 32

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

Share this post


Link to post
Share on other sites
TerraX    180
Cheerz GKW, I knew the answer really, I was just testing ya!!!

The reasone I asked is because, in a forum somewhere, someone asked how to display 800x600 textures without wasting space and using 1024x1024 ones, someone replied to this with something like this.....

"You can use textures to the power of 2, try using 804 x 512 as these dimensions are to the power of 2"

Not the exact wording, but the 804 part was definatly correct and that''s why I got confused

Was this person that was replying drunk? Or what!?

Share this post


Link to post
Share on other sites
Dragonus    122
Well, 804 is definitely not a power of 2 (unless you count 9.651015 to be a valid power ). However, you don''t have to use powers of 2 if you mipmap the image. I don''t remember the tut number of NeHe''s that does that, but mipmapping kills the restriction of images having to be 2^n x 2^m for some integers n and m.

~ Dragonus

Share this post


Link to post
Share on other sites