Inviwo  0.9.10.1
Inviwo documentation
inviwo::BufferObject Class Reference
+ Inheritance diagram for inviwo::BufferObject:

Public Types

enum  BindingType { BindingType::Native, BindingType::ForceFloat, BindingType::ForceNormalizedFloat }
 

Public Member Functions

 BufferObject (size_t sizeInBytes, const DataFormatBase *format, BufferUsage usage, BufferTarget target=BufferTarget::Data)
 
 BufferObject (const BufferObject &rhs)
 
 BufferObject (BufferObject &&rhs)
 
BufferObjectoperator= (const BufferObject &other)
 
BufferObjectoperator= (BufferObject &&other)
 
virtual BufferObjectclone () const
 
GLenum getFormatType () const
 
GLenum getTarget () const
 
GLuint getId () const
 
GLFormats::GLFormat getGLFormat () const
 
const DataFormatBasegetDataFormat () const
 
void bind () const
 
void unbind () const
 
void bindAndSetAttribPointer (GLuint location, BindingType bindingType=BindingType::Native) const
 bind the buffer object and set the vertex attribute pointer More...
 
void setSize (GLsizeiptr sizeInBytes)
 
void upload (const void *data, GLsizeiptr sizeInBytes)
 
void download (void *data) const
 
- Public Member Functions inherited from inviwo::Observable< BufferObjectObserver >
 Observable (const Observable< BufferObjectObserver > &other)
 
 Observable (Observable< BufferObjectObserver > &&other)
 
Observable< BufferObjectObserver > & operator= (const Observable< BufferObjectObserver > &other)
 
Observable< BufferObjectObserver > & operator= (Observable< BufferObjectObserver > &&other)
 
void addObserver (BufferObjectObserver *observer)
 
void removeObserver (BufferObjectObserver *observer)
 
virtual void startBlockingNotifications () override final
 
virtual void stopBlockingNotifications () override final
 

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)
 

Member Enumeration Documentation

◆ BindingType

Type of binding when setting glVertexAttrib*Pointer.

See glVertexAttribPointer and Vertex Specification for details.

Enumerator
Native 

uses glVertexAttribIPointer for integral types, glVertexAttribDPointer for double, and glVertexAttribPointer otherwise

ForceFloat 

enforces the use of glVertexAttribPointer independent of the buffer type

ForceNormalizedFloat 

enforces the use of glVertexAttribPointer with normalization of integral types

Member Function Documentation

◆ bindAndSetAttribPointer()

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.

See also
BindingType
Parameters
locationused to set the vertex attribute location
bindingTypedetermines which glVertexAttrib*Pointer is used

◆ setSize()

void inviwo::BufferObject::setSize ( GLsizeiptr  sizeInBytes)

Set the size of the buffer in bytes. Convenience function for calling initialize(nullptr, sizeInBytes)

Parameters
sizeInBytes

The documentation for this class was generated from the following files: