YourGameLib
Loading...
Searching...
No Matches
buffer.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_GLBUFFER_H
21#define YOURGAME_GLBUFFER_H
22
23#include "yourgame/gl_include.h"
24
25namespace yourgame
26{
27 namespace gl
28 {
29 class Buffer
30 {
31 public:
32 static Buffer *make(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
33 ~Buffer();
34 void bind();
35 void unbindTarget();
36 bool bufferData(GLsizeiptr size, const GLvoid *data);
37
38 /* deleting the copy constructor and the copy assignment operator
39 prevents copying (and moving) of the object. */
40 Buffer(Buffer const &) = delete;
41 Buffer &operator=(Buffer const &) = delete;
42
43 private:
44 Buffer() {}
45 GLenum m_target;
46 GLuint m_handle;
47 GLenum m_usage;
48 };
49 } // namespace gl
50} // namespace yourgame
51
52#endif
Definition buffer.h:30
bool bufferData(GLsizeiptr size, const GLvoid *data)
Definition buffer.cpp:67
void bind()
Definition buffer.cpp:57
Buffer(Buffer const &)=delete
~Buffer()
Definition buffer.cpp:52
static Buffer * make(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
Definition buffer.cpp:27
void unbindTarget()
Definition buffer.cpp:62
Buffer & operator=(Buffer const &)=delete
Definition audio.h:27