-
Notifications
You must be signed in to change notification settings - Fork 1
/
renderableobject.cpp
52 lines (43 loc) · 957 Bytes
/
renderableobject.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "renderableobject.h"
#include <QFileInfo>
using std::vector;
RenderableObject::RenderableObject()
{
}
RenderableObject::~RenderableObject()
{
if(m_funcs) {
delete m_funcs;
m_funcs = 0;
}
if(m_program) {
delete m_program;
m_program = 0;
}
m_vboIds.clear();
}
void RenderableObject::generateVBOs()
{
m_vboIds.resize(m_numberOfVBOs);
m_funcs->glGenBuffers(m_numberOfVBOs, &m_vboIds.front());
}
unsigned int RenderableObject::numberOfVBOs() const
{
return m_numberOfVBOs;
}
void RenderableObject::setNumberOfVBOs(unsigned int numberOfVBOs)
{
m_numberOfVBOs = numberOfVBOs;
m_isInitialized = false;
}
void RenderableObject::initializeSuper()
{
if(!m_funcs) m_funcs = new QOpenGLFunctions(QOpenGLContext::currentContext());
generateVBOs();
initialize();
m_isInitialized = true;
}
bool RenderableObject::isInitialized() const
{
return m_isInitialized;
}