Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


DirectX 9 repeating sprites


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Such1   Members   -  Reputation: 435

Like
0Likes
Like

Posted 03 June 2012 - 06:14 PM

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.

Sponsor:

#2 DJTN   Members   -  Reputation: 207

Like
1Likes
Like

Posted 05 June 2012 - 09:38 AM

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.

#3 Such1   Members   -  Reputation: 435

Like
0Likes
Like

Posted 05 June 2012 - 12:37 PM

Ok, thanks, I guess I'll have to avoid that technique to conserve time.

#4 Such1   Members   -  Reputation: 435

Like
0Likes
Like

Posted 05 June 2012 - 03:00 PM

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?

#5 DJTN   Members   -  Reputation: 207

Like
0Likes
Like

Posted 05 June 2012 - 06:00 PM

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.

#6 Such1   Members   -  Reputation: 435

Like
0Likes
Like

Posted 05 June 2012 - 06:57 PM

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

#7 DJTN   Members   -  Reputation: 207

Like
0Likes
Like

Posted 06 June 2012 - 04:49 AM

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, 06 June 2012 - 04:55 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS