Sign in to follow this  

Texture dimensions in DirectX 9

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

I had a quick question. I want to be able to make games for a wide range of machines with my game engine in progress, and I was wondering if I can load textures that are larger than 256x256 without fear of it not being supported on certain machines. In other words, if I use textures larger than 256x256, will my game not run on some computers? Thanks!

Share this post


Link to post
Share on other sites
This question comes up occasionally, and I really wonder why, considering that cards limited to 256x256 have IIRC last been sold in the year 2000, i.e., 8 years now. Can you tell me where you got the idea that 256x256 would be a limitation?

Share this post


Link to post
Share on other sites
Quote:
Original post by ET3D
This question comes up occasionally, and I really wonder why, considering that cards limited to 256x256 have IIRC last been sold in the year 2000, i.e., 8 years now. Can you tell me where you got the idea that 256x256 would be a limitation?
Doesn't the DX9 spec say that the minimum required texture size is 256x256? So to be 100% correct you should always check for support when creating textures larger than that.
Personally, I do this anyway - it's just adding a line or two of code to your startup checks.

Share this post


Link to post
Share on other sites
You can load any size texture you want with D3DXCreateTextureFromFile(). It will automatically resize them if the hardware doesn't support textures of that size. The same goes for non square and non power of two textures.

That eliminates a lot of the testing you would otherwise need to do, but it can make things look ugly, especially 2D textures used as 2D sprites. However since any modern card will support decent sized textures I wouldn't worry too much about it - the chances are there will be performance and other problems if the hardware doesn't support big textures.

Share this post


Link to post
Share on other sites
Quote:
Original post by Adam_42
You can load any size texture you want with D3DXCreateTextureFromFile(). It will automatically resize them if the hardware doesn't support textures of that size. The same goes for non square and non power of two textures.

That eliminates a lot of the testing you would otherwise need to do, but it can make things look ugly, especially 2D textures used as 2D sprites. However since any modern card will support decent sized textures I wouldn't worry too much about it - the chances are there will be performance and other problems if the hardware doesn't support big textures.
What happens if you try to load a 8192x8192 texture on a card that only supports up to 2048x2048? Does D3DX only load the top 2048x2048 of it, or does it downsize the whole thing to 2048x2048 (I don't have an SDK to test here)?

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by Adam_42
You can load any size texture you want with D3DXCreateTextureFromFile(). It will automatically resize them if the hardware doesn't support textures of that size. The same goes for non square and non power of two textures.

That eliminates a lot of the testing you would otherwise need to do, but it can make things look ugly, especially 2D textures used as 2D sprites. However since any modern card will support decent sized textures I wouldn't worry too much about it - the chances are there will be performance and other problems if the hardware doesn't support big textures.
What happens if you try to load a 8192x8192 texture on a card that only supports up to 2048x2048? Does D3DX only load the top 2048x2048 of it, or does it downsize the whole thing to 2048x2048 (I don't have an SDK to test here)?


In general D3DX scale to the target size.

Share this post


Link to post
Share on other sites
Quote:
Original post by Demirug
In general D3DX scale to the target size.
Not for np2 textures though - they load the image into the top left corner of the texture and fill the rest with black.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by Demirug
In general D3DX scale to the target size.
Not for np2 textures though - they load the image into the top left corner of the texture and fill the rest with black.

Only if you ask it nicely via a flag, otherwise it stretches it and makes it ugly.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by Demirug
In general D3DX scale to the target size.
Not for np2 textures though - they load the image into the top left corner of the texture and fill the rest with black.


No I'm 99% sure it will upscale the image, at least under default settings.

Share this post


Link to post
Share on other sites
Quote:
Original post by MJP
Quote:
Original post by Evil Steve
Quote:
Original post by Demirug
In general D3DX scale to the target size.
Not for np2 textures though - they load the image into the top left corner of the texture and fill the rest with black.


No I'm 99% sure it will upscale the image, at least under default settings.


why not 100%!

Share this post


Link to post
Share on other sites

This topic is 3337 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this