X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuffer.h;h=2961cdb315ae70802847e8b5e414e325f512aa4f;hb=ffe1debbd757d20f7250fd8572c2c46cd901f559;hp=39e88cd1ce7647b74ea5f7f6b75cba575ea0d403;hpb=e19309340e90ee881e9cb2f8b7c33a5b89681aa6;p=libs%2Fgl.git diff --git a/source/buffer.h b/source/buffer.h index 39e88cd1..2961cdb3 100644 --- a/source/buffer.h +++ b/source/buffer.h @@ -1,7 +1,10 @@ #ifndef MSP_GL_BUFFER_H_ #define MSP_GL_BUFFER_H_ +#include +#include #include +#include #include "gl.h" #include #include @@ -11,6 +14,13 @@ namespace Msp { namespace GL { +class buffer_too_small: public std::logic_error +{ +public: + buffer_too_small(const std::string &w): std::logic_error(w) { } + virtual ~buffer_too_small() throw() { } +}; + enum BufferType { ARRAY_BUFFER = GL_ARRAY_BUFFER, @@ -75,7 +85,7 @@ public: /** Sets the usage hint of the buffer. It will take effect the next time the buffer's contents are defined. */ - void set_usage(BufferUsage); + DEPRECATED void set_usage(BufferUsage); /** Uploads data into the buffer, completely replacing any previous contents. */ @@ -87,9 +97,12 @@ public: unsigned get_size() const { return size; } + void require_size(unsigned) const; + BufferRange *create_range(unsigned, unsigned); - void *map(BufferAccess); + void *map(); + DEPRECATED void *map(BufferAccess) { return map(); } bool unmap(); /** Binds the buffer in its default slot. */