Jump to content
  • Advertisement
Sign in to follow this  
utilae

D3D7 tilesets and textures

This topic is 5063 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, I've decided to move from directdraw7 to direct3D7. In direct draw I was able to load a bitmap image full of tiles onto a tileset surface. Each tile would then be indexed (in an array), so I could use the rect location of the tile on the tileset surface and just blt that tile to the target surface. Now with direct3d I have to create a texture surface which would hold the tile and use the texture with some vertices and draw primitive to draw the tile. The problem is that I can only have a texture of max size 256x256. My tileset is 397x2014. I can't load that as one texture. Also using uv coordinates to get an exact rect area of the texture seems like it would be inaccurate compared to being able to specify pixel level rect areas (like in direct draw), any good ways of getting around this? I was wondering how other people handle this problem? Also is it a good idea to just have an array of textures, where each texture is one tile of the tiles size? Would this be slow (it would be done on load) and would it take up too much memory, etc? Reply as soon as possible, thanks.

Share this post


Link to post
Share on other sites
Advertisement
If you are going to make the transition from DD7 to D3D7, why not just jump right to D3D9? The newer D3DX library has a new ID3DXSprite interface that makes sprite rendering (with textures of any size) easy. Also, I know that D3D9 is significantly easier than D3D7. Plus, there are tons of more resources on it (some tutorials here). If you want to persue the D3D9 route, you should be up and running in no time at all [smile].

Share this post


Link to post
Share on other sites
Quote:
The problem is that I can only have a texture of max size 256x256.


Where does that limitation come from? Do you have a Voodoo 3 graphics card or something?

Anyway, I would second the recommendation to go with DirectX9 if you can. It's much better.

Share this post


Link to post
Share on other sites
@circlesoft
I'll check out direct x9

@hplus0603
After posting that, I soon discovered that it depends on the graphics card (i got that information out of an old book).


Anyway, I would like some opinions for the following question of mine:
"Is it a good idea to just have an array of textures, where each texture is one tile of the tiles size? Would this be slow (it would be done on load) and would it take up too much memory, etc?"

Share this post


Link to post
Share on other sites
An array of textures would work, and would probably not be too slow for a 2D game on modern hardware with modern CPUs.

You might want to load each tile-set on a different texture, i e "jungle level backgrounds" would go in one texture, and "player ship variations" would go in another texture, to have an easier time of organizing everything.

Especially background tiles really should be a single texture, because then you can generate efficient vertex buffers to draw the entire background. But, it probably won't be too slow even without that batching.

Share this post


Link to post
Share on other sites
256*256 textures are recommended but not mandatory since Voodoo class hardware (very old). Now its common to get 1024*1024 textures.

Now, the video cards try to adjust any image dimension to a power of two texture, so your 397x2014 texture will become a 512*2048 texture. It would be better if you:
a. Redimension your texture.
b. Reorganize your sprites in many textures (no real need to have only one).

Luck!
Guimo

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!