title: What might be causing only half of textures to be drawn in an Android game?
body: <p>I've had reports from a couple of users (from 85000 downloads) of the problem shown in the image below. No doubt it has occurred a few more times than this, but it's certainly rare.</p>
  
  <p>I'm unable to reproduce the problem and don't believe it's specific to device as some users would appear to be playing the game perfectly happily on the same device models that have reported the problem.</p>
  
  <p>The letters are drawn onto a frame buffer first to build them up from the circular background with the character drawn on top. They are then copied off and a new texture is created.</p>
  
  <p>The background is also put together from multiple components on a frame buffer and copied off to create a texture, so I'm not too sure why that appears to work perfectly well when the letters don't. The background is drawn using the same FrameBuffer and the same SpriteBatch instance.</p>
  
  <p><strong>What it does look like</strong></p>
  
  <p><img src="https://i.stack.imgur.com/i54ca.png" alt="Incorrect"></p>
  
  <p><strong>What it should look like</strong></p>
  
  <p><img src="https://i.stack.imgur.com/O4iAA.png" alt="Correct"></p>
  
  <p><strong>Method that create the images</strong></p>
  
  <pre><code>private static Texture getTextureUsingGpu(String letter, Bubble.BubbleType bubbleType) {
      if (!enabled)
          return null;
  
      StrokeFontHelper font = Assets.strokeFont;
      font.setSettings(Fonts.BUBBLE_TEXT_SETTINGS);
  
      TextureRegion tx = getBlockImage(letter, bubbleType);
      FrameBuffer fb = TextureLoader.getFrameBuffer();
      fb.begin();
  
      Gdx.gl20.glClearColor(0.0f, 0.0f, 0.0f, 1);
      // Make sure everything is really really clear! Trying to fix graphics glitches on some phones
      Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT | GL20.GL_STENCIL_BUFFER_BIT | GL20.GL_SUBPIXEL_BITS);
  
      float width = tx.getRegionWidth();
      float height = tx.getRegionHeight();
  
      TextureLoader.sb.begin();
  
      tx.flip(false, !tx.isFlipY());
  
      TextureLoader.sb.disableBlending();
      TextureLoader.sb.draw(tx, 0, 0);
      TextureLoader.sb.enableBlending();
  
      // Removed character drawing code to make it more readable
  
      TextureLoader.sb.end();
  
      Pixmap pm = ScreenUtils.getFrameBufferPixmap(0, 0, (int) width,
              (int) height);
  
      PixmapTextureData data = new PixmapTextureData(pm, Format.RGBA8888,
              false, false, true);
      Texture result = new Texture(data);
      result.setFilter(TextureFilter.Linear, TextureFilter.Linear);
      cacheTexture(letter, result, pm);
  
      fb.end();
      return result;
  }
  
  public static FrameBuffer getFrameBuffer() {
      if (frameBuffer == null || frameBuffer.getWidth() != Gdx.graphics.getWidth() || frameBuffer.getHeight() != Gdx.graphics.getHeight()) {
          if (frameBuffer != null)
              frameBuffer.dispose();
          // Create the highest quality frame buffer we can get away with
  
          try {
              frameBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
          } catch (Exception e) {
              try {
                  frameBuffer = new FrameBuffer(Pixmap.Format.RGB888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
              } catch (Exception e2) {
                  frameBuffer = new FrameBuffer(Pixmap.Format.RGB565, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
              }
          }
  
          // Set up the camera correctly for the frame buffer
          camera = new OrthographicCamera(frameBuffer.getWidth(), frameBuffer.getHeight());
          camera.position.set(frameBuffer.getWidth() * 0.5f, frameBuffer.getHeight() * 0.5f, 0);
          camera.update();
          sb.setProjectionMatrix(camera.combined);
      }
  
      return frameBuffer;
  }
  </code></pre>
  
  <p><strong>Edit</strong>
  I've done some fiddling with this and have a very helpful user who has been testing versions for me. Here's what I've established.
  If I use a ShapeRenderer rather than a SpriteBatch then I can draw over the whole area as expected.
  It is almost certainly the point at which I draw textures to the FrameBuffer using the SpriteBatch that the problem occurs. It just doesn't draw to the bottom half of the textures. What's on the FreameBuffer is copied to the pixmap correctly.</p>
  
  <p><strong>Another Edit</strong> I've got a new visual glitch reported by a user. I don't know if this might shed some more light on a problem.</p>
  
  <p><img src="https://i.stack.imgur.com/9ArMo.png" alt="enter image description here"></p>