Posted on 2011-09-02
I'm learning XNA 4.0 at the moment. I'm having an issue with performance already. I created a cube class, that renders perfectly. Then I created a class that creates an 3 dimensional array of said cubes. When I run the game, I see the cubes. Problem is performance. I notice that the game is drawing cubes, that the camera can't see.
My question is how can I determine if my TriangleStrips that I use to create the cube is within the camera's view?
By asking this question I realized that, my problem is two fold. I am Drawing my cubes using 3 nested for loops. So, I'm drawing them based upon my for loops, and not from closest to my camera, outward, so I guess even a function that determined if the TriangleStrip is in fact viewable by my camera, it was only for that instance, until the next cube that would have blocked the view of that cube, was rendered.