Class GLProfiler


  • public class GLProfiler
    extends java.lang.Object
    When enabled, collects statistics about GL calls and checks for GL errors. Enabling will wrap Gdx.gl* instances with delegate classes which provide described functionality and route GL calls to the actual GL instances.
    See Also:
    GL20Interceptor, GL30Interceptor
    • Constructor Detail

      • GLProfiler

        public GLProfiler​(Graphics graphics)
        Create a new instance of GLProfiler to monitor a Graphics instance's gl calls
        Parameters:
        graphics - instance to monitor with this instance, With Lwjgl 2.x you can pass in Gdx.graphics, with Lwjgl3 use Lwjgl3Window.getGraphics()
    • Method Detail

      • enable

        public void enable()
        Enables profiling by replacing the GL20 and GL30 instances with profiling ones.
      • disable

        public void disable()
        Disables profiling by resetting the GL20 and GL30 instances with the original ones.
      • setListener

        public void setListener​(GLErrorListener errorListener)
        Set the current listener for the GLProfiler to errorListener
      • isEnabled

        public boolean isEnabled()
        Returns:
        true if the GLProfiler is currently profiling
      • getCalls

        public int getCalls()
        Returns:
        the total gl calls made since the last reset
      • getTextureBindings

        public int getTextureBindings()
        Returns:
        the total amount of texture bindings made since the last reset
      • getDrawCalls

        public int getDrawCalls()
        Returns:
        the total amount of draw calls made since the last reset
      • getShaderSwitches

        public int getShaderSwitches()
        Returns:
        the total amount of shader switches made since the last reset
      • getVertexCount

        public FloatCounter getVertexCount()
        Returns:
        FloatCounter containing information about rendered vertices since the last reset
      • reset

        public void reset()
        Will reset the statistical information which has been collected so far. This should be called after every frame. Error listener is kept as it is.