moGL
travis-test-3
Modern OpenGL wrapper, thin C++14 header-only layer on top of the OpenGL 4.5+ core spec
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 #ifndef MOGL_BUFFER_INCLUDED 00014 #define MOGL_BUFFER_INCLUDED 00015 00016 #include <mogl/object/handle.hpp> 00017 00018 namespace mogl 00019 { 00020 class Buffer : public Handle<GLuint> 00021 { 00022 protected: 00023 Buffer(GLenum target); 00024 00025 public: 00026 ~Buffer(); 00027 00028 Buffer(const Buffer& other) = delete; 00029 Buffer& operator=(const Buffer& other) = delete; 00030 00031 Buffer(Buffer&& other) = default; 00032 00033 public: 00034 void setStorage(GLsizeiptr size, const void* data, GLbitfield flags); 00035 void setData(GLsizeiptr size, const void* data, GLenum usage); 00036 void setSubData(GLintptr offset, GLsizeiptr size, const void* data); 00037 void copySubData(GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); 00038 void clearData(GLenum internalformat, GLenum format, GLenum type, const void* data); 00039 void clearSubData(GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void* data); 00040 void invalidateData(); 00041 void invalidateSubData(GLintptr offset, GLsizeiptr length); 00042 void* map(GLenum access); 00043 void* mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access); 00044 bool unmap(); 00045 void flushMappedRange(GLintptr offset, GLsizeiptr length); 00046 template <class T> void get(GLenum property, T* value); // Direct call to glGetNamedBufferParameter*v() 00047 template <class T> T get(GLenum property); 00048 void* getBufferPointer(); /* call to glGetNamedBufferPointerv */ 00049 void getSubData(GLintptr offset, GLsizeiptr size, void* data); 00050 GLenum getTarget() const; 00051 bool isHandleValid() const override final; 00052 00053 protected: 00054 void bind(); 00055 void bindBufferBase(GLuint index); 00056 void bindBufferRange(GLuint index, GLintptr offset, GLsizeiptr size); 00057 00058 private: 00059 const GLenum _target; 00060 }; 00061 } 00062 00063 #include "buffer.inl" 00064 00065 #endif // MOGL_BUFFER_INCLUDED