Creating a DrawableGameComponent

Posted by Christian Frantz on Game Development See other posts from Game Development or by Christian Frantz
Published on 2013-07-02T20:30:26Z Indexed on 2013/07/02 23:19 UTC
Read the original article Hit count: 221

Filed under:
|

If I'm going to draw cubes effectively, I need to get rid of the numerous amounts of draw calls I have and what has been suggested is that I create a "mesh" of my cubes. I already have them being stored in a single vertex buffer, but the issue lies in my draw method where I am still looping through every cube in order to draw them. I thought this was necessary as each cube will have a set position, but it lowers the frame rate incredibly. What's the easiest way to go about this? I have a class CubeChunk that inherits Microsoft.Stuff.DrawableGameComponent, but I don't know what comes next. I suppose I could just use the chunk of cubes created in my cube class, but that would just keep me going in circles and drawing each cube individually.

The goal here is to create a draw method that draws my chunk as a whole, and to not draw individual cubes as I've been doing.

© Game Development or respective owner

Related posts about XNA

Related posts about c#