billboards performance problems

I’m looking for techniques to optimize the rendering of my billboards. I have a few thousand trees on a heightmap (the engine is 3D but fixed at an isometric angle and a very low FOV; the trees are sorted by depth for alpha-blending).

Here’s my routine for drawing an object:

glRotatef(-camera->pitch,0.0f,1.0f,0.0f); /* anti-tilt on y-axis /
glRotatef(-camera->yaw, 1.0f,0.0f,0.0f); /
anti-tilt on x-axis */

So the first thing I did was stuffing the billboard graphics into as few textures as possible. This seemed to help a bit.
The next thing I tried was replacing the glBegin/glEnd part with an vertex array (I just learned how to do that)


Though that turned out to be actually slower than the glBegin. Needless to say I’m not so proficient in OpenGL and now I’m stumped. How could I possibly speed this up?

Also I wanted to state that most of the billboards are kinda small, say the sprites for vegetation such as grass patches and bushes are not more than 32x32 pixels in size.
So I would say it is not a fillrate problem but more the overhead of setting up every object. I see in modern games like Battlefield 2 there’s a hell of a lot of grass on the terrain and in that game a patch of grass is even more complex geometry not just a simple sprite.

By the way I already do clip the objects against the screen but even if you zoom in on the terrain there’s still a few hundred objects in total.

For things such as grass, you could create a small 3D texture, and then repeat it alot.
This way you don’t have to render every single blade of grass.

I will try that. Though I’d be interested in any other options considering that my billboards are used not only for vegetation but also for other (animated) game objects with more complex sprites.

I’m reading up on how to use point sprites but seeing it’s not available on older cards I still should have a better fallback.

if glRotate* and glScale* don’t have to be called(in exampe, when the variable camera->pitch, camera->yaw are 0.0), then don’t call them, because these things require some calculations that can seriously slow things down.