]> git.tdb.fi Git - libs/gl.git/blobdiff - source/mesh.h
Add vertex array object support to Mesh
[libs/gl.git] / source / mesh.h
index 6181d5fb9bc1b9126248d2e786f826a77c7c92bd..2aba273e2b2539cc567a66a25f8525f519c446c9 100644 (file)
@@ -17,7 +17,7 @@ Raw mesh data, consisting of a VertexArray and one or more Batches.  Though a
 Mesh can draw itself, it's usually used as part of Renderables rather than on
 its own.
 */
-class Mesh
+class Mesh: public Bindable<Mesh>
 {
        friend class MeshBuilder;
 
@@ -37,7 +37,9 @@ private:
        std::list<Batch> batches;
        Buffer *vbuf;
        Buffer *ibuf;
+       unsigned vao_id;
        bool defer_buffers;
+       mutable unsigned char dirty;
        const WindingTest *winding;
 
 public:
@@ -49,6 +51,7 @@ public:
        void use_buffers(bool);
 private:
        void create_buffers();
+       void refresh() const;
 
 public:
        const VertexArray &get_vertices() const { return vertices; }
@@ -62,6 +65,10 @@ public:
 
        void draw() const;
        void draw(Renderer &) const;
+
+       void bind() const;
+
+       static void unbind();
 };
 
 } // namespace GL