Advertisement

strange gluBuild2DMipmaps problem

Started by March 13, 2004 11:45 AM
5 comments, last by MIT_Service 20 years, 11 months ago
Hi I have a strange problem with gluBuild2DMipmaps. I am generating procedural textures. Due to some limitations I can''t rely on them being a power of 2. So I am using gluBuild2DMipmaps to initialize them. The problem is: if the width or height is not a multiple of 4 the texture looks totally warped and the colors are wrong. Got any hint what might cause this?
show some code

"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA
Advertisement
As far as i know a texture MUST be a power of 2 (so, it is always a multiple of 4 except for 2x2).
it doesnt have to be a power of 2
unless that is the only kind that your vid card supports


"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA
Where can i see if a specific card supports it (instead of testing it at that card)?
gluBuild2DMipmaps() accepts non-power-of-two textures, and resizes them for you. It always resizes to powers of two.

If specific sizes don''t work, then it''s either:

1) a bug in gluBuild2DMipmaps()
2) a bug in your program that generates the textures
or
3) a configuration error (such as the various UNPACK settings for PixelStore)

You could save the bitmap to disk as a TGA right before you pass it to gluBuild2DMipmaps(), and then look at that image file to make sure it''s OK. If that file''s OK, then the problem is 1) or 3).

Note that the GLU mip map generation is REALLY SLOW.
enum Bool { True, False, FileNotFound };
Advertisement
Damn, I wrote some test code and realized that I have an error in the code that swaps the rows of the image. (I need to do that because I''m loading images with SDL and the order of the rows is different there)

Guess I have to take a closer look.
Thnx anyway!

This topic is closed to new replies.

Advertisement