LibCarna Version 3.4.0
Loading...
Searching...
No Matches
BaseBuffer.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 - 2016 Leonid Kostrykin
3 *
4 * Chair of Medical Engineering (mediTEC)
5 * RWTH Aachen University
6 * Pauwelsstr. 20
7 * 52074 Aachen
8 * Germany
9 *
10 *
11 * Copyright (C) 2021 - 2025 Leonid Kostrykin
12 *
13 */
14
15#ifndef BASEBUFFER_H_6014714286
16#define BASEBUFFER_H_6014714286
17
18#include <cstdlib>
19
25namespace LibCarna
26{
27
28namespace base
29{
30
31
32
33// ----------------------------------------------------------------------------------
34// BaseBuffer
35// ----------------------------------------------------------------------------------
36
42class LIBCARNA BaseBuffer
43{
44
45 std::size_t mySize;
46
47protected:
48
52 bool valid;
53
60 explicit BaseBuffer( unsigned int target );
61
65 void setSize( std::size_t size );
66
67public:
68
72 virtual ~BaseBuffer();
73
77 const unsigned int target;
78
82 const unsigned int id;
83
87 std::size_t size() const;
88
92 void bind() const;
93
97 bool isValid() const;
98
99}; // BaseBuffer
100
101
102
103} // namespace LibCarna :: base
104
105} // namespace LibCarna
106
107#endif // BASEBUFFER_H_6014714286
Implements OpenGL buffer objects maintenance RAII base class.
void bind() const
Invokes glBindBuffer to bind the maintained buffer object to target.
BaseBuffer(unsigned int target)
Acquires new OpenGL buffer object.
bool valid
Flag that indicates whether the maintained OpenGL buffer object is valid.
void setSize(std::size_t size)
Sets the size of the maintained buffer object.
virtual ~BaseBuffer()
Deletes the maintained OpenGL buffer object.
const unsigned int id
Holds the ID of the maintained OpenGL buffer object.
bool isValid() const
Tells whether the buffer object was marked as valid.
std::size_t size() const
Tells the previously set size of the maintained buffer object.
const unsigned int target
Holds where the maintained buffer object is to be bound to by glBindBuffer.