Jump to content

  • Log In with Google      Sign In   
  • Create Account


Drawing Overlapped 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 lordimmortal2   Members   -  Reputation: 127

Like
1Likes
Like

Posted 11 September 2012 - 02:12 PM

I'm currently working with DirectX 9 (specifically the 2D portion of it) and would like to draw sprites in front of each other in a particular order.
I have tried drawing sprites from bottom to top and also using the Z coordinate of the draw function, but still nothing.

I'm probably missing something simple, but anyway you can do it with DX9 would be appreciated. Thanks for reading and any replies.
Prove me wrong so I can know what's right.

Sponsor:

#2 yewbie   GDNet+   -  Reputation: 665

Like
0Likes
Like

Posted 12 September 2012 - 11:05 AM

Which functions are you using to draw?
DrawPrimitive ?

Are you using any Dx9 wrappers or just raw directx?

#3 BCullis   Crossbones+   -  Reputation: 1799

Like
0Likes
Like

Posted 12 September 2012 - 12:08 PM

but still nothing

Please elaborate on what "nothing" means: none of the sprites show up, or their order is incorrect?

Can you get a single sprite to show up?
Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too

#4 SuperVGA   Members   -  Reputation: 1117

Like
0Likes
Like

Posted 12 September 2012 - 12:27 PM

If you disable reading/checking the depth buffer, and draw your sprites far-to-near, you're doing what you intend to. I would also like to know what you mean by "nothing"

And, not to nitpick, but there really is no "2D portion of DX9". It typically depends on the projection matrix how things are displayed, though. I understand what you're saying...

#5 lordimmortal2   Members   -  Reputation: 127

Like
0Likes
Like

Posted 12 September 2012 - 07:03 PM

Which functions are you using to draw?
DrawPrimitive ?

Are you using any Dx9 wrappers or just raw directx?


There's always something I'm not clear enough on. This is specifically just a 2D game, and I'm using the sprite method of DirectX along with the draw function. I'm not drawing with textured quads.

As for if I'm using any DX9 wrappers or just raw DirectX, if I understand you correctly it's the latter. I've created everything besides the calls to the DX and Windows APIs.

Please elaborate on what "nothing" means: none of the sprites show up, or their order is incorrect?
Can you get a single sprite to show up?


I'm sorry that was really horribly worded. To elaborate - I can get things to draw, and sometimes they draw in the correct order but other times they don't. Right now, just for test purposes I have a background sprite draw behind all the GUI elements I need to draw for the main menu, but when I try to draw my options menu within the actual game, it gets drawn behind everything else. I'm drawing everything in the order of bottom to top, from the main menu to the game.

Specifically what I'm looking for is just a simplistic list of what you're supposed to do to get this to work, ideally with the z-coordinate.

If you disable reading/checking the depth buffer, and draw your sprites far-to-near, you're doing what you intend to. I would also like to know what you mean by "nothing"
And, not to nitpick, but there really is no "2D portion of DX9". It typically depends on the projection matrix how things are displayed, though. I understand what you're saying...


Again, really horribly worded. I'm not using textured quads to render any of this stuff, just draw calls to a "LPD3DXSPRITE". And by "nothing" I meant "it's not doing what I want it to do, IE drawing things behind something I don't want it to." I need to work on my choice of words.
Prove me wrong so I can know what's right.

#6 BCullis   Crossbones+   -  Reputation: 1799

Like
0Likes
Like

Posted 13 September 2012 - 08:22 AM

Can you post the code that draws your sprite collection? It sounds like something else is going on aside from a simple back-to-front draw order. I'm curious what else happens during the render loop.
Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too

#7 yewbie   GDNet+   -  Reputation: 665

Like
0Likes
Like

Posted 13 September 2012 - 08:42 AM

Without seeing any code I would guess that maybe your Z might be getting casted to a whole number or something.

If you could provide your drawing function I am sure I could help.




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