Jump to content
  • Advertisement


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


D3D--- a part of a texture... ;)

This topic is 6016 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 out there! I''m currently programming my code from my game from DirectDraw to Direct3D!!!! Baeeeehhhhhhhhh!!!!!!! ok... I want to draw a animation for example. I have already a bitmap in width who has 64 pics. And my DD pro draws a part and so it seems like a animation or a move for example. But now in D3D... I''ve seen in a samplegame that the programmer has put a lot of pics made and then sayd he should draw pic1.bmp or pic2.bmp for example for a single animation. But then i should cut out the bitmap and....... oh dear.... Solutions?? I would be very glad... Tnx to all you out there: C.Ruiz P.S.: Is my english better? hoping...

Share this post

Link to post
Share on other sites

Well, you can do that, cut it into 64 seperate bitmaps, load them all into individual textures, and just draw with a different texture each time to animate.

You can also use a single texture kind of like you''ve done in your DirectDraw program. Instead of sending a different rectangle to the blt function, you change the texture coordinates of the vertices each frame.
The only problem with this is that there are size limits on textures (often 1024 or 2048 pixels. Earlier 3d cards were limited to 256 pixels), as well as aspect limits (but that''s only a problem if you save the bitmaps as "strips" instead of a square made from rows of strips.)

Finally, you can always keep it as a single .bmp file, and write your own bmp load routine that splits it up into seperate textures. This can be a fair amount of work, but it also has a lot of side benefits.


Share this post

Link to post
Share on other sites

Can anyone tell me some "Texture-Split"-Commands?
Or anything where I can see what you mean?
Tnx: C.Ruiz

Share this post

Link to post
Share on other sites
If you are using directx 8

Create a texture, that contains all the images using


Create new blank textures containing the size of the sprites you want.
i.e using


Use the Direct3DDevice function CopyRects to copy the images from the main texture source into the new sprites,

Once you have done all this delete the initial texture and use the sprite textures as required.


Texture1 (From File) 3 * (60*60)images

[ ] [ ] [ ]

Texture2 (create blank 60*60)
Use copyrect to copy first image from Texture2 to this texture

Repeat for Last two sprites

Delete Texture1

Share this post

Link to post
Share on other sites

  • 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!