I'm working with openGL ES 2.0 on Android and I've created a custom Quad class.
This allows me to make a sprite object like so:
Quad mySprite = new Quad(); mySprite.setSize(w,h); mySprite.setTexture(myTexture);
Then, I can draw it like so:
draw() method uses mySprite's internal x and y coordinates which are declared within the Quad Class.
I also have another method which allows me to draw the quad specifying other 'external' co-ordinates like so:
Now let's say that on one of the levels of my game, I have the need to draw 3 of these sprites at different positions and move them all independently of each other.
At the moment, I think I have 2 options, which are:
1) Create different quad's with the same texture and use them with their internal coordinates or....
2) Use the same object but hold an array of external coordinates and just draw it three times at different places.
My preferred option would be 1 because it's just cleaner to work with but clearly inefficient as I'm having to create multiple objects that are essentially the same (inefficient memory-wise?)
So is there a way of using just one version of the sprite? Maybe using clones or something along those lines so that I can just keep track of each clone's internal position and states rather than using external arrays?