Is there any way I can effectively switch between 2 similar sets of functions (C / C ++)? To better explain what I mean, let's say I have two sets of global functions, such as:
void a_someCoolFunction();
void a_anotherCoolFunction(int withParameters);
…
void b_someCoolFunction();
void b_anotherCoolFunction(int withParameters);
…
And I want to "switch" in my program at run time, which is used. BUT: I do not want to have one if condition with each function, for example:
void inline someCoolFunction(){
if(someState = A_STATE){
a_someCoolFunction();
}else{
b_someCoolFunction();
}
}
Because I expect each function to be called a lot in my mainloop - so it would be preferable if I could do something like this (when starting my mainloop or when someState changes):
if(someState = A_STATE){
useFunctionsOfType = a;
}else{
useFunctionsOfType = b;
}
and then just call
useFunctionsOfType _someCoolFunction();
, , ... : , OpenGL ES 1.1 OpenGL ES 2.0, 2 (: renderOpenGL1() renderOpenGL2() render()). : glLoadIdentity(); myLoadIdentity();... - .
?