Bitmap to texture question

From: Chris Hastings (chrshstngs_at_comcast.net)
Date: 10/06/04


Date: Wed, 6 Oct 2004 00:44:49 -0500

Hi,
I was looking for a way to shrink/stretch a bitmap to fit in a texture. My
problem is that I have some bitmaps that are not square and powers of two,
and so on graphics cards that don't support non powers of 2 or squares, I
have to adjust my texture size when I create it and then the bitmaps don't
fit into the texture. I know I can transform a surface or a texture with
relative ease, but I can't get the texture right to start with. Is there an
easy way to do that?

Thanks!
Chris

If you understood that question, then you can ignore this example, but when
I reread it, it didn't seem all that clear.
I have a bitmap that is 256x192. I want to load that into a texture using
either New Texture or TextureLoader.FromStream.
On some graphics cards, I will get a DX exception because the texture can
only be square and powers of 2, so I set my texture to be 256 x 256 (or in
come cases DirectX does). However, the bitmap is only 192 tall, so there is
a black area on the bottom of the texture, and when I render it I get that.
To get around this for now, I've made most of my bitmaps square powers of 2,
and I also handled a specific one that wasn't by transforming it on
rendering. But, I'd prefer to transform it on the load instead if that is
possible.

Thanks again!
Chris