Class Texture

java.lang.Object
com.codename1.gpu.Texture

public final class Texture extends Object
A GPU texture. Instances are created by a GraphicsDevice from a Codename One Image or from raw ARGB pixel data and then referenced by a Material. The class itself is a lightweight handle; the pixel storage lives on the GPU.
  • Constructor Details

    • Texture

      public Texture(int width, int height)

      Creates a texture handle of the given dimensions. Intended for backend use; applications create textures via GraphicsDevice.

      Parameters
      • width: the texture width in pixels

      • height: the texture height in pixels

  • Method Details

    • getWidth

      public int getWidth()
      Returns the texture width in pixels.
    • getHeight

      public int getHeight()
      Returns the texture height in pixels.
    • getWrap

      public Texture.Wrap getWrap()
      Returns the configured wrapping mode.
    • setWrap

      public Texture setWrap(Texture.Wrap wrap)

      Sets the wrapping mode. Takes effect on the next bind by the backend.

      Parameters
      • wrap: the wrapping mode
      Returns

      this texture for chaining

    • getFilter

      public Texture.Filter getFilter()
      Returns the configured sampling filter.
    • setFilter

      public Texture setFilter(Texture.Filter filter)

      Sets the sampling filter. Takes effect on the next bind by the backend.

      Parameters
      • filter: the sampling filter
      Returns

      this texture for chaining

    • getHandle

      public Object getHandle()
      Returns the opaque backend GPU handle. Intended for backend use.
    • setHandle

      public void setHandle(Object handle)

      Stores the opaque backend GPU handle. Intended for backend use.

      Parameters
      • handle: the backend specific GPU resource handle