Main.SideBar (edit) |
Main /
TriangleStripsGL_TRIANGLE_STRIP would basically speed up rendering, so I tried several times to use them instead of the usual GL_TRIANGLES which boson uses atm. There are several problems that come up when using triangle strips. The first one that came to my mind was backface culling. backface culling (see man glCullFace for more info) is possible with triangle strips, but more diffcult. And not all algorithms out there care about backface culling (all that I could implement successfully with our data did not). IIRC to make backface culling work correctly you need to insert both sides of the faces into the strip in a certain order - look at docs in the web that explain this part. But that's definitely a more difficult job, so disabling backface culling for development is a good idea. Another problem that will come up in _all_ cases is that you cannot (at all) get flat surfaces with triangle strips. You need to provide exactly one normal for all vertices i.e. for all faces in the strip exactly one normal (the firs face is of course an exception). So for all meshes that need to be flat you cannot use strips anyway. Last but not least there was one reason for why i never completed any algorithm that creates triangle strips. It simply doesn't work on most meshes of our models. Most of them simply cannot turned into a triangle strip. Think e.g. about a simple box with 6 sides (i.e. 12 triangles). There is no way to make a single triangle strip out of it. You can insert "dummy" vertices which create faces with 2 equal vertices (which is never rendered) to fix this, but we have _many_ similar situations in boson. Therefore we would have to add many dummy vertices (and the code to add them isn't absolutely trivial) but that reduces the advantage of triangle strips. Another idea was to to create triangle strips for all meshes (at least those that use the same texture) and then connecting the strips (using dummy vertices mentioned above). But here an even greater problem comes up: animations. In order to support animations we need to provide separate matrices for every mesh and these matrices can differ in every frame. So we cannot render the meshes in the same glBegin()/glEnd() call at all. We would have fork the meshes for every frame in which the matrices change, but that would add a _huge_ memory overhead. Huge as in "unacceptable huge". So as a result:
|