D3D--- a part of a texture... ;)
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...
Hiya,
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.
-ns-
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.
-ns-
Tnx.
Can anyone tell me some "Texture-Split"-Commands?
Or anything where I can see what you mean?
Tnx: C.Ruiz
Can anyone tell me some "Texture-Split"-Commands?
Or anything where I can see what you mean?
Tnx: C.Ruiz
If you are using directx 8
Create a texture, that contains all the images using
D3DXCreateTextureFromFileA
Create new blank textures containing the size of the sprites you want.
i.e using
D3DXCreateTexture
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.
i.e.
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
Create a texture, that contains all the images using
D3DXCreateTextureFromFileA
Create new blank textures containing the size of the sprites you want.
i.e using
D3DXCreateTexture
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.
i.e.
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement