• Advertisement

Archived

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

Bitmaps Annoy Me

This topic is 5323 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

Is there a way to load bitmaps whose widths aren''t powers of 2? This problem has been annoying me to no end and I really need to find a way. The user needs to supply an image, so resizing my bitmaps won''t cut it.

Share this post


Link to post
Share on other sites
Advertisement
i assume you mean for OpenGL or D3D. the problem is that graphics cards expect textures to be power-of-two sized, so you are stuck with it.

you can always load the bitmap into memory, and then resize it to a power-of-two, or load it into a power-of-two sized chunk of memory and adjust texture coordinates so the unused space around the image isn''t displayed.

Share this post


Link to post
Share on other sites
Actually, the problem exists whether or not I''m using an API. I made a console application that read off the bits and it was still skewed.

Share this post


Link to post
Share on other sites
Read the Sweet Snippets article on the front page.

your mom''s on my buddy list...

Mage

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Pad the data at the end of each row. The extra bytes are ignored.

BTW, the pitch (width of a row in bytes) has to be a multiple of 4 bytes, not 2 or 8.

[edited by - JohnBolton on July 27, 2003 4:01:15 AM]

Share this post


Link to post
Share on other sites

  • Advertisement