com.jogamp.opengl.util

## Class GLPixelBuffer.DefaultGLPixelBufferProvider

- java.lang.Object
- - com.jogamp.opengl.util.GLPixelBuffer.DefaultGLPixelBufferProvider

- All Implemented Interfaces:
    GLPixelBuffer.GLPixelBufferProvider
  Enclosing class:
    GLPixelBuffer

      public static class GLPixelBuffer.DefaultGLPixelBufferProvider
      extends Object
      implements GLPixelBuffer.GLPixelBufferProvider

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GLPixelBuffer.DefaultGLPixelBufferProvider(boolean allowRowStride)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `GLPixelBuffer` | `allocate(GL gl, GLPixelBuffer.GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize)` Allocates a new `GLPixelBuffer` object.
    `boolean` | `getAllowRowStride()` Allow `GL2ES3.GL_PACK_ROW_LENGTH`, or `GL2ES2.GL_UNPACK_ROW_LENGTH`.
    `GLPixelBuffer.GLPixelAttributes` | `getAttributes(GL gl, int componentCount)` Called first to determine `GLPixelBuffer.GLPixelAttributes`.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GLPixelBuffer.DefaultGLPixelBufferProvider

          public GLPixelBuffer.DefaultGLPixelBufferProvider(boolean allowRowStride)

      Parameters:
        `allowRowStride` - If `true`, allow row-stride, otherwise not. See `getAllowRowStride()` and `GLPixelBuffer.requiresNewBuffer(GL, int, int, int)`.

  - ### Method Detail

    - #### getAllowRowStride

          public boolean getAllowRowStride()

      Description copied from interface: `GLPixelBuffer.GLPixelBufferProvider`
      Allow `GL2ES3.GL_PACK_ROW_LENGTH`, or `GL2ES2.GL_UNPACK_ROW_LENGTH`.
      Specified by:
        `getAllowRowStride` in interface `GLPixelBuffer.GLPixelBufferProvider`

    - #### getAttributes

          public GLPixelBuffer.GLPixelAttributes getAttributes(GL gl,
                                                      int componentCount)

      Description copied from interface: `GLPixelBuffer.GLPixelBufferProvider`
      Called first to determine `GLPixelBuffer.GLPixelAttributes`.
      Specified by:
        `getAttributes` in interface `GLPixelBuffer.GLPixelBufferProvider`

    - #### allocate

          public GLPixelBuffer allocate(GL gl,
                               GLPixelBuffer.GLPixelAttributes pixelAttributes,
                               int width,
                               int height,
                               int depth,
                               boolean pack,
                               int minByteSize)

      Allocates a new `GLPixelBuffer` object.

      Being called to gather the initial `GLPixelBuffer`, or a new replacement `GLPixelBuffer` if `GLPixelBuffer.requiresNewBuffer(GL, int, int, int)`.

      The minimum required `remaining` byte size equals to `minByteSize`, if > 0, otherwise utilize `GLBuffers.sizeof(GL, int[], int, int, int, int, int, boolean)` to calculate it.

      Returns an NIO `ByteBuffer`.

      Specified by:
        `allocate` in interface `GLPixelBuffer.GLPixelBufferProvider`
      Parameters:
        `gl` - the corresponding current GL context object
        `pixelAttributes` - the desired `GLPixelBuffer.GLPixelAttributes`
        `width` - in pixels
        `height` - in pixels
        `depth` - in pixels
        `pack` - true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
        `minByteSize` - if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.

Copyright 2010 JogAmp Community.