com.io7m.jcanephora.core.api

## Interface JCGLTextures2DType

- All Known Subinterfaces:
    JCGLTexturesType

      public interface JCGLTextures2DType

  The interface to OpenGL 2D textures.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `JCGLTexture2DType` | `texture2DAllocate(JCGLTextureUnitType unit, long width, long height, JCGLTextureFormat format, JCGLTextureWrapS wrap_s, JCGLTextureWrapT wrap_t, JCGLTextureFilterMinification min_filter, JCGLTextureFilterMagnification mag_filter)` Allocate a texture of width `width` and height `height` of format `format`, binding it to `unit`.
    `void` | `texture2DBind(JCGLTextureUnitType unit, JCGLTexture2DUsableType texture)` Bind the texture `texture` to the texture unit `unit`.
    `void` | `texture2DDelete(JCGLTexture2DType texture)` Deletes the texture referenced by `texture`.
    `ByteBuffer` | `texture2DGetImage(JCGLTextureUnitType unit, JCGLTexture2DUsableType texture)` Fetch image data for the given texture.
    `boolean` | `texture2DIsBound(JCGLTextureUnitType unit, JCGLTexture2DUsableType texture)`
    `boolean` | `texture2DIsBoundAnywhere(JCGLTexture2DUsableType texture)`
    `void` | `texture2DRegenerateMipmaps(JCGLTextureUnitType unit)` Regenerate the mipmaps for the 2D texture bound to the texture unit `unit`.
    `void` | `texture2DUpdate(JCGLTextureUnitType unit, JCGLTexture2DUpdateType data)` Replace the contents (or part of the contents) of the texture `data.getTexture()` with `data`.

- - ### Method Detail

    - #### texture2DBind

          void texture2DBind(JCGLTextureUnitType unit,
                             JCGLTexture2DUsableType texture)
                      throws JCGLException

      Bind the texture `texture` to the texture unit `unit`. Any existing bound texture (of any type) is unbound.
      Parameters:
        `unit` - The texture unit
        `texture` - The texture
      Throws:
        `JCGLException` - Iff an OpenGL error occurs
      See Also:
        `JCGLTexturesType.textureUnitUnbind(JCGLTextureUnitType)`

    - #### texture2DDelete

          void texture2DDelete(JCGLTexture2DType texture)
                        throws JCGLException

      Deletes the texture referenced by `texture`.
      Parameters:
        `texture` - The texture
      Throws:
        `JCGLException` - Iff an OpenGL error occurs

    - #### texture2DIsBound

          boolean texture2DIsBound(JCGLTextureUnitType unit,
                                   JCGLTexture2DUsableType texture)
                            throws JCGLException

      Parameters:
        `unit` - The texture unit
        `texture` - The texture
      Returns:
        `true` iff the texture `texture` is bound to the texture unit `unit`.
      Throws:
        `JCGLException` - Iff an OpenGL error occurs

    - #### texture2DIsBoundAnywhere

          boolean texture2DIsBoundAnywhere(JCGLTexture2DUsableType texture)
                                    throws JCGLException

      Parameters:
        `texture` - The texture
      Returns:
        `true` iff the texture `texture` is bound to any texture unit.
      Throws:
        `JCGLException` - Iff an OpenGL error occurs

    - #### texture2DAllocate

          JCGLTexture2DType texture2DAllocate(JCGLTextureUnitType unit,
                                              long width,
                                              long height,
                                              JCGLTextureFormat format,
                                              JCGLTextureWrapS wrap_s,
                                              JCGLTextureWrapT wrap_t,
                                              JCGLTextureFilterMinification min_filter,
                                              JCGLTextureFilterMagnification mag_filter)
                                       throws JCGLException

      Allocate a texture of width `width` and height `height` of format `format`, binding it to `unit`.

      The texture is wrapped around the `s` axis using the wrapping mode `wrap_s`, with the OpenGL default being `TEXTURE_WRAP_REPEAT`.

      The texture is wrapped around the `t` axis using the wrapping mode `wrap_t`, with the OpenGL default being `TEXTURE_WRAP_REPEAT`.

      The texture is scaled down using the minification filter `min_filter`, with the OpenGL default being `TEXURE_FILTER_LINEAR`.

      The texture is scaled up using the magnification filter `mag_filter`, with the OpenGL default being `TEXTURE_FILTER_LINEAR`.

      Parameters:
        `unit` - The texture unit to which the texture will be initially bound
        `width` - The width in pixels
        `height` - The height in pixels
        `format` - The texture format
        `wrap_s` - The method with which to wrap textures around the `s` axis
        `wrap_t` - The method with which to wrap textures around the `t` axis
        `min_filter` - The minification filter
        `mag_filter` - The magnification filter
      Returns:
        An allocated texture
      Throws:
        `JCGLException` - Iff an OpenGL error occurs

    - #### texture2DUpdate

          void texture2DUpdate(JCGLTextureUnitType unit,
                               JCGLTexture2DUpdateType data)
                        throws JCGLException

      Replace the contents (or part of the contents) of the texture `data.getTexture()` with `data`.

      Updating a texture requires binding and unbinding textures, and the given `unit` will be used to perform the update, breaking any associated bindings for that unit. The updated texture will remain bound to `unit` when the function returns.

      Parameters:
        `unit` - The texture unit that will be used to perform the update
        `data` - The data to upload
      Throws:
        `JCGLException` - Iff an OpenGL error occurs

    - #### texture2DGetImage

          ByteBuffer texture2DGetImage(JCGLTextureUnitType unit,
                                       JCGLTexture2DUsableType texture)
                                throws JCGLException

      Fetch image data for the given texture.

      Fetching texture data requires binding and unbinding textures, and the given `unit` will be used to perform the retrieval, breaking any associated bindings for that unit. The texture will remain bound to `unit` when the function returns.

      Parameters:
        `unit` - The texture unit that will be used to fetch the data
        `texture` - The texture
      Returns:
        The texture image data associated with `texture`
      Throws:
        `JCGLException` - Iff an OpenGL error occurs

    - #### texture2DRegenerateMipmaps

          void texture2DRegenerateMipmaps(JCGLTextureUnitType unit)
                                   throws JCGLException

      Regenerate the mipmaps for the 2D texture bound to the texture unit `unit`. If the texture does not have mipmaps, the function has no effect.
      Parameters:
        `unit` - The texture unit
      Throws:
        `JCGLException` - Iff an OpenGL error occurs

Copyright © 2016 <code@io7m.com> http://io7m.com