Advertisement

Import a 200x300 texture?

Started by April 27, 2002 06:38 AM
7 comments, last by Touchscreen 22 years, 10 months ago
Hi. Is there a trick? When i try to import a 200x300 texture (glaux / other units) it fails. (My Quad is still white) I''m coding in Delphi but i think in VC it''s the same. But why.
It could be anything,... but most video=cards only support power-of-2 textures ( 64x64, 128x128, etc )

------------
"You know you''re cool when you use MacGuyver as a verb..." <--- press here
--------<a href="http://www.icarusindie.com/rpc>Reverse Pop Culture
Advertisement
Don''t use textures bigger than 256x256! Some (and most) video cards don''t suport textures bigger than that.
you can use textures with dimesion not power of 2 only with mipmapping. (or if you manualy resize it before you upload it to video card)

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

you can use textures with dimesion not power of 2 only with mipmapping


Not even mipmapping can use non power of two textures. If you think that gluBuild2DMipmaps can take a non power of two image, you are right, but they are resized to a power of two before uploaded to OpenGL as a texture.
Brother Bob: I know that. I used the wrong words. You can load texture wizh size that is not power of two. they will be rescaled to the next 2^n and used like that.

circuit : Most cards DO support textures bigger that 256x256 (just about everything form TNT on (except Voodoo3))

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Advertisement
gluBuild2DMipmaps does take textures of any size.
DarkWing...
You should never let your fears become the boundaries of your dreams.


Totally awesome thought!
CheerZ.
In case you have NO OTHER option but to import odd sized textures, then make sure your loading code allocates the next power of two for the dimensions and then fill in the actual picture from the file. Of course, you''d have to write the loader code to skip the blank part of each line after one row from the picture on disk.

____________________
| | |
| Actual | |
| picture | |
|_____________| |
| |
| Blank |
| Area |
|____________________|

Then calculate the new tex coords using this formula

New_u := New_Width * old_u/Old_Width;
New_v := New_Width * old_v/Old_Height;

This works for the engine I wrote a while ago....to load the weird sized Q2 skins.
(^-^)

This topic is closed to new replies.

Advertisement