Jump to content
  • Advertisement
Sign in to follow this  
smallfry

OpenGL speeding up 3d tile map

This topic is 3034 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 haven't done much more in OpenGL than immediate mode and display lists. I've made a little engine that draws a 3-dimensional tile-based map, each tile is a 3-dimensional shape. Right now, I go through all the tiles in the map, then render every triangle in the shape in immediate mode. It's too slow! I was thinking of making every tile shape a display list, but: Here's the twist, each tile shape can have animated textures, so their textures are constantly changing every second. I'm not sure of what I can do to speed things up. Display Lists won't work because the textures are always changing. I've been reading up on VBOs but I'm unsure of if or how they can help. Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
How are your animated textures set up? Do you just have them stored in separate textures, and then change the texture that is bound when you want to change to the next frame? Or do you have all of the animations for a single tile packed into a single texture like a spritesheet?

I'll recommend not to bother with display list as its depreciated. You should be able to use VBOs for this, but please explain how you are storing/accessing/changing all of these textures so that I can give an appropriate answer.

Share this post


Link to post
Share on other sites
Thanks for the reply. I'm animating by cycling through different textures. I suppose I could change it around so that I use a spritesheet if it makes things easier.

Share this post


Link to post
Share on other sites
Switching textures is a relatively more expensive operation than just indexing a different point in a spritesheet. You may want to pack as many different objects/animations into a single texture as you can, and then sort the draws to minimize texture switching.

VBO's will help performance by reducing the number of vertices, but if you have to keep switching textures for every tile its going to be slow. Try to reduce texture switches as much as possible, and try to pack as many vertices into a single vbo without needing a texture switch.

If you're still having perf problems then I can try to think of some more things to do, but that all depends on exactly where your bottlenecks are, depending on resolution, how many tiles you're drawing, etc.

Share this post


Link to post
Share on other sites
You could also be culling out tiles that aren't visible (if you aren't already).

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!