Class DefaultTextureBinder

  • All Implemented Interfaces:
    TextureBinder

    public final class DefaultTextureBinder
    extends java.lang.Object
    implements TextureBinder
    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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int LRU  
      static int MAX_GLES_UNITS
      GLES only supports up to 32 textures
      static int ROUNDROBIN  
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultTextureBinder​(int method)
      Uses all available texture units and reuse weight of 3
      DefaultTextureBinder​(int method, int offset)
      Uses all remaining texture units and reuse weight of 3
      DefaultTextureBinder​(int method, int offset, int count)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void begin()
      Prepares the binder for operation, must be matched with a call to TextureBinder.end().
      int bind​(TextureDescriptor textureDesc)
      Binds the texture to an available unit and applies the filters in the descriptor.
      int bind​(GLTexture texture)
      Binds the texture to an available unit.
      void end()
      Disables all used texture units and unbinds textures.
      int getBindCount()  
      int getReuseCount()  
      void resetCounts()
      Resets the bind/reuse counts
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultTextureBinder

        public DefaultTextureBinder​(int method)
        Uses all available texture units and reuse weight of 3
      • DefaultTextureBinder

        public DefaultTextureBinder​(int method,
                                    int offset)
        Uses all remaining texture units and reuse weight of 3
      • DefaultTextureBinder

        public DefaultTextureBinder​(int method,
                                    int offset,
                                    int count)
    • Method Detail

      • end

        public void end()
        Description copied from interface: TextureBinder
        Disables all used texture units and unbinds textures. Resets the counts.
        Specified by:
        end in interface TextureBinder
      • bind

        public final int bind​(TextureDescriptor textureDesc)
        Description copied from interface: TextureBinder
        Binds the texture to an available unit and applies the filters in the descriptor.
        Specified by:
        bind in interface TextureBinder
        Parameters:
        textureDesc - the TextureDescriptor
        Returns:
        the unit the texture was bound to
      • bind

        public final int bind​(GLTexture texture)
        Description copied from interface: TextureBinder
        Binds the texture to an available unit.
        Specified by:
        bind in interface TextureBinder
        Parameters:
        texture - the Texture
        Returns:
        the unit the texture was bound to
      • getReuseCount

        public final int getReuseCount()
        Specified by:
        getReuseCount in interface TextureBinder
        Returns:
        the number of binds that could be avoided by reuse