Jump to content
  • Advertisement
Sign in to follow this  
Such1

DirectX 9 repeating sprites

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

Hey guys, I am working on my games GUI and I would like to know if there is a way to instead of resizing the texture, repeting it like we can do
in vertices drawing when we set the UV to more then 1.0f.

I know I can do a loop but I would like to know if there is an easier way.
My GUI will be generated from a texture that has the borders, corners and the middle of the window.

Or if you guys know a better way to do it I will be happy to listen it.

Share this post


Link to post
Share on other sites
Advertisement
The only way I know of to get texture tiling with Sprites is to implement your own textured quad drawing, i.e. looping or resize (change) the texture.

Share this post


Link to post
Share on other sites
One more thing. Is there a way determine some kind of z-buffer to sprites?? To improve performance I would like to set the pixel only once, but I can't find a way to do it without ordering the DrawSprite calls.
I have a window with several controls.
How can I draw the controls before the window in a way that they keep over the window?

Share this post


Link to post
Share on other sites
I'm not sure I understand your question. If you're refering to the Z-order, it is determined by the order the sprites are drawn.

Essentially, you should only have one ID3DXSprite in your entire application. Think of it as a sprite renderer, rather than an individual sprite.
Then you should only have a single Begin()..End() pair for all of your sprites. The order in which the drawing is done between the begin() and End() determines the z-order.

Share this post


Link to post
Share on other sites
But is there a way to change that order??Or to do what I want I will have to cut the parts that should stay behind and are drawed after? Cause that's not very easy to do

Share this post


Link to post
Share on other sites
Can you attach an image of the problem?

The z-order is determined by the order in which you render the sprites. The first one will be on the bottom and the next one would be on top of that, so on and so on. If you need the order to be dynamic you'll need to programically assign a draw order yourself with a list or some type of collection associated with your sprites. Normally you'd sort them so solid sprites are first and then transparent- layering them the way you want.

To recap:

Create a list of sprites.

Sort your objects from farthest to nearest.

Sort the objects from solid to transparent.

Render lists. Edited by DJTN

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!