Jump to content
  • Advertisement
Sign in to follow this  
diginerd

SOLVED - XNA - DrawableGameComponent questions

This topic is 3147 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 working on a game for school and I'm currently trying to add a point sprite based particle system. I created the particle system and derived it from DrawableGameComponent, and when I went to draw the particles, they were drawing over everything in my scene, even my hud stuff which is drawn last. My question is, how can I control when my particles are drawn if they derive from DrawableGameComponent? If I understand correctly, DrawableGameComponent automatically does updating and drawing for you. So when does this updating and drawing happen? I tried not deriving from DrawableGameComponent and instead used my graphics engine's GraphicDevice to draw the particles, but they wouldn't draw at all. Any ideas? Thanks. Diginerd [Edited by - diginerd on February 7, 2010 11:41:01 AM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
I tried not deriving from DrawableGameComponent and instead used my graphics engine's GraphicDevice to draw the particles, but they wouldn't draw at all.


Did you call this particle drawing code from your game's Draw()?

Share this post


Link to post
Share on other sites
Yep, I sure did and nothing. Obviously my update/Render code is correct or it wouldn't have drawn, even deriving from DrawableGameComponent, so I have no idea.

Share this post


Link to post
Share on other sites
Ok, so I got them rendering. I wasn't using the correct GraphicsDevice. The problem I'm having now is that they're still drawing on top of my scenery (not drawing over HUD anymore). The depth buffer is on for comparing and it's off for writing. Am I missing some other renderstate?

Share this post


Link to post
Share on other sites
I was being dumb. My post-processing pass was covering it up because the particles aren't drawn into the render target I use in post-processing. I have a new problem. When in my render loop should I handle particles? For example, I have an outline post-process effect and I obviously don't want the particles getting outlined, but I can't draw the particles after the post-process because then I can't do depth testing and they'll always draw on top. Any ideas?

Share this post


Link to post
Share on other sites
Why won't you be able to do depth testing after the post process? Does your post process (need to) write to the depth buffer? If not, it should still be intact and usable after the post process.

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!