I am designing a rendering engine that I can use to render using OpenGL,
Direct3D or (Win32) Glide. At the moment I am trying to design an
architecture where I can have a common interface between by game engine
code and then use either one of the rendering solutions.
So my initial idea is to take construct a list of triangles that make up
my scene, the textures they use, the cameras used (ie support for more
than 1 player), the lights in the scene, and amy other global effects eg
maybe fog levels.
I need to design the kind of structure I want to use that could be
processed by either one of my renderers as efficiently as possible..
Obviously with OpenGL using this approach will require quite a few
OpenGl State Machine changes eg (glEnable calls) for the different
triangles in the scene.
What I wanted to know was... what is the performance hit of constantly
changing GL rendering States... do I want to keep these changes to a
minimum by cleverly grouping (nice sort algorithm) similar triangles
together (despite possibly being in quite different parts of the scene).
Any comments would be appreciated.