EFileTahi-A Posted May 26, 2005 Posted May 26, 2005 As you all know, when using a texture in Direct3D we must inform the texture's size when using it as a sprite in a form of a rectangle. What I need to know is how can I retrieve the picture's size which is being assigned to the texture object so that I can create the apropriate rectangle to display the correct texture aspect ratio. Like, if I load a 32x32 picture into a texture object I also need to inform the Sprite.Draw command that the texture is a 32x32 image. Pseucode: //Check the apropriate texture size to use if the original image's size which was loaded into the current texture is 32x32 sprite.draw(texture with size 32x32) else if image size is 128x128 sprite.draw(texture with size 128x128) (...) tks for any possible help on this one Quote
Roof Top Pew We Posted May 26, 2005 Posted May 26, 2005 When I load textures, I use the TextureLoader.FromFile method. The last argument I pass is a reference to an ImageInfo class. The ImageInfo gets filled, and you can look at its .Width and .Height values. Also, if you already have the texture loaded, you can do the following: SurfaceDescription sd = texture.GetLevelDescription(0); And look at ds.Width and ds.Height. --Vic-- http://www.flatredball.com Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.