3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include "arb_vertex_buffer_object.h"
10 #include "vertexbuffer.h"
15 VertexBuffer::VertexBuffer()
17 static RequireExtension _ext("GL_ARB_vertex_buffer_object");
19 glGenBuffersARB(1, &id);
22 void VertexBuffer::bind() const
24 glBindBufferARB(GL_ARRAY_BUFFER, id);
28 void VertexBuffer::data(sizei size, void *d)
30 if(bound!=this) bind();
32 glBufferDataARB(GL_ARRAY_BUFFER, size, d, GL_STATIC_DRAW);
35 VertexBuffer::~VertexBuffer()
37 glDeleteBuffersARB(1, &id);
40 void VertexBuffer::unbind()
44 glBindBufferARB(GL_ARRAY_BUFFER, 0);
49 const VertexBuffer *VertexBuffer::bound=0;