APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.graphics.profiling

public Class GLProfiler

extends Object
Class Inheritance
Imports
com.badlogic.gdx.Gdx, .Graphics, com.badlogic.gdx.graphics.GL30, .GL31, .GL32, com.badlogic.gdx.math.FloatCounter

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.
Authors
Daniel Holderbaum, Jan Polák
See Also
GL20Interceptor, GL30Interceptor

Field Summary

Modifier and TypeField and Description
private boolean
private GLInterceptor
private Graphics
private GLErrorListener

Constructor Summary

AccessConstructor and Description
public
GLProfiler(Graphics
instance to monitor with this instance, With Lwjgl 2.x you can pass in Gdx.graphics, with Lwjgl3 use Lwjgl3Window.getGraphics()
graphics
)

Create a new instance of GLProfiler to monitor a com.badlogic.gdx.Graphics instance's gl calls

Method Summary

Modifier and TypeMethod and Description
public void
disable()

Disables profiling by resetting the GL20 and GL30 instances with the original ones.

public void
enable()

Enables profiling by replacing the GL20 and GL30 instances with profiling ones.

public int
getCalls()

Returns: the total gl calls made since the last reset

public int
getDrawCalls()

Returns: the total amount of draw calls made since the last reset

public GLErrorListener
getListener()

Returns: the current GLErrorListener

public int
getShaderSwitches()

Returns: the total amount of shader switches made since the last reset

public int
getTextureBindings()

Returns: the total amount of texture bindings made since the last reset

public FloatCounter
getVertexCount()

Returns: FloatCounter containing information about rendered vertices since the last reset

public boolean
isEnabled()

Returns: true if the GLProfiler is currently profiling

public void
reset()

Will reset the statistical information which has been collected so far.

public void
setListener(GLErrorListener errorListener)

Set the current listener for the GLProfiler to errorListener

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

enabledback to summary
private boolean enabled
glInterceptorback to summary
private GLInterceptor glInterceptor
graphicsback to summary
private Graphics graphics
listenerback to summary
private GLErrorListener listener

Constructor Detail

GLProfilerback to summary
public GLProfiler(Graphics graphics)

Create a new instance of GLProfiler to monitor a com.badlogic.gdx.Graphics instance's gl calls

Parameters
graphics:Graphics

instance to monitor with this instance, With Lwjgl 2.x you can pass in Gdx.graphics, with Lwjgl3 use Lwjgl3Window.getGraphics()

Method Detail

disableback to summary
public void disable()

Disables profiling by resetting the GL20 and GL30 instances with the original ones.

enableback to summary
public void enable()

Enables profiling by replacing the GL20 and GL30 instances with profiling ones.

getCallsback to summary
public int getCalls()
Returns:int

the total gl calls made since the last reset

getDrawCallsback to summary
public int getDrawCalls()
Returns:int

the total amount of draw calls made since the last reset

getListenerback to summary
public GLErrorListener getListener()
Returns:GLErrorListener

the current GLErrorListener

getShaderSwitchesback to summary
public int getShaderSwitches()
Returns:int

the total amount of shader switches made since the last reset

getTextureBindingsback to summary
public int getTextureBindings()
Returns:int

the total amount of texture bindings made since the last reset

getVertexCountback to summary
public FloatCounter getVertexCount()
Returns:FloatCounter

FloatCounter containing information about rendered vertices since the last reset

isEnabledback to summary
public boolean isEnabled()
Returns:boolean

true if the GLProfiler is currently profiling

resetback to summary
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.

setListenerback to summary
public void setListener(GLErrorListener errorListener)

Set the current listener for the GLProfiler to errorListener