Jump to content
  • Advertisement

Archived

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

Mkk

Textures which are not in power of 2

This topic is 5340 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I would like to use texture sized 46*23. How can I get it work properly?

Share this post


Link to post
Share on other sites
Advertisement
One way to do it is to pad the texture out to the next power of 2 in your case you''d pad it out to 64x32. Another way to do it is by resizing the texture to a power of two, if you look at the NeHe tutorial which goes over mipmapping it''ll show you how this can be done automatically. Yet another way to do is to use a GL extension such as GL_ARB_texture_non_power_of_two.

Share this post


Link to post
Share on other sites
After reading the specification for GL_ARB_texture_non_power_of_two it seems it''s rather easy to use, just check the extension string for ''GL_ARB_texture_non_power_of_two'' and if it''s there you can use a non power of 2 texture just like you would a normal texture. However I''m not sure of how fast a non power of 2 texure is compared to a power of 2 one.

Share this post


Link to post
Share on other sites
quote:
Original post by Monder
...if you look at the NeHe tutorial which goes over mipmapping it''ll show you how this can be done automatically.

Mimpapping does not scale textures to power of 2. The function NeHe uses is part of GLAux and should NEVER be used. Just resize textures to power of 2 and live with it. If you really think you can''t live without it use GL_ARB_texture_non_power_of_two but be prepared for performance loss.



You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
It is slower, there is a reason why you use power of two textures.
However most implementations of non power of two textures actuarly just resize or pads the texture on loading time, so it would be better if you did it yourself, since then you could add more details to the texture.

---------------------------------
For an overdose of l33tness, flashbang.nu

[edited by - lc_overlord on March 6, 2004 5:55:39 AM]

Share this post


Link to post
Share on other sites
quote:
Mimpapping does not scale textures to power of 2


I know but the function used in that particular tutorial does it for you, and the funtion used is a glu function not a glaux function. What's wrong with using it anyway?

[edited by - Monder on March 6, 2004 6:43:15 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Monder
I know but the function used in that particular tutorial does it for you, and the funtion used is a glu function not a glaux function. What''s wrong with using it anyway?


I forgot that the tutorials were updated.. it uses glu functions now. Its not wrong but just a bit unpractical. A better way is to use SGIS_MIPMAP extension to generate mipmaps.

glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );



You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
Hey, could someone explain me why it´s so that textures must be in power of two?

For now it just feels little strange that for example now I have 427x165 image and I have to put it in 512*256 just because it works that way.

So it would be nice to hear why it´s so.

[edited by - Mkk on March 7, 2004 3:25:06 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Mkk
Hey, could someone explain me why it´s so that textures must be in power of two?


You have to understand a bit about processor technology. Multiplying with power-of-2 is realized with bitshifts that are an order of magnitute faster (and simpler to build) than real multiplication.

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!