1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "abstractobjecthelper_p.h"
5
6QT_BEGIN_NAMESPACE
7
8AbstractObjectHelper::AbstractObjectHelper()
9 : m_vertexbuffer(0),
10 m_normalbuffer(0),
11 m_uvbuffer(0),
12 m_elementbuffer(0),
13 m_indexCount(0),
14 m_meshDataLoaded(false)
15{
16 initializeOpenGLFunctions();
17}
18
19AbstractObjectHelper::~AbstractObjectHelper()
20{
21 if (QOpenGLContext::currentContext()) {
22 glDeleteBuffers(n: 1, buffers: &m_vertexbuffer);
23 glDeleteBuffers(n: 1, buffers: &m_uvbuffer);
24 glDeleteBuffers(n: 1, buffers: &m_normalbuffer);
25 glDeleteBuffers(n: 1, buffers: &m_elementbuffer);
26 }
27}
28
29GLuint AbstractObjectHelper::vertexBuf()
30{
31 if (!m_meshDataLoaded)
32 qFatal(msg: "No loaded object");
33 return m_vertexbuffer;
34}
35
36GLuint AbstractObjectHelper::normalBuf()
37{
38 if (!m_meshDataLoaded)
39 qFatal(msg: "No loaded object");
40 return m_normalbuffer;
41}
42
43GLuint AbstractObjectHelper::uvBuf()
44{
45 if (!m_meshDataLoaded)
46 qFatal(msg: "No loaded object");
47 return m_uvbuffer;
48}
49
50GLuint AbstractObjectHelper::elementBuf()
51{
52 if (!m_meshDataLoaded)
53 qFatal(msg: "No loaded object");
54 return m_elementbuffer;
55}
56
57GLuint AbstractObjectHelper::indexCount()
58{
59 return m_indexCount;
60}
61
62QT_END_NAMESPACE
63

source code of qtdatavis3d/src/datavisualization/utils/abstractobjecthelper.cpp