Jump to content
  • Advertisement
Sign in to follow this  
lordimmortal2

Drawing Overlapped Sprites

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

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.

Share this post


Link to post
Share on other sites
Advertisement
Which functions are you using to draw?
DrawPrimitive ?

Are you using any Dx9 wrappers or just raw directx?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

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?[/quote]

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...[/quote]

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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!