title: android OpenGL ES simple Tile generator performance problem
body: <p>following this question : <a href="https://stackoverflow.com/questions/2125354/best-approach-for-oldschool-2d-zelda-like-game">Best approach for oldschool 2D zelda-like game</a></p>
  
  <p>Thank to previous replies, and with a major inspiration from <a href="http://insanitydesign.com/wp/projects/nehe-android-ports/" rel="nofollow noreferrer">http://insanitydesign.com/wp/projects/nehe-android-ports/</a> , i started to build a simple Tile Generator for my simple 2D  zelda-like game project.</p>
  
  <p>I can now generate a map with the same textured tile, using 2 for(..) imbricated iterations to draw horizontal and vertical tiles, and got some basic DPAD key input listeners to scroll over the x and y axis.</p>
  
  <p>but now im running into my first performance problems, just with one texture and one model.</p>
  
  <p>When trying to build a 10x10 map, scrolling is fine and smooth.</p>
  
  <p>When trying with 50x50, things get worse, and with a 100x100, its way unacceptable.</p>
  
  <p>Is there a way only to tell OpenGL to render the 'visible' part of my mapset and ignore the hidden tiles? im a totally new to this.</p>
  
  <p>im using </p>
  
  <pre><code>GLU.gluLookAt(gl, cameraPosX, cameraPosY, 10.0f,cameraPosX, cameraPosY, 0.0f, 0.0f, 1.0f, 0.0f);
  </code></pre>
  
  <p>to set the camera and point of view for a 2D-style feeling.</p>
  
  <p>Any help ? :)</p>
  
  <pre><code>for (int j = 0; j &lt; 10; j++) {
  
          for (int i = 0; i &lt; 10; i++) {
  
              gl.glPushMatrix(); // Sauvegarde la matrice sur le stack
  
              //Bind the texture according to the set texture filter
              gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[filter]);
              //Set the face rotation
              gl.glFrontFace(GL10.GL_CW);
              //Enable texture state
              gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
              //Enable vertex state
              gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
              //Point to our vertex buffer
              gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
              //point to our texture buff
              gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer);
              //Draw the vertices as triangle strip
              gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3);
              //Disable the client state before leaving
              gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
              gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  
              gl.glTranslatef(1.0f, 0.0f, 0.0f); // on avance d'une tile
          }
          // on va commencer a dessiner la 2e ligne
          gl.glPopMatrix(); // Rappelle la matrice sur le stack
          gl.glTranslatef(0.0f, -1.0f, 0.0f);
      }
  </code></pre>