Package 

Class BufferObject


  • 
    public class BufferObject
    
                        

    A generic GPU buffer containing data. Usage of this BufferObject is optional. For simple use cases it is not necessary. It is useful only when you need to share data between multiple VertexBuffer instances. It also allows you to efficiently swap-out the buffers in VertexBuffer. NOTE: For now this is only used for vertex data, but in the future we may use it for other things (e.g. compute).

    • Method Detail

      • getByteCount

        @IntRange(from = 0) int getByteCount()

        Returns the size of this BufferObject in elements.

      • setBuffer

         void setBuffer(@NonNull() Engine engine, @NonNull() Buffer buffer)

        Asynchronously copy-initializes this BufferObject from the data provided.

        Parameters:
        engine - reference to the Engine to associate thisBufferObject with
        buffer - a CPU-side Buffer with the data used to initialize theBufferObject.
      • setBuffer

         void setBuffer(@NonNull() Engine engine, @NonNull() Buffer buffer, @IntRange(from = 0) int destOffsetInBytes, @IntRange(from = 0) int count)

        Asynchronously copy-initializes a region of this BufferObject from the dataprovided.

        Parameters:
        engine - reference to the Engine to associate thisBufferObject with
        buffer - a CPU-side Buffer with the data used to initialize theBufferObject.
        destOffsetInBytes - offset in bytes into the BufferObject
        count - number of bytes to consume, defaults tobuffer.remaining()
      • setBuffer

         void setBuffer(@NonNull() Engine engine, @NonNull() Buffer buffer, @IntRange(from = 0) int destOffsetInBytes, @IntRange(from = 0) int count, @Nullable() Object handler, @Nullable() Runnable callback)

        Asynchronously copy-initializes a region of this BufferObject from the dataprovided.

        Parameters:
        engine - reference to the Engine to associate thisBufferObject with
        buffer - a CPU-side Buffer with the data used to initialize theBufferObject.
        destOffsetInBytes - offset in bytes into the BufferObject
        count - number of bytes to consume, defaults tobuffer.remaining()
        handler - an Executor.
        callback - a callback executed by handler when bufferis no longer needed.