Jump to content
  • Advertisement
Sign in to follow this  
PumpkinPieman

Coming back to the Direct 3D side of DX.

This topic is 4803 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

It's been a while since I've been working with the D3D side of DX because that was the first thing I played with when making my engine. Now, I'm planning to add and improve certain features of my code in sprite rendering and animation. Since the majority of my game ideas involve 2D concepts I'm sticking to a sprite based engine for now, but what is really getting me is ID3DXSPRITE. It's not that it's bad; it's that I feel like I don't have enough flexibility with it. It seems on the whole way to basic for what I want to do, so keeping that thought I've been thinking about writing my own sprite interface. Now what's getting me is what got me when I started with direct x, sorting and optimization. I know now that I should just make a rough draft and improve it as I find out more, but I'm kind of hoping that I can get some answers before I start. It's going to work much like ID3DXSPRITE, you lock the sprite interface, draw the sprites then unlock. But my question is, how are these sorted? How are they displayed based on the sort?

Share this post


Link to post
Share on other sites
Advertisement
I'm not quite sure I follow your questions.

The sprites are sorted based on the flags you specify when you call Begin(), by texture, by depth etc. if you mean what sorting algorithm would Microsoft have implemented to sort them, well, I don't know. It's quite possible that they maintain a sorted list because as you add sprites to the batch (i.e. call Draw()) it can know where to insert them into the list.

I do not understand your question about how they are displayed based on the sort - could you rephrase it / be more specific?

-Mezz

Share this post


Link to post
Share on other sites
I think you actually answered my question, I forgot about those flags. What about render states, if I change the renderstate mid way through the calls will it just disregard them?

Share this post


Link to post
Share on other sites
If you mean changing render states between Begin() and End() calls, I think the state change will take effect, but remember that it's not until End() sprites will actually be drawn, so if you change state a bunch of times only the last one set will probably have an effect (not really sure though, not tried it).

-Mezz

Share this post


Link to post
Share on other sites
Quote:
Original post by Mezz
If you mean changing render states between Begin() and End() calls, I think the state change will take effect, but remember that it's not until End() sprites will actually be drawn, so if you change state a bunch of times only the last one set will probably have an effect (not really sure though, not tried it).

-Mezz


Small correction, you can also call the Flush method to draw the pending sprites. This way you can change a state, draw some sprites, flush, then change states again and repeat.

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!