Archived

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

D3DX Sprite

This topic is 5965 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 been messing around with D3DXSprites, and I can''t get them to show up on the screen. There''s a few things I don''t understand about them: 1. Color. What''s this argument for? WHy should I need a color for drawing a bitmap? 2. Location. How do I control where the Sprite::Draw function draws the sprite. Does it start out in the origin, and then get translated by what ever vector you plug in to it? 3. Transparency. How do you give the sprite transparency? Not like alpha blending... I want a fully transparent color. thanks, -Forcas
"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."

Share this post


Link to post
Share on other sites
Since the recent advice of some people here, I''ve been looking into doing 2D using D3D.

One of the GameDev articles (http://www.gamedev.net/reference/articles/article1434.asp) talks of building 2D engine using D3D without D3DXSprite. I''ve also read the Gamasutra article on wrapping D3DXSprite.

What are the pros and cons of them? In a long run, is it better to bother building your own 2D engine using bare-bone D3D rather than relying on D3DXSprite? I understand that D3DXSprite provides a built-in shortcut overall, but I''m wondering if someone here could weigh those two methods and share your thoughts on what one should do, and what YOU would do.

I''m quite comfortable about having to learn new things. I tend to prefer to know how everything works inside out. I just want to do what is "better" in a long run. I don''t mind spending longer time climbing up steeper learning curve now, if I were to do that later anyway.

Any thoughts on this will be appreciated.

Share this post


Link to post
Share on other sites
I''m using ID3DXSprite and it is working well enough for me. Wrap it in your own class and if you later find a performance problem you just rewrite it one place. But I think it is plenty fast by itself.

Jack

Share this post


Link to post
Share on other sites
It''s not so much a matter of which is better. I haven''t run side by side tests, but I''m guessing they''re pretty much the same.

However, I''m guessing that over time you may want to incorporate more and more effects. In that case, it''s better to open things up. In this case, the wheel is so easy to reinvent, you might as well...

I know this is farther out than what most people are doing, but at the xGDC I hope to talk about how to do 3D lighting effects with 2D scenes using some pixel shader techniques, motion blur with vertex shaders, and things like that. Any of those tricks require finer grained control over the sprite.

Share this post


Link to post
Share on other sites
When I said better, I had meant more along the line of "better as a method"... rather than better in terms of performance. But I guess performance is one issue. Isn''t D3DXSprite limited in anyway, in a long run? or is it the same as any raw-D3D 2D engine anyone would write, such that one might just as well use D3DXSprite in the first place instead of "wasting" time doing it yourself?

Share this post


Link to post
Share on other sites
Torn Space,
I''m glad u found my wrapper useful I''m suprised you achieved more frame rates out of it! How did u do it? If u could send me the updated wrapper to NSZeroOne@Hotmail.com I''ll upload it on my site, thanks.

Forcas,
1) The color arg lets u set the Alpha and RGB values of the blit.

2) It starts from the center, which is a problem if u are doing DDraw type blits that start from the top-left corner. D/L my wrapper if u havent done so already to get the code for the translation conversion.

3) Set the color key when u load the texture, though I dont think the colorkey can be changed after the texture has been created.



  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites