0

I'm developing an Android game using Java, and I am currently on trying to figure out an efficient way of rendering the necessary textures. Suppose you have a Grid, similar to a Checkers board layout, and Tiles to fill that grid, as in each square on the board. That is the concept of what will be displayed. Currently, I am drawing each tile one by one. All of the texture loading is done upon creation and is only done once, not upon drawing. Now, for what I want to do. I've noticed that drawing all one by one, although fast for what I'm doing, it can be glitchy. In my game, the user has the ability to drag the "board" to view different areas. As of right now, I'm only allowing the necessary tiles to be drawn depending on the location of the top left visible tile. As I said, it works quite fast, but, once the user starts interacting more or dragging faster, the rendering starts to have difficulties and isn't as fast as it should be. This causes little separation in between the tiles. It's not large, just large enough to be noticeable. What I want to do is to basically place each texture in a certain location as defined by the grid, thus creating a new texture containing the viewable area, and then render that entire area as opposed to render each tile separately. I've done a lot of research and already looked at many questions, but I still have not found something that will help my cause. I've read that rendering to texture using a framebuffer may help, but I haven't found any easy-to-follow tutorials or examples, just a lot "here's the code, no explanation" or "here's something similar to what you want, but it's using different things." So, if someone could point me towards a good tutorial/example, or post a valuable answer, I would be very grateful. I'm avoiding OpenGL ES 2.0 because I want my game to be compatible with many devices, and for what I'm doing, 2.0 is not necessary.

For a quick summary of what my code does for further explanation:

for(go through visible rows){
   for(go through visible columns){
      drawTile(); //Does the texture binding and drawing for each tile
   }
}

What I want:

for(go through visible rows){
   for(go through visible columns){
      loadTileTextureIntoGridTexture();
      //I want it to combine the textures into one texture
   }
}

drawGridTexture();

Doing it the second way will only have one whole texture to render as opposed to visibleRows*visibleColumns textures to render.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Jason
  • 109
  • 4
  • It's obviously your choice, but you may want to be aware that according to data provided by Google (https://developer.android.com/about/dashboards), only 0.1% of all devices in use do not support ES 2.0. If you follow the man pages link on the Khronos web page (http://www.khronos.org/opengles/sdk/docs/), there's no direct link to ES 1.1 anymore. The content is of course still there if you navigate some more, but it's still a sign. In my personal opinion, ES 1.1 is an obsolete API. – Reto Koradi Jun 28 '14 at 15:56
  • Thanks for the info! I haven't found that anywhere, but now I might switch over to ES 2.0. – Jason Jun 28 '14 at 18:35

0 Answers0