I wrote a simple bitmap loader for potential use with textures, and it works fine for the most part (if code is necessary I can provide it). However, it only seems to be able to handle bitmaps whose widths are powers of two. This wouldn’t be so much of a problem if I weren’t writing a program that asks the user to provide a bitmap. Any suggestions?
You can use the GL_NV_texture_rectangle extenison, but it’s only for nVidia cards.
Use the gluBuild2DMipmaps function in the glu library. Normal glTexImage2D will require textures to be powers of two. The glu function will resize the input texture for you.
The textures aren’t the problem. The textures work fine. The problem is the way the bitmap is loaded. I even tried it in a console program to test it and it’s still skewed.
EDIT: With a bit of experimentation, I found out the problem, but not the solution. The bitmap has to fit into an even byte. Which means that it’s not power of 2 that matters, it’s multiple of 8. Is there any way to fix this?
[This message has been edited by Tokage (edited 07-26-2003).]
If you’re talking about Windows bitmaps, rows must be DWORD-aligned, and there is nothing you can do about it. Add padding bytes as needed.
EDIT : and skip padding bytes as needed when loading
[This message has been edited by kehziah (edited 07-27-2003).]
Yeah, that’s exactly what I did. I made it load the bitmap with the padding and memcpy() over to an array without padding and that seems to work just fine.
This is one of the reasons I prefer TGA
If you want to support more image formats, DevIL can solve most of these problems for you.