I am developing ana cross-platform game-engine with a friend, using C++, OpenGL ( 2 +and 4 ), and some other Low Levellow level API provided by the platform. So far we've finished window initalisation and some rendering stuff like model loading and model generation ( Heightmaps, Skyboxes ).
Recently the idea came up, how great it would be if thewe had an idea to adapt function definition adapt themselves at runtime. I meanFor example, e.g. Machine 1 provides only OpenGL 2,2; the engine will see itthat, and use only OpenGL 2 function,functions. Machine 2 provides OpenGl 4 as,as well, so the engine wilwill use OpenGL 4, instead.
Our problem with this is the implementation, and how should we should approach this? Ourit. On first thoughts werethought, we mightdecided to use functions pointerfunction pointers, but after trying for a bit, it led us into problems problems with the code. The code was unclean ( dirty ? ), hard to understand, and hard to both fix /and extend. The second approach we thought about was to replace the .DLL- ( Windows Windows) or .SO ( Linux Linux)- file ( oror hot swapping ). So far, we couldn'tcan not implement to worka working, stable build.
My question is, are there any similar, better aproaches to makeHow do we enable the engine change it selfswapping of function definitions, at runtime?
P.S.: Hopefully you understand what I am about