Only square textures?

I just found out that, when converting from a bitmap to a texture, directX appears to stretch the bitmap into a square.

This is a problem, because if I don't want my external images getting stretched out of shape when they're rendered to the screen, I have to add "empty space" to the bitmap files so that the bitmap is a square.

But I've been determining the size of an object on the screen based on the original bitmap that was loaded into it!

Isn't there a way I can make a texture out of a non-square bitmap, without the bitmap getting stretched




Answer this question

Only square textures?

  • Larsi

    Thanks for your input!

    I've also had success with overloads that allow you to specify height/width.



  • Alfonso1912

    i found that
    Texture t = new Texture( device, path ) will stretch the image to power of 2
    (32,32) (64,64) ect.


    But going
    Bitmap b = new Bitmap( path )
    Texture t = new Texture( device, b, usage, pool )
    b.Dispose()
    will not stretch the image.
    Tho using System.Drawing.Bitmap means you lose the ability to load .dds files i think :( but thats not to much of a problem

    note: i do all my mdx stuff with mdx 2.0, the above might apply to mdx 1.x not sure

  • Only square textures?