View Full Version : Bitmap Woes
07-26-2003, 02:47 PM
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?
07-26-2003, 06:41 PM
You can use the GL_NV_texture_rectangle extenison, but it's only for nVidia cards.
07-26-2003, 07:32 PM
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.
07-26-2003, 09:19 PM
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).]
07-27-2003, 01:49 AM
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 http://www.opengl.org/discussion_boards/ubb/wink.gif
[This message has been edited by kehziah (edited 07-27-2003).]
07-27-2003, 10:15 AM
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.
07-27-2003, 01:46 PM
This is one of the reasons I prefer TGA http://www.opengl.org/discussion_boards/ubb/smile.gif
If you want to support more image formats, DevIL (http://openil.sourceforge.net/) can solve most of these problems for you.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.