What level of abstraction should have an opengl game engine? How it should be structured?

You should only see 1% or less OpenGL code. Few OpenGL code is good OpenGL code…
You should be file input dependant. You should have many independent subsystem (where you would see logical differences: Sound system, Window System, Particel System, Camera Spline system) etc. Don’t design the game to be hard coded, don’t hardcode windows in it, make it all customizable. Use your own ASSERT (which can help quite a lot), make some variables changeable from within engine (for artists), use easy scriptes where possible. This way you don’t need as many run-see the error-quite-change code-compile-rerun steps.

Well, after thinking about it, it should be far less than 1%…

Hi Mik!

You say there should be far less tahn 1% of OpenGL Code in it… but somwhere, there must be the calls to OpenGL? Do you mean they shsould be encapsulated, e.g. in C++ Classes?

Well, I rather meant calls to OpenGL like glDrawArrays and all that array stuff, that do much with less function overhead. Optimize your input data to the max and use simple OpenGL calls which can be optimized best.


the best it should be that the rendering core of the engine to be independent of the 3D library you use (OpenGl or DirectX). Ideally it is to be OS independant (the source) but is pretty hard.


So why bother about DirectX (Direct 3D for instance) if you want to be platform independent? However I saw an DirectX “emulator” for linux…