• Advertisement
Sign in to follow this  

i need faster triangle feeding

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

it is a very simple game that oversophisticates things, i render a lot of tiles and each of these tiles has its own texture, one layer of multitexture and color how would it be the best way to optimize rendering these tiles, i render approx 300 QUADS, all quads have just 4 vertices and i have to switch texture state for each of these, how could i speed-up rendering these? could VBO-s improve performance even if used for just 4 vertices at once?

Share this post


Link to post
Share on other sites
Advertisement
do you need to switch a texture *state* or the texture itself? are you binding a different texture for each quad?

Share this post


Link to post
Share on other sites
For that few polys, and that many textures your greatest speed increase will almost certainly come from sorting by texture. Other than that just make sure you're actually using vertex arrays and not immediate mode (although I doubt you'd actually notice a difference with 300 quads).

Share this post


Link to post
Share on other sites
Agreed, for such a light weight program I would simply sort your scene by texture. That's going to give you the most noticable speed boost. Using VBO's and other optimizations like that are going to give you a negligible speed bump at this point, and may even slow you down, since they tend to be optimized for much more complicated scenes.

A few other really simple things that may speed you up:

-If you're drawing over every pixles on the screen each frame (no black void) then consider not clearing the color buffer, only the depth and stencil (if needed.) It's a pretty light weight method, but I've noticed a decent difference when switching it off.
-Are you doing an isometric/top down tile game? If so, it may be possible to switch off depth testing/writing by simply drawing the tiles back to front. Again, pretty light weight stuff, but it does help.
-Make sure that you're only switching states when you need to. A lot of beginners will do something like this:

for(...)
{
glBegin();
///Draw draw draw
glEnd();
}

when it's faster to do it like this:

glBegin();
for(...)
{
//Draw draw draw
}
glEnd();

That's kind of an extreme case, but the same applies for just about anything: if it's redundant don't do it!

Good luck!

Share this post


Link to post
Share on other sites
If your textures are small enough you can tile them all into one larger texture, bind that texture and then offset into the texture map via the texture coords.

This will enable you to use VBOs as well as avoid having to constantly bind many textures.

Share this post


Link to post
Share on other sites
thanx for the answers first, now i see i have to describe
the project a little more deeper:

it already doesn't clearing any buffers and i don't use depth buffer
because i draw the world in layers, it is a arcade game.

the city map that i render is a voxel-like wonder for which i have to
transform into 3d geometry at real-time, it works quite fast, the
only thing that i can speed-up is the rendering, i can store triangle
data in a buffer, but how could i sort / reorder these in real-time?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement