Quote Originally Posted by hwnd View Post
I would like to make it even more smaller.
And was thinking about only use unique vertex coords. Many blocks that need same vertex, is pointed to one vertex, so one vertex is not duplicated for each block that needs it.

And also use glDrawElements, and maybe even interleaved arrays.
Drawelements is in core from v1.1, so shouldnt be a problem on old hardware.
That is the standard way to render all models, to reuse same vertex indices if possible. I'm not sure if this is helpful at all, but here is code generation for cube, plane, sphere and torus models with face indices, each with segment parameters:
https://code.google.com/p/nxpascal/s...Model.pas#1733

I don't understand how the TRSI demo works, OpenGL shouldn't be able to handle that kind of vertex record
Code:
  TVertex = record
    { Position }
    Pos: Integer;
    { Normal }
    Nrm: Integer;
    { Texture coords }
    u, v: Single;
  end;
Index for position, normal and textures is always the same, you can't customize it. This seems more like a "guideline" structure to build real array later that OpenGL will then use. I'm trying to keep away from having 2 instances of model arrays in memory, and only have that which OpenGL uses.

A cube for example cannot share all the 8 vertices it has. Because in the corner points there are 3 different variations of normals and texture coordinates. So the amount of vertex/normal/uv-indices that cube has, is 6 faces * 4 vertex_per_quad = 24. That would be drawn with either 6 quads, or 12 triangles. And no, vertex indices will not speed up rendering, it will be as fast as vertexarrays using the coordinates directly. But you can save some memory with indices, especially with models that have smooth triangle-connections such as sphere. That's 1 of the sweet cases where all the vertices can be linked together.