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

Texture dimensions?

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

Assuming a valid pointer to IDirect3DTexture9* called ptexture, you can use this:
pTexture->GetLevelDesc(0, &desc);

desc.Width, desc.Height, etc.

Share this post

Link to post
Share on other sites
Hmm, one addendum...

Be careful: There are times when you won''t be able to load a texture outright. Best example is that some cards can''t handle texture sizes above 256x256 pixels. Or those that can''t handle non-power-of-two sized textures...

You shouldn''t happen on this problem on a well-planned-for game, but if you''re making an utility for random ''textures'', well you might want to load the file in memory and get the texture size from there, BEFORE actually building the texture.

Or if you''d rather, load the file in a surface (not a texture) located in system memory (not on the video card) then you know that the hardware won''t limit your BMP sizes, I use this technique for full-screen images. (Creating several small textures from that memory surface, hehehe)

=^.^= Leaders and teachers should remember: It is best to offer others what they Need, not what they Want.

Share this post

Link to post
Share on other sites