|
OpenEnroth 2ef3484
|
#include <OpenGLVertexBuffer.h>
Public Member Functions | |
| OpenGLVertexBuffer ()=default | |
| ~OpenGLVertexBuffer () | |
| OpenGLVertexBuffer (const OpenGLVertexBuffer &)=delete | |
| OpenGLVertexBuffer & | operator= (const OpenGLVertexBuffer &)=delete |
| OpenGLVertexBuffer (OpenGLVertexBuffer &&other) noexcept | |
| OpenGLVertexBuffer & | operator= (OpenGLVertexBuffer &&other) noexcept |
| void | swap (OpenGLVertexBuffer &other) noexcept |
| template<typename... Attrs> | |
| void | reset (GLenum usage, Attrs... attrs) |
| void | reset () |
| void | update (std::span< const Vertex > data) |
| void | bind () const |
| operator bool () const | |
| bool | operator! () const |
Static Public Member Functions | |
| static void | unbind () |
Private Member Functions | |
| template<typename MemberType > | |
| void | setupAttribute (GLuint location, MemberType Vertex::*ptr) |
Private Attributes | |
| GLuint | _vao = 0 |
| GLuint | _vbo = 0 |
| GLenum | _usage = GL_DYNAMIC_DRAW |
RAII wrapper for OpenGL VAO/VBO pair with type-safe attribute setup.
Usage:
|
default |
|
inline |
|
delete |
|
inlinenoexcept |
|
inline |
Bind the VAO for drawing.
|
inline |
Check if the buffer has been initialized.
|
inline |
|
delete |
|
inlinenoexcept |
|
inline |
Release OpenGL resources.
|
inline |
Initialize the VAO/VBO with specified attribute layout.
| usage | GL_STATIC_DRAW, GL_DYNAMIC_DRAW, etc. |
| attrs | Pointer-to-member for each vertex attribute (in shader location order). |
|
inlineprivate |
|
inlinenoexcept |
|
inlinestatic |
Unbind any VAO. Static since it doesn't depend on instance state.
|
inline |
Upload vertex data to the buffer.
|
private |
|
private |
|
private |