Let me start with I am currently learning OpenGl-es using Android.
I have been having the hardest time trying to design a simple and logical way of making tiles (2d flat polygons). The tutorials tell me to just keep the polygon as a float
array of veticies:
private float vertices[] = {
-1.0f, 1.0f, 0.0f, // 0, Top Left
-1.0f, -1.0f, 0.0f, // 1, Bottom Left
1.0f, -1.0f, 0.0f, // 2, Bottom Right
1.0f, 1.0f, 0.0f, // 3, Top Right
};
That in and of itself is easy enough. I modified the code to suit my desired polygon and it drew fantastic. Now I wanted to draw more tiles and have a scrolling feature (look around the world). But I'm not sure what's the best way to do so.
Should I leave every tile with a float
array of indices and when it comes time to move the tile, directly modify thefloat
values?
Is it a good idea to create an ArrayOfPoints
(Point
just being a container for exactly 3 float
values) class to hold all of the points and then have methods that cycle through the points and change their values in a more safe fashion?
Does anyone have any tutorials on simple tile based map building so I can look at how they do their maps?
(Note: these questions are based on what I have read on animating. That is to say that you change the coordinates of the object in relation to the origin and leave the camera at 0,0,0
. If it is more proper to just leave objects where they are, I guess my question loses value.)