Currently I'm working using OpenGLES 2.0 in Android, and I'm struggling to develop a flexible programming architecture to dynamically handle different shaders and different objects.
As an example, I have two classes: SimpleShader and ImageShader.
To draw a SimpleShader, it needs to have an array of vertices specified:
SimpleShader s = new SimpleShader;
s.draw(final FloatBuffer pFloatBuffer);
Similarly, for an ImageShader, it needs both a set of points and a texture to draw:
ImageShader i = new ImageShader;
i.draw(final FloatBuffer pFloatBuffer, final Texture pTexture);
My question is this; SimpleShader and ImageShader are both types of Shader. I'm looking for some kind of design pattern which would allow me to use an abstract draw()
method. Can anyone make any recommendations? I'd imagine it has something to do with objects to draw inheriting a Shader-specific drawing interface?