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

public final Class DefaultTextureBinder

extends Object
implements TextureBinder
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.graphics.g3d.utils.TextureBinder
Imports
java.nio.IntBuffer, com.badlogic.gdx.Gdx, com.badlogic.gdx.graphics.GL20, .GLTexture, com.badlogic.gdx.utils.BufferUtils, .GdxRuntimeException

Class that you assign a range of texture units and binds textures for you within that range. It does some basic usage tracking to avoid unnecessary bind calls.
Author
xoppa

Field Summary

Modifier and TypeField and Description
private int
private final int
count

The amount of exclusive textures that may be used

private int
public static final int
public static final int
MAX_GLES_UNITS

GLES only supports up to 32 textures

private final int
method

The method of binding to use

private final int
offset

The index of the first exclusive texture unit

private int
private boolean
reused

Flag to indicate the current texture is reused

public static final int
private final TextureDescriptor<T extends GLTexture>
private final GLTexture[]
textures

The textures currently exclusive bound

private int[]
unitsLRU

Texture units ordered from most to least recently used

Constructor Summary

AccessConstructor and Description
public
DefaultTextureBinder(final int method)

Uses all available texture units and reuse weight of 3

public
DefaultTextureBinder(final int method, final int offset)

Uses all remaining texture units and reuse weight of 3

public
DefaultTextureBinder(final int method, final int offset, int count)

Method Summary

Modifier and TypeMethod and Description
public void
begin()

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.begin.

Prepares the binder for operation, must be matched with a call to end().

public final int
bind(final TextureDescriptor<T extends GLTexture> textureDesc)

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.bind.

Binds the texture to an available unit and applies the filters in the descriptor.

public final int
bind(final GLTexture texture)

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.bind.

Binds the texture to an available unit.

private final int
bindTexture(final TextureDescriptor<T extends GLTexture> textureDesc, final boolean rebind)

private final int
bindTextureLRU(final GLTexture texture)

private final int
public void
end()

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.end.

Disables all used texture units and unbinds textures.

public final int
private static int
public final int
public final void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bindCountback to summary
private int bindCount
countback to summary
private final int count

The amount of exclusive textures that may be used

currentTextureback to summary
private int currentTexture
LRUback to summary
public static final int LRU
MAX_GLES_UNITSback to summary
public static final int MAX_GLES_UNITS

GLES only supports up to 32 textures

methodback to summary
private final int method

The method of binding to use

offsetback to summary
private final int offset

The index of the first exclusive texture unit

reuseCountback to summary
private int reuseCount
reusedback to summary
private boolean reused

Flag to indicate the current texture is reused

ROUNDROBINback to summary
public static final int ROUNDROBIN
tempDescback to summary
private final TextureDescriptor<T extends GLTexture> tempDesc
texturesback to summary
private final GLTexture[] textures

The textures currently exclusive bound

unitsLRUback to summary
private int[] unitsLRU

Texture units ordered from most to least recently used

Constructor Detail

DefaultTextureBinderback to summary
public DefaultTextureBinder(final int method)

Uses all available texture units and reuse weight of 3

DefaultTextureBinderback to summary
public DefaultTextureBinder(final int method, final int offset)

Uses all remaining texture units and reuse weight of 3

DefaultTextureBinderback to summary
public DefaultTextureBinder(final int method, final int offset, int count)

Method Detail

beginback to summary
public void begin()

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.begin.

Doc from com.badlogic.gdx.graphics.g3d.utils.TextureBinder.begin.

Prepares the binder for operation, must be matched with a call to end().

Annotations
@Override
bindback to summary
public final int bind(final TextureDescriptor<T extends GLTexture> textureDesc)

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.bind.

Doc from com.badlogic.gdx.graphics.g3d.utils.TextureBinder.bind.

Binds the texture to an available unit and applies the filters in the descriptor.

Annotations
@Override
bindback to summary
public final int bind(final GLTexture texture)

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.bind.

Doc from com.badlogic.gdx.graphics.g3d.utils.TextureBinder.bind.

Binds the texture to an available unit.

Annotations
@Override
bindTextureback to summary
private final int bindTexture(final TextureDescriptor<T extends GLTexture> textureDesc, final boolean rebind)
bindTextureLRUback to summary
private final int bindTextureLRU(final GLTexture texture)
bindTextureRoundRobinback to summary
private final int bindTextureRoundRobin(final GLTexture texture)
endback to summary
public void end()

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.end.

Doc from com.badlogic.gdx.graphics.g3d.utils.TextureBinder.end.

Disables all used texture units and unbinds textures. Resets the counts.

Annotations
@Override
getBindCountback to summary
public final int getBindCount()

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.getBindCount.

Annotations
@Override
getMaxTextureUnitsback to summary
private static int getMaxTextureUnits()
getReuseCountback to summary
public final int getReuseCount()

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.getReuseCount.

Annotations
@Override
resetCountsback to summary
public final void resetCounts()

Implements com.badlogic.gdx.graphics.g3d.utils.TextureBinder.resetCounts.

Doc from com.badlogic.gdx.graphics.g3d.utils.TextureBinder.resetCounts.

Resets the bind/reuse counts

Annotations
@Override