Inviwo 0.9.12-pre
Inviwo documentation
|
Public Types | |
enum class | BindingType { Native , ForceFloat , ForceNormalizedFloat } |
enum class | SizePolicy { GrowOnly , ResizeToFit } |
Public Member Functions | |
BufferObject (size_t sizeInBytes, const DataFormatBase *format, BufferUsage usage, BufferTarget target=BufferTarget::Data) | |
BufferObject (size_t sizeInBytes, GLFormat format, GLenum usage, GLenum target) | |
BufferObject (const BufferObject &rhs) | |
BufferObject (BufferObject &&rhs) | |
BufferObject & | operator= (const BufferObject &other) |
BufferObject & | operator= (BufferObject &&other) |
virtual BufferObject * | clone () const |
GLenum | getFormatType () const |
GLenum | getTarget () const |
GLuint | getId () const |
GLFormat | getGLFormat () const |
const DataFormatBase * | getDataFormat () const |
void | bind () const |
Calls glBindBuffer. | |
void | unbind () const |
Calls glBindBuffer with buffer name 0. | |
void | bindBase (GLuint index) const |
Calls glBindBufferBase. Binds the buffer at index of the array of targets specified by the associated target (. | |
void | bindRange (GLuint index, GLintptr offset, GLsizeiptr size) const |
Calls glBindBufferRange. Binds the range (offset, offset + size) of the buffer at index of the array of targets specified by the associated target (. | |
void | bindAndSetAttribPointer (GLuint location, BindingType bindingType=BindingType::Native) const |
bind the buffer object and set the vertex attribute pointer | |
void | setSizeInBytes (GLsizeiptr sizeInBytes, SizePolicy policy=SizePolicy::GrowOnly) |
GLsizeiptr | getSizeInBytes () const |
GLsizeiptr | getCapacityInBytes () const |
void | upload (const void *data, GLsizeiptr sizeInBytes, SizePolicy policy=SizePolicy::GrowOnly) |
template<typename T > | |
void | upload (const std::vector< T > &cont, SizePolicy policy=SizePolicy::GrowOnly) |
void | download (void *data) const |
Public Member Functions inherited from inviwo::Observable< BufferObjectObserver > | |
Observable (const Observable< BufferObjectObserver > &other) | |
Observable (Observable< BufferObjectObserver > &&other) noexcept | |
Observable< BufferObjectObserver > & | operator= (const Observable< BufferObjectObserver > &other) |
Observable< BufferObjectObserver > & | operator= (Observable< BufferObjectObserver > &&other) noexcept |
void | addObserver (BufferObjectObserver *observer) |
void | removeObserver (BufferObjectObserver *observer) |
virtual void | startBlockingNotifications () override final |
virtual void | stopBlockingNotifications () override final |
Public Member Functions inherited from inviwo::ObservableInterface |
Static Public Member Functions | |
static std::string_view | targetName (GLenum target) |
Additional Inherited Members | |
Protected Member Functions inherited from inviwo::Observable< BufferObjectObserver > | |
void | forEachObserver (C callback) |
Protected Member Functions inherited from inviwo::ObservableInterface | |
void | addObservationHelper (Observer *observer) |
void | removeObservationHelper (Observer *observer) |
|
strong |
Type of binding when setting glVertexAttrib*Pointer.
See glVertexAttribPointer and Vertex Specification for details.
|
strong |
Policy for managing the buffer size when uploading new data to the GPU.
Enumerator | |
---|---|
GrowOnly | the buffer only grows and will never be resized to a smaller size |
ResizeToFit | the buffer size is adjusted to fit the data exactly |
void inviwo::BufferObject::bindAndSetAttribPointer | ( | GLuint | location, |
BindingType | bindingType = BindingType::Native ) const |
bind the buffer object and set the vertex attribute pointer
This will bind the buffer object and then set the respective glVertexAttrib*Pointer. By default, i.e. bindingType
= BindingType::Native, glVertexAttribIPointer (note the 'I') is used for scalar types and glVertexAttribPointer will be used for floating point types. This behavior can be overwritten by bindingType
. Then the buffer is only accessible using float
in the shader.
location | used to set the vertex attribute location |
bindingType | determines which glVertexAttrib*Pointer is used |
void inviwo::BufferObject::bindBase | ( | GLuint | index | ) | const |
Calls glBindBufferBase. Binds the buffer at index of the array of targets specified by the associated target (.
void inviwo::BufferObject::bindRange | ( | GLuint | index, |
GLintptr | offset, | ||
GLsizeiptr | size ) const |
Calls glBindBufferRange. Binds the range (offset, offset + size) of the buffer at index of the array of targets specified by the associated target (.
GLsizeiptr inviwo::BufferObject::getCapacityInBytes | ( | ) | const |
Get the capacity of the buffer in bytes, which might be larger than the size returned by getSizeInBytes()
GLsizeiptr inviwo::BufferObject::getSizeInBytes | ( | ) | const |
Get the size of the buffer in bytes.
void inviwo::BufferObject::setSizeInBytes | ( | GLsizeiptr | sizeInBytes, |
SizePolicy | policy = SizePolicy::GrowOnly ) |
Set the size of the buffer in bytes.
sizeInBytes | new buffer size in bytes |
policy | resizing policy when sizeInBytes differs from the current size |
|
inline |
Upload data from a container cont
into the buffer. This also binds the buffer.
cont | data to be uploaded. The underlying data must match the current GL format of the buffer. |
policy | resizing policy when sizeInBytes differs from the current size |
void inviwo::BufferObject::upload | ( | const void * | data, |
GLsizeiptr | sizeInBytes, | ||
SizePolicy | policy = SizePolicy::GrowOnly ) |
Upload data
into the buffer. This also binds the buffer. Depending on the grow policy policy
, the buffer is re-initialized with sizeInBytes
if it is different from the current size of the buffer.
data | data to be uploaded. The underlying data must match the current GL format of the buffer. |
sizeInBytes | size of the uploaded data |
policy | resizing policy when sizeInBytes differs from the current size |