1 #ifndef MSP_GL_BUFFER_H_
2 #define MSP_GL_BUFFER_H_
10 class buffer_too_small: public std::logic_error
13 buffer_too_small(const std::string &w): std::logic_error(w) { }
14 virtual ~buffer_too_small() throw() { }
20 A buffer for storing data in GL memory. Putting vertex and index data in
21 buffers can improve rendering performance. The VertexArray, Mesh and
22 UniformBlock classes contain built-in support for buffers.
26 friend class PipelineState;
27 friend class Texture2D;
28 friend class VertexSetup;
34 static Buffer *scratch_binding;
40 /** Defines the storage size of the buffer. Must be called before data can
41 be uploaded. Storage cannot be changed once set. */
42 void storage(unsigned);
44 /** Uploads data into the buffer, completely replacing any previous
45 contents. Storage must be defined beforehand. The data must have size
46 matching the defined storage. */
47 void data(const void *);
49 /** Overwrites part of the buffer data with new data. Storage must be
50 defined beforehand. */
51 void sub_data(unsigned, unsigned, const void *);
53 unsigned get_size() const { return size; }
55 void require_size(unsigned) const;
60 void set_debug_name(const std::string &);
65 static void unbind_scratch();