X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fgraphicsbuffer.h;h=9513cb74a1842faa7a14eb1c241d0c96a503128e;hb=f8ef964f021d1d6da6ea46bbb1fe8f0250a5be8c;hp=15e5b427da66a6e599563d7ad9bdf69dc1983454;hpb=81786f2f649a1d73ef8d4e40dc03beec4fd53698;p=ipdf%2Fcode.git diff --git a/src/graphicsbuffer.h b/src/graphicsbuffer.h index 15e5b42..9513cb7 100644 --- a/src/graphicsbuffer.h +++ b/src/graphicsbuffer.h @@ -2,14 +2,13 @@ #define _GRAPHICSBUFFER_H #include -#define GL_GLEXT_PROTOTYPES -#include +#include "gl_core44.h" namespace IPDF { - /* - * The "Screen" class handles managing the OS window (using SDL2). + /** + * Implementation of an OpenGL buffer, with some extra cleverness. */ class GraphicsBuffer { @@ -52,15 +51,21 @@ namespace IPDF void UploadRange(size_t length, intptr_t offset, const void *data); void Resize(size_t length); + const size_t GetSize() const { return m_buffer_size; } + + void Invalidate(); - void Bind(); + void Bind() const; private: + bool RecreateBuffer(const void *data = nullptr); GLuint m_buffer_handle; BufferType m_buffer_type; BufferUsage m_buffer_usage; void *m_map_pointer; size_t m_buffer_size; bool m_invalidated; + bool m_buffer_shape_dirty; + bool m_faking_map; }; }