LibGDX Depth Testing is horrendously slow

In the render method we do two things

  1. Render all entities to an FBO
  2. Scale FBO and draw it to the screen

In the FBO, depth testing is enabled and the resolution is very low
[icode]entityBuffer = new FrameBuffer(Format.RGBA8888, (int) camera.viewportWidth, (int) camera.viewportHeight, true);[/icode]

When drawing to the FBO, there seems to be a pretty big performance difference on what we depth test.

  • The game runs slower the more we depth-test
  • The depth buffer is cleared with 0.0 every frame
  • The framebuffer IS bound, and when we render it depth-testing is disabled
  • We’re using [icode]gl_FragDepth[/icode] in a shader that renders every entity to the framebuffer to set the depth, disabling it does nothing performance wise

It seems like when I enable the depth buffer while drawing a large group of objects it becomes very slow on my laptop, but my PC with it’s dedicated video card does fine.

Is there any way to speed up depth testing? It seems like that’s what is slowing the game down