]> git.tdb.fi Git - libs/gl.git/blobdiff - source/vertexarray.cpp
Inherit Loaders from the ObjectLoader classes
[libs/gl.git] / source / vertexarray.cpp
index de343bf7065a07aa573377a6e49be8114dd60356..a2b65daa6d15dd91635c092a73e2434e76a9b51f 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of libmspgl
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2009  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -35,13 +35,13 @@ void VertexArray::use_vertex_buffer()
        if(vbuf && own_vbuf)
                return;
 
-       vbuf=new VertexBuffer();
+       vbuf=new Buffer(ARRAY_BUFFER);
        own_vbuf=true;
 
        update_data();
 }
 
-void VertexArray::use_vertex_buffer(VertexBuffer *b)
+void VertexArray::use_vertex_buffer(Buffer *b)
 {
        if(own_vbuf)
                delete vbuf;
@@ -108,7 +108,7 @@ void VertexArray::apply() const
                                glColorPointer(sz, GL_FLOAT, bpv, base+offset);
                        break;
                default:
-                       glVertexAttribPointerARB(t-3, sz, GL_FLOAT, false, bpv, base+offset);
+                       glVertexAttribPointerARB(t-4, sz, GL_FLOAT, false, bpv, base+offset);
                        break;
                }
                found|=1<<t;
@@ -120,10 +120,10 @@ void VertexArray::apply() const
        set_array(GL_TEXTURE_COORD_ARRAY, found&4, 4);
        set_array(GL_COLOR_ARRAY, found&8, 8);
        for(unsigned i=4; i<32; ++i)
-               set_array(i-3, (found>>i)&1, 1<<i);
+               set_array(i-4, (found>>i)&1, 1<<i);
 
        if(vbuf)
-               VertexBuffer::unbind();
+               vbuf->unbind();
 }
 
 /**
@@ -134,7 +134,7 @@ void VertexArray::update_data()
        if(vbuf)
        {
                vbuf->data(data.size()*sizeof(float), &data[0]);
-               VertexBuffer::unbind();
+               vbuf->unbind();
        }
 }