Bitmap to texture question
Date: Wed, 6 Oct 2004 00:44:49 -0500
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?
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
- Re: Multitexturing problem on the Mac/Ubuntu Linux
... int sizeX; ... // Routine to read a bitmap file. ... void loadExternalTextures() ... // Create texture index array and load external textures. ...
- Re: Direct Draw to Direct3D for 2d ?
... sprites on the screen using a texture and sprite. ... the Texture from a file and I have to map it directly from code. ... I create the texture using a 300 x 300 bitmap. ... >> For those of us trying to port apps that require writing pixel data ...
- Re: Translucent billboards
... If I just used the first stage, the transparent areas showed up transparent ... When I instigate the second stage, the whole bitmap becomes translucent ... D3DTA_TFACTOR seemed to overwrite all the alpha values throughout the whole ... I thought that I could set the texture of the second stage to the original ...
- Re: Tiling several textures on one model
... Thank you so much for the advice. ... it appears that I have to break up the bitmap (and hence the ... It's a 2 unit sphere because that's the size of the x file mesh I was ... using a single 256x256 test texture, though I am aware I'm going to ...
- Re: Texture.FromBitmap is slow runing from debugger
... it harldy uses any cpu exept when its loading a texture from bitmap ... but from the debugger even in release mode it takes a second or so ... to load a 65k texture, with a 2ghz pc this is 10k instructions per pixel! ... Where is the data in the Bitmap located? ...