7#include <glbinding/gl/types.h>
9#include <globjects/globjects_api.h>
41 , DirectStateAccessEXT
75 void bind(gl::GLenum target)
const;
80 static void unbind(gl::GLenum target);
86 static void unbind(gl::GLenum target, gl::GLuint index);
95 void setData(gl::GLsizeiptr size,
const gl::GLvoid * data, gl::GLenum usage);
100 void setData(
const T & data, gl::GLenum usage);
104 template <
typename T>
105 void setData(
const std::vector<T> & data, gl::GLenum usage);
109 template <
typename T, std::
size_t Count>
110 void setData(
const std::array<T, Count> & data, gl::GLenum usage);
119 void setSubData(gl::GLintptr offset, gl::GLsizeiptr size,
const gl::GLvoid* data =
nullptr);
123 template <
typename T>
128 template <
typename T>
129 void setSubData(
const std::vector<T> & data, gl::GLintptr offset = 0);
133 template <
typename T, std::
size_t Count>
134 void setSubData(
const std::array<T, Count> & data, gl::GLintptr offset = 0);
142 void setStorage(gl::GLsizeiptr size,
const gl::GLvoid * data, gl::BufferStorageMask flags);
146 template <
typename T>
147 void setStorage(
const T & data, gl::BufferStorageMask flags);
151 template <
typename T>
152 void setStorage(
const std::vector<T> & data, gl::BufferStorageMask flags);
156 template <
typename T, std::
size_t Count>
157 void setStorage(
const std::array<T, Count> & data, gl::BufferStorageMask flags);
184 void *
map(gl::GLenum access);
194 void *
mapRange(gl::GLintptr offset, gl::GLsizeiptr length, gl::BufferAccessMask access);
211 void bindBase(gl::GLenum target, gl::GLuint index)
const;
216 void bindRange(gl::GLenum target, gl::GLuint index, gl::GLintptr offset, gl::GLsizeiptr size)
const;
224 void copySubData(
Buffer * buffer, gl::GLintptr readOffset, gl::GLintptr writeOffset, gl::GLsizeiptr size)
const;
243 void clearData(gl::GLenum internalformat, gl::GLenum format, gl::GLenum type,
const void * data =
nullptr);
250 void clearSubData(gl::GLenum internalformat, gl::GLintptr offset, gl::GLsizeiptr size, gl::GLenum format, gl::GLenum type,
const void * data =
nullptr);
264 void getSubData(gl::GLintptr offset, gl::GLsizeiptr size,
void * data)
const;
268 template <
typename T>
269 std::vector<T>
getSubData(gl::GLsizeiptr count, gl::GLintptr offset = 0)
const;
273 template <
typename T, std::
size_t Count>
274 std::array<T, Count>
getSubData(gl::GLintptr offset = 0)
const;
306#include <globjects/Buffer.inl>
Wrapper for OpenGL buffer objects.
Definition Buffer.h:36
void invalidateSubData(gl::GLintptr offset, gl::GLsizeiptr length) const
Wraps the OpenGL function gl::glInvalidateBufferSubData.
std::vector< T > getSubData(gl::GLsizeiptr count, gl::GLintptr offset=0) const
Convenience method to simplify getting of data in form of an std::vector.
void setSubData(const std::vector< T > &data, gl::GLintptr offset=0)
Convenience method to simplify passing of data in form of an std::vector.
static void hintBindlessImplementation(BindlessImplementation impl)
gl::GLint64 getParameter64(gl::GLenum pname) const
Wraps the OpenGL function gl::glGetBufferParameter for 64 bit data types. Queries OpenGL for internal...
gl::GLint getParameter(gl::GLenum pname) const
Wraps the OpenGL function gl::glGetBufferParameter. Queries OpenGL for internal state of the buffer.
void setStorage(const std::array< T, Count > &data, gl::BufferStorageMask flags)
Convenience method to simplify passing of data in form of an std::array.
void setData(gl::GLsizeiptr size, const gl::GLvoid *data, gl::GLenum usage)
Wraps the OpenGL function glBufferData. Creates video memory for the buffer.
void setData(const std::vector< T > &data, gl::GLenum usage)
Convenience method to simplify passing of data in form of an std::vector.
void invalidateData() const
Wraps the OpenGL function gl::glInvalidateBufferData.
void getSubData(gl::GLintptr offset, gl::GLsizeiptr size, void *data) const
Wraps the OpenGL function glGetBufferSubData. Retrieves the contents of the buffers data store.
BindlessImplementation
Definition Buffer.h:39
static void setWorkingTarget(gl::GLenum target)
Sets the target that is used for binding buffers to call state changing OpenGL functions....
void setSubData(gl::GLintptr offset, gl::GLsizeiptr size, const gl::GLvoid *data=nullptr)
Wraps the OpenGL function glBufferSubData. Writes data only to a defined area of the memory.
static void unbind(gl::GLenum target)
Unbinds a specific target, i.e. binds a 0 id to the target.
void bindBase(gl::GLenum target, gl::GLuint index) const
Wraps the OpenGL function gl::glBindBufferBase.
void * getPointer(gl::GLenum pname)
bool unmap() const
Wraps the OpenGL function glUnmapBuffer.
void flushMappedRange(gl::GLintptr offset, gl::GLsizeiptr length)
Wraps the OpenGL function glFlushMappedBufferRange.
const void * map() const
Maps the Buffer's memory read only.
void bind(gl::GLenum target) const
Binds the buffer to target.
void bindRange(gl::GLenum target, gl::GLuint index, gl::GLintptr offset, gl::GLsizeiptr size) const
Wraps the OpenGL function gl::glBindBufferRange.
void copyData(Buffer *buffer, gl::GLsizeiptr size, gl::GLenum usage) const
Creates new uninitialized memory to fit size (using usage), then copies the contents of buffer to thi...
Buffer(IDResource *resource)
Creates a buffer with an external id.
void copySubData(Buffer *buffer, gl::GLsizeiptr size) const
Convenience method. Both readOffset and writeOffset are 0.
void copySubData(Buffer *buffer, gl::GLintptr readOffset, gl::GLintptr writeOffset, gl::GLsizeiptr size) const
Wraps the OpenGL function glCopyBufferSubData.
void setStorage(const std::vector< T > &data, gl::BufferStorageMask flags)
Convenience method to simplify passing of data in form of an std::vector.
void clearSubData(gl::GLenum internalformat, gl::GLintptr offset, gl::GLsizeiptr size, gl::GLenum format, gl::GLenum type, const void *data=nullptr)
Wraps the OpenGL function gl::glClearBufferSubData.
void * map(gl::GLenum access)
Maps the Buffer's memory using the internal target.
const void * getPointer() const
void * mapRange(gl::GLintptr offset, gl::GLsizeiptr length, gl::BufferAccessMask access)
Wraps the OpenGL function glMapBufferRange. Maps only a range of the buffers memory.
void setStorage(const T &data, gl::BufferStorageMask flags)
Convenience method to simplify passing of data in form of a POD struct.
void setStorage(gl::GLsizeiptr size, const gl::GLvoid *data, gl::BufferStorageMask flags)
Wraps the OpenGL function glBufferStorage.
Buffer()
Creates a new OpenGL buffer object.
virtual void accept(ObjectVisitor &visitor) override
Implements the visitor pattern.
static void unbind(gl::GLenum target, gl::GLuint index)
Unbinds the buffer bound to the target and index.
void clearData(gl::GLenum internalformat, gl::GLenum format, gl::GLenum type, const void *data=nullptr)
Wraps the OpenGL function gl::glClearBufferData. Clears the Buffer's data by filling it with the valu...
void setSubData(const std::array< T, Count > &data, gl::GLintptr offset=0)
Convenience method to simplify passing of data in form of an std::array.
void setData(const T &data, gl::GLenum usage)
Convenience method to simplify passing of data in form of a POD struct.
const void * getPointer(gl::GLenum pname) const
void setSubData(const T &data, gl::GLintptr offset=0)
Convenience method to simplify passing of data in form of a POD struct.
void setData(const std::array< T, Count > &data, gl::GLenum usage)
Convenience method to simplify passing of data in form of an std::array.
std::array< T, Count > getSubData(gl::GLintptr offset=0) const
Convenience method to simplify getting of data in form of an std::array.
static Buffer * fromId(gl::GLuint id)
Creates a buffer with an external id. This object does not own the associated OpenGL object and will ...
virtual gl::GLenum objectType() const override
Superclass of all wrapped OpenGL objects.
Definition Object.h:27
Implements a Visitor Pattern to iterate over all tracked globjects objects.
Definition ObjectVisitor.h:30
Contains all the classes that wrap OpenGL functionality.