1 #ifndef MSP_GL_BUFFER_H_
2 #define MSP_GL_BUFFER_H_
12 class buffer_too_small: public std::logic_error
15 buffer_too_small(const std::string &w): std::logic_error(w) { }
16 virtual ~buffer_too_small() throw() { }
22 A buffer for storing data in GL memory. Putting vertex and index data in
23 buffers can improve rendering performance. The VertexArray, Mesh and
24 UniformBlock classes contain built-in support for buffers.
28 friend class PipelineState;
29 friend class Texture2D;
30 friend class VertexSetup;
36 static Buffer *scratch_binding;
42 /** Defines the storage size of the buffer. Must be called before data can
43 be uploaded. Storage cannot be changed once set. */
44 void storage(unsigned);
46 /** Uploads data into the buffer, completely replacing any previous
47 contents. Storage must be defined beforehand. The data must have size
48 matching the defined storage. */
49 void data(const void *);
51 /** Overwrites part of the buffer data with new data. Storage must be
52 defined beforehand. */
53 void sub_data(unsigned, unsigned, const void *);
55 unsigned get_size() const { return size; }
57 void require_size(unsigned) const;
62 void set_debug_name(const std::string &);
67 static void unbind_scratch();