I am writing a 3D game using GL10, but I would like the application to support GL11 or GL20, if available. What is the best design to support all 3? Or is it a crazy errand, and I just have to focus on supporting one version?
My current idea is to split the render () function into renderGL10, renderGL11, renderGL20 and call the appropriate rendering function based on the available GL instance. Within each rendering function, there is a proper rendering method for the GL version; there will probably be overlap for GL10 and GL11. Is this a suitable way to solve my problem or is there a better way?
public render(){
if (Gdx.graphics.isGL20Available()){
renderGL20();
} else if (Gdx.graphics.isGL11Available()){
renderGL11();
} else {
renderGL10();
}
}
EDIT:
. gl1.x, gl10 ( Gdx.gl10 ). , :
public render(){
// Use Gdx.gl for any gl calls common to all versions
if (Gdx.graphics.isGL20Available()){
// Use Gdx.GL20 for all gl calls
} else {
if (Gdx.graphics.isGL11Available()){
// Use Gdx.gl11 for any gl11 call not supported by gl10
}
// Use Gdx.gl10 for all gl calls
}
}