Buffer.h
Go to the documentation of this file.
#pragma once
#include <vector>
#include <array>
#include <glbinding/gl/types.h>
#include <globjects/globjects_api.h>
#include <globjects/Object.h>
namespace globjects
{
class GLOBJECTS_API Buffer : public Object
{
public:
enum class BindlessImplementation
{
DirectStateAccessARB
, DirectStateAccessEXT
, Legacy
};
static void hintBindlessImplementation(BindlessImplementation impl);
static void setWorkingTarget(gl::GLenum target);
public:
Buffer();
static Buffer * fromId(gl::GLuint id);
virtual void accept(ObjectVisitor & visitor) override;
void bind(gl::GLenum target) const;
static void unbind(gl::GLenum target);
static void unbind(gl::GLenum target, gl::GLuint index);
void setData(gl::GLsizeiptr size, const gl::GLvoid * data, gl::GLenum usage);
template <typename T>
void setData(const T & data, gl::GLenum usage);
template <typename T>
void setData(const std::vector<T> & data, gl::GLenum usage);
template <typename T, std::size_t Count>
void setData(const std::array<T, Count> & data, gl::GLenum usage);
void setSubData(gl::GLintptr offset, gl::GLsizeiptr size, const gl::GLvoid* data = nullptr);
template <typename T>
void setSubData(const T & data, gl::GLintptr offset = 0);
template <typename T>
void setSubData(const std::vector<T> & data, gl::GLintptr offset = 0);
template <typename T, std::size_t Count>
void setSubData(const std::array<T, Count> & data, gl::GLintptr offset = 0);
void setStorage(gl::GLsizeiptr size, const gl::GLvoid * data, gl::BufferStorageMask flags);
template <typename T>
void setStorage(const T & data, gl::BufferStorageMask flags);
template <typename T>
void setStorage(const std::vector<T> & data, gl::BufferStorageMask flags);
template <typename T, std::size_t Count>
void setStorage(const std::array<T, Count> & data, gl::BufferStorageMask flags);
gl::GLint getParameter(gl::GLenum pname) const;
gl::GLint64 getParameter64(gl::GLenum pname) const;
const void * map() const;
void * map(gl::GLenum access);
void * mapRange(gl::GLintptr offset, gl::GLsizeiptr length, gl::BufferAccessMask access);
bool unmap() const;
void flushMappedRange(gl::GLintptr offset, gl::GLsizeiptr length);
void bindBase(gl::GLenum target, gl::GLuint index) const;
void bindRange(gl::GLenum target, gl::GLuint index, gl::GLintptr offset, gl::GLsizeiptr size) const;
void copySubData(Buffer * buffer, gl::GLintptr readOffset, gl::GLintptr writeOffset, gl::GLsizeiptr size) const;
void copySubData(Buffer * buffer, gl::GLsizeiptr size) const;
void copyData(Buffer * buffer, gl::GLsizeiptr size, gl::GLenum usage) const;
void clearData(gl::GLenum internalformat, gl::GLenum format, gl::GLenum type, const void * data = nullptr);
void clearSubData(gl::GLenum internalformat, gl::GLintptr offset, gl::GLsizeiptr size, gl::GLenum format, gl::GLenum type, const void * data = nullptr);
const void * getPointer() const;
void * getPointer();
const void * getPointer(gl::GLenum pname) const;
void * getPointer(gl::GLenum pname);
void getSubData(gl::GLintptr offset, gl::GLsizeiptr size, void * data) const;
template <typename T>
std::vector<T> getSubData(gl::GLsizeiptr count, gl::GLintptr offset = 0) const;
template <typename T, std::size_t Count>
std::array<T, Count> getSubData(gl::GLintptr offset = 0) const;
void invalidateData() const;
void invalidateSubData(gl::GLintptr offset, gl::GLsizeiptr length) const;
virtual gl::GLenum objectType() const override;
protected:
Buffer(IDResource * resource);
virtual ~Buffer();
};
} // namespace globjects
#include <globjects/Buffer.inl>
globjects
Contains all the classes that wrap OpenGL functionality.
globjects::Object
Superclass of all wrapped OpenGL objects.
Definition: Object.h:26
globjects::Buffer
Wrapper for OpenGL buffer objects.
Definition: Buffer.h:35
globjects::Buffer::BindlessImplementation
BindlessImplementation
Definition: Buffer.h:38
Object.h
globjects::ObjectVisitor
Implements a Visitor Pattern to iterate over all tracked globjects objects.
Definition: ObjectVisitor.h:29