Carna Version 3.3.3
Loading...
Searching...
No Matches
BaseBuffer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 - 2015 Leonid Kostrykin
3 *
4 * Chair of Medical Engineering (mediTEC)
5 * RWTH Aachen University
6 * Pauwelsstr. 20
7 * 52074 Aachen
8 * Germany
9 *
10 */
11
12#ifndef BASEBUFFER_H_6014714286
13#define BASEBUFFER_H_6014714286
14
15#include <cstdlib>
16
21namespace Carna
22{
23
24namespace base
25{
26
27
28
29// ----------------------------------------------------------------------------------
30// BaseBuffer
31// ----------------------------------------------------------------------------------
32
39class CARNA_LIB BaseBuffer
40{
41
42 std::size_t mySize;
43
44protected:
45
49 bool valid;
50
57 explicit BaseBuffer( unsigned int target );
58
62 void setSize( std::size_t size );
63
64public:
65
69 virtual ~BaseBuffer();
70
74 const unsigned int target;
75
79 const unsigned int id;
80
84 std::size_t size() const;
85
89 void bind() const;
90
94 bool isValid() const;
95
96}; // BaseBuffer
97
98
99
100} // namespace Carna :: base
101
102} // namespace Carna
103
104#endif // BASEBUFFER_H_6014714286
Implements OpenGL buffer objects maintenance RAII base class.
Definition BaseBuffer.h:40
bool valid
Flag that indicates whether the maintained OpenGL buffer object is valid.
Definition BaseBuffer.h:49
void setSize(std::size_t size)
Sets the size of the maintained buffer object.
void bind() const
Invokes glBindBuffer to bind the maintained buffer object to target.
const unsigned int target
Holds where the maintained buffer object is to be bound to by glBindBuffer.
Definition BaseBuffer.h:74
virtual ~BaseBuffer()
Deletes 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 id
Holds the ID of the maintained OpenGL buffer object.
Definition BaseBuffer.h:79
BaseBuffer(unsigned int target)
Acquires new OpenGL buffer object.