Sign in to follow this  

Just wondering about tex resize?

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

Hi folks! im new around here this site is looking very cool and helpful! my name is aviv and i have a few questions about DirectX : when u about to make a 2d game for example which texture size do u need to use ? (32x32,64x64,128x128...) why using power 2 any way :)? becasue what happens when lets say i changed my res from 640x480 to a 1024x768? does directx handles the texture scaling ? do i need to supply a bitmap for every res ? or do i scale the tex myself ? :D

Share this post


Link to post
Share on other sites
1. Welcome to the site!

2. Power of 2 textures are a requirement on older video cards, I'm reasonably sure most DirectX9-capable cards can handle non-power of 2 textures.

3. When you're using direct3D, you won't need to supply different sized bitmaps. The GPU can scale your textures to arbitrary sizes. In fact you could choose one ideal resolution, create a surface of that size, render all of your sprites to that surface, and scale that surface to the back-buffer resolution chosen by the user.

Also I should add, if you want to do simple 2D work then you might want to start off with the built-in sprite functionality found in ID3DXSprite.

Share this post


Link to post
Share on other sites
hi MJP thx for the help!

few more question :

As i mention before i am trying to make a 2d(scrolling) game
like mario , anyway i did checked out the ID3DXSprite
i found that very helpful thx!,

1 .i just wanted to ask if it is necessary to hold an array for
the textures(tiles) of the sprites ?

2. do i need an array (or any other type)of sprite to hold any tile i load into ?

3. why using sprite over a texture ? beacuse textures i can also load and draw
onto a surface , what are the advantages or drawbacks to use each other ?

thx in advance!(sorry if im not that clear :D)

Share this post


Link to post
Share on other sites
Quote:
Original post by infernal

1 .i just wanted to ask if it is necessary to hold an array for
the textures(tiles) of the sprites ?

2. do i need an array (or any other type)of sprite to hold any tile i load into ?

3. why using sprite over a texture ? beacuse textures i can also load and draw
onto a surface , what are the advantages or drawbacks to use each other ?

thx in advance!(sorry if im not that clear :D)


For 1 and 2, you're going need to some sort of method of storing your individual textures for your sprites. Once you've loaded them they're your responsibility, so you'll need to use whatever storage container best suits your purpose. If an array or vector does the job, then go for it.

For 3, a sprite really is just a texture. The only difference is that a sprite is typically drawn using a flat quad that you manipulate in 2D space. The advantage of using the built-in ID3DXSprite interface is that it will handle creating the quads, and batching them for you. You will still load the textures just like you would for 3D work, and you can still draw the sprites to whatever surface you'd like. The downside to not creating your own sprite-drawing implementation is that you're limited to whatever ID3DXSprite can do. Honestly unless you need to use shaders or do something really fancy, ID3XSprite is usually adequate (and will be much easier for you to get running, if you're new to D3D).

Share this post


Link to post
Share on other sites

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