I've done some searching on the net for an instancing extension and two seem to exist:
Right now we handle instancing with some kind of software emulation. Roughtly it works like this:
/* Non-instanced attribs are set as stream sources in opengl */ for(i = 0; i < num_instances; i++) { for(j = 0; i < instanced_attribs) { glVertexAttribfv(&instanced_attrib[j]) } glDrawElements(vertices per instance to draw); }
The problem that occurs here is that some vertex attribute type can't be set in the glVertexAttribfv calling loop. Most likely because I didn't figure out which gl call takes the precise argument. Should be easy to figure out.
The way we handle instancing is not instancing on the hardware side, but we don't have to apply all states again per instance. glDrawElements is cheaper than D3DDevice::DrawPrimitive, its d3d counterpart.
With ext_draw_instanced we can do d3d-style hardware instancing, but this extension is only supported on gf8800 cards(or used to be, at least)