Sign in to follow this  

Slow programs

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

So, I've been working on a game for a while now, and something has been troubling me. My game involves drawing a lot of cubes, so, a lot of quads, but not an outrageous amount. If I were drawing every surface, then a fully-filled game map would draw 196608 quads per frame, so I used hidden surfaces, since the cubes were aligned to a grid, but that was still becoming slow as the map became more complex, so I switched from glBegin() to using VBOs, and I got some speed from that, but now I'm still seeing hitches when I update the game grid. I feel like I'm doing something wrong, because the computers that I'm testing this on can still run games like Team Fortress 2, albeit at low settings.

Share this post


Link to post
Share on other sites
Quote:
Original post by Cyndar
So, I've been working on a game for a while now, and something has been troubling me. My game involves drawing a lot of cubes, so, a lot of quads, but not an outrageous amount. If I were drawing every surface, then a fully-filled game map would draw 196608 quads per frame, so I used hidden surfaces, since the cubes were aligned to a grid, but that was still becoming slow as the map became more complex, so I switched from glBegin() to using VBOs, and I got some speed from that, but now I'm still seeing hitches when I update the game grid. I feel like I'm doing something wrong, because the computers that I'm testing this on can still run games like Team Fortress 2, albeit at low settings.


Are you doing something fairly expensive such as changing texture frequently or some other state change ? (If you for example bind a texture once for each quad or cube you draw things are gonna get alot slower than necessary)

Also, are the "hitches" only when you update the game grid ? , and if so, what exactly are you doing when you update it ? (Changing existing VBOs is expensive and should be avoided, use transformations and scaling to render the same vbo in different positions and sizes if needed)

Share this post


Link to post
Share on other sites
Sorry it took so long for me to answer.

I've optimized my program a lot, removed unnecessary state changes and the like, and I found out that my program is drawing at a more than acceptable speed. Now, I realize, the problem is updating. I switched from VBOs to regular Vertex Arrays, as the geometry is too dynamic, but I'm still getting hitches whenever I update. I've even restricted how much is being updated at once, about only one eighth of the scene (and only that which has changed) is updated per frame.

Share this post


Link to post
Share on other sites

This topic is 2791 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this