X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbufferable.h;fp=source%2Fbufferable.h;h=dd7cff8e9b0a1c37b8e43416ec89ad607ccfeb45;hp=0000000000000000000000000000000000000000;hb=bd3e61a3d71a527b7b87197c2f52c5cf342aba81;hpb=ac11296dca7c7a594ff1b20bead87e1e161b4bef diff --git a/source/bufferable.h b/source/bufferable.h new file mode 100644 index 00000000..dd7cff8e --- /dev/null +++ b/source/bufferable.h @@ -0,0 +1,37 @@ +#ifndef MSP_GL_BUFFERABLE_H_ +#define MSP_GL_BUFFERABLE_H_ + +namespace Msp { +namespace GL { + +class Buffer; + +class Bufferable +{ +protected: + Buffer *buffer; + unsigned buffer_offset; + Bufferable *next_in_buffer; + Bufferable *prev_in_buffer; + mutable bool dirty; + + Bufferable(); +public: + virtual ~Bufferable(); + + void use_buffer(Buffer *, Bufferable * = 0); +private: + void unlink_from_buffer(); + +protected: + virtual unsigned get_data_size() const = 0; + virtual const void *get_data() const = 0; + + void update_buffer_offsets(); + void update_buffer_data() const; +}; + +} // namespace GL +} // namespace Msp + +#endif