1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 #ifndef INCLUDED_VCL_INC_OPENGL_BUFFEROBJECT_H
12 #define INCLUDED_VCL_INC_OPENGL_BUFFEROBJECT_H
17 template<typename TYPE
, GLenum BUFFER_TYPE
>
27 glGenBuffers(1, &mId
);
31 virtual ~BufferObject()
35 glDeleteBuffers(1, &mId
);
45 glBindBuffer(BUFFER_TYPE
, mId
);
54 glBindBuffer(BUFFER_TYPE
, 0);
59 void upload(const std::vector
<TYPE
>& rData
)
64 glBufferData(BUFFER_TYPE
, sizeof(TYPE
) * rData
.size(), rData
.data(), GL_STATIC_DRAW
);
71 template<typename TYPE
>
72 class VertexBufferObject
: public BufferObject
<TYPE
, GL_ARRAY_BUFFER
>
76 class IndexBufferObject
: public BufferObject
<GLuint
, GL_ELEMENT_ARRAY_BUFFER
>
82 #endif // INCLUDED_VCL_INC_OPENGL_BUFFEROBJECT_H
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */