Archived

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

Fpu

D3DX

Recommended Posts

Fpu    122
Hi Anyone knows how to use the sprite interface properly? i always get a different size than the one i want also i dont know how to make the sprite transparent please help thanx

Share this post


Link to post
Share on other sites
Todd Geraty    122
Hi there,

I literally -just- went through this problem. If you go to this post, you''ll see a short discussion of it:

http://www.gamedev.net/community/forums/topic.asp?topic_id=42265

Basically, you have to make sure your texture is square and has a length & width a power of 2. Then, you can specify what part of the texture you want to extract, the location you want to put it, and the size of the sprite, all from the Sprite interface''s Draw method...

Thanks,
Todd

Share this post


Link to post
Share on other sites
Fpu    122
Thanks Todd

but i think in d3d (using quads to draw texture) width & height dont need to be a power of 2 right?

Share this post


Link to post
Share on other sites
DrunkenHyena    805
quote:
Original post by Fpu

Thanks Todd

but i think in d3d (using quads to draw texture) width & height dont need to be a power of 2 right?


G''day!

The texture needs to have width & height that are powers of 2. The quads don''t have to be though. If your textures aren''t they will be re-sized and that can be ugly.



Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
Todd Geraty    122
Ken''s right - it can be ugly. My background was done similarly, and was resized twice (once when loading the texture to fit it into a power of 2, and once when displaying by resizing it back down). It actually made the background really fuzzy. So I resized my background texture to fit into a power of 2 and then just displayed the portion I needed, and now it looks great.

And making the texture size a power of 2 also works just as well while using the sprite interface for all my game pieces.

Thanks,
Todd

Share this post


Link to post
Share on other sites
Fpu    122
btw
if you guys wanna do some transparency
i have found out how it work by using the function createtexturefromfileex()


cya

Share this post


Link to post
Share on other sites
Fpu    122
btw
if you guys wanna do some transparency
i have found out how it work by using the function createtexturefromfileex()


cya

Share this post


Link to post
Share on other sites