OooglesOoogles Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers License |
record TGLBuffer
Unit
Neslib.Ooogles
Declaration
type TGLBuffer = record
Description
A (vertex) array buffer or element array (index) buffer
Overview
Methods
Properties
property Handle: GLuint read FHandle; |
Description
Methods
procedure New(const AType: TGLBufferType); inline; |
Creates a buffer.
No buffer objects are associated with the buffer until they are first bound by calling Bind.
OpenGL API: glGenBuffers
Parameters
- AType
- the type of buffer to create.
See also
- Bind
- Binds the buffer.
- Delete
- Deletes the buffer.
|
procedure Delete; inline; |
Deletes the buffer.
If a buffer object that is currently bound is deleted, the binding reverts to 0 (the absence of any buffer object, which reverts to client memory usage).
OpenGL API: glDeleteBuffers
See also
- Bind
- Binds the buffer.
- New
- Creates a buffer.
|
procedure Bind; inline; |
Binds the buffer.
When a buffer object is bound to a target, the previous binding for that target is automatically broken.
The state of a buffer object immediately after it is first bound is a zero-sized memory buffer with TGLBufferUsage.StaticDraw usage.
While a buffer object name is bound, GL operations on the target to which it is bound affect the bound buffer object, and queries of the target to which it is bound return state from the bound buffer object.
A buffer object binding created Bind remains active until a different buffer object name is bound to the same target, or until the bound buffer object is deleted with Delete.
Once created, a named buffer object may be re-bound to any target as often as needed. However, the GL implementation may make choices about how to optimize the storage of a buffer object based on its initial binding target.
OpenGL API: glBindBuffer
See also
- GetCurrentArrayBuffer
- Gets the currently bound array buffer (aka Vertex Buffer).
- GetCurrentElementArrayBuffer
- Gets the currently bound element array buffer (aka Index Buffer).
- New
- Creates a buffer.
- Delete
- Deletes the buffer.
- Unbind
- Unbinds the buffer.
- IsBound
- Checks if this buffer is currently bound.
|
procedure Unbind; inline; |
Unbinds the buffer.
This effectively unbinds any buffer object previously bound, and restores client memory usage for that buffer object target.
While the buffer is unbound, as in the initial state, attempts to modify or query state on the target to which it is bound generates an TGLError.InvalidOperation error.
OpenGL API: glBindBuffer
See also
- Bind
- Binds the buffer.
- IsBound
- Checks if this buffer is currently bound.
|
function IsBound: Boolean; inline; |
Checks if this buffer is currently bound.
Returns
True if this is the currently bound buffer, False otherwise. |
procedure Data(const AData; const ASize: NativeInt; const AUsage: TGLBufferUsage = TGLBufferUsage.StaticDraw); overload; inline; |
procedure Data<T: record>(const AData: array of T; const AUsage: TGLBufferUsage = TGLBufferUsage.StaticDraw); overload; |
procedure Data<T: record>(const AData: TArray<T>; const AUsage: TGLBufferUsage = TGLBufferUsage.StaticDraw); overload; inline; |
Create and initialize a buffer object's data store.
There are overloaded versions of this method where AData is an array of values of generic type T. In that case, there is no ASize parameter.
Any pre-existing data store is deleted.
AUsage is a hint to the GL implementation as to how a buffer object's data store will be accessed. This enables the GL implementation to make more intelligent decisions that may significantly impact buffer object performance. It does not, however, constrain the actual usage of the data store.
Note: clients must align data elements consistent with the requirements of the client platform, with an additional base-level requirement that an offset within a buffer to a datum comprising N be a multiple of N.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this buffer is not bound.
OpenGL API: glBufferData
Parameters
- AData
- untyped value to copy to the buffer.
- ASize
- size of the data in bytes.
- AUsage
- (optional) expected usage pattern of the data store. Defaults to TGLBufferUsage.StaticDraw.
Exceptions raised
TGLError.InvalidValue
- if ASize is negative.
TGLError.InvalidOperation
- if no buffer is bound.
TGLError.OutOfMemory
- if the GL is unable to create a data store with the specified ASize.
See also
- GetSize
- Get the size of the buffer in bytes.
- GetUsage
- Get the buffer object's usage pattern.
- Bind
- Binds the buffer.
- Unbind
- Unbinds the buffer.
- SubData
|
procedure SubData(const AOffset: NativeInt; const AData; const ASize: NativeInt); overload; inline; |
procedure SubData<T: record>(const AOffset: NativeInt; const AData: array of T); overload; |
procedure SubData<T: record>(const AOffset: NativeInt; const AData: TArray<T>); overload; inline; |
Update a subset of a buffer object's data store.
There are overloaded versions of this method where AData is an array of values of generic type T. In that case, there is no ASize parameter (but AOffset is still measured in bytes).
This method redefines some or all of the data store for the buffer object currently bound to target. Data starting at byte offset AOffset and extending for ASize bytes is copied to the data store from the memory pointed to by AData. An error is thrown if offset and size together define a range beyond the bounds of the buffer object's data store.
Note: when replacing the entire data store, consider using SubData rather than completely recreating the data store with Data. This avoids the cost of reallocating the data store.
Note: consider using multiple buffer objects to avoid stalling the rendering pipeline during data store updates. If any rendering in the pipeline makes reference to data in the buffer object being updated by SubData, especially from the specific region being updated, that rendering must drain from the pipeline before the data store can be updated.
Note: clients must align data elements consistent with the requirements of the client platform, with an additional base-level requirement that an offset within a buffer to a datum comprising N be a multiple of N.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this buffer is not bound.
OpenGL API: glBufferSubData
Parameters
- AOffset
- the offset into the buffer object's data store where data replacement will begin, measured in bytes.
- AData
- untyped value to copy to the buffer.
- ASize
- size of the data in bytes.
- AUsage
- (optional) expected usage pattern of the data store. Defaults to TGLBufferUsage.StaticDraw.
Exceptions raised
TGLError.InvalidValue
- if AOffset or ASize is negative, or if together they define a region of memory that extends beyond the buffer object's allocated data store.
TGLError.InvalidOperation
- if no buffer is bound.
See also
- Bind
- Binds the buffer.
- Unbind
- Unbinds the buffer.
- Data
|
function GetSize: Integer; inline; |
Get the size of the buffer in bytes.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this buffer is not bound.
OpenGL API: glGetBufferParameteriv(GL_BUFFER_SIZE)
Returns
The size of the buffer in bytes. Exceptions raised
TGLError.InvalidOperation
- if no buffer is bound.
See also
- Bind
- Binds the buffer.
- Data
|
function GetUsage: TGLBufferUsage; inline; |
Get the buffer object's usage pattern.
Note: in DEBUG mode with assertions enabled, an error will be logged to the debug console if this buffer is not bound.
OpenGL API: glGetBufferParameteriv(GL_BUFFER_USAGE)
Returns
The usage pattern. Exceptions raised
TGLError.InvalidOperation
- if no buffer is bound.
See also
- Bind
- Binds the buffer.
- Data
|
class function GetCurrentArrayBuffer: TGLBuffer; inline; static; |
Gets the currently bound array buffer (aka Vertex Buffer).
Returns The currently bound array buffer.
OpenGL API: glGetIntegerv(GL_ARRAY_BUFFER_BINDING)
See also
- GetCurrentElementArrayBuffer
- Gets the currently bound element array buffer (aka Index Buffer).
|
class function GetCurrentElementArrayBuffer: TGLBuffer; inline; static; |
Gets the currently bound element array buffer (aka Index Buffer).
Returns The currently bound element array buffer.
OpenGL API: glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING)
See also
- GetCurrentArrayBuffer
- Gets the currently bound array buffer (aka Vertex Buffer).
|
Properties
property Handle: GLuint read FHandle; |
OpenGL handle to the buffer object.
|
Generated by PasDocEx, based on PasDoc 0.14.0.
|