X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuffer.h;h=2961cdb315ae70802847e8b5e414e325f512aa4f;hb=ffe1debbd757d20f7250fd8572c2c46cd901f559;hp=c473d7edc918202e9c7f3cfff2d23f77badebcaa;hpb=57de40e1e802e44ae5b4caa67b0bb8763828b5c3;p=libs%2Fgl.git diff --git a/source/buffer.h b/source/buffer.h index c473d7ed..2961cdb3 100644 --- a/source/buffer.h +++ b/source/buffer.h @@ -1,15 +1,26 @@ #ifndef MSP_GL_BUFFER_H_ #define MSP_GL_BUFFER_H_ +#include +#include #include +#include #include "gl.h" #include #include #include +#include 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, @@ -74,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. */ @@ -86,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. */