1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the QtDataVisualization API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13
14#ifndef GLSTATESTORE_P_H
15#define GLSTATESTORE_P_H
16
17#include <QtGui/QOpenGLFunctions>
18#include <QtCore/QScopedArrayPointer>
19#include "enumtostringmap_p.h"
20
21class GLStateStore : public QObject, protected QOpenGLFunctions
22{
23 Q_OBJECT
24public:
25 explicit GLStateStore(QOpenGLContext *context, QObject *parent = 0);
26 ~GLStateStore();
27
28 void storeGLState();
29 void restoreGLState();
30 void initGLDefaultState();
31
32#ifdef VERBOSE_STATE_STORE
33 void printCurrentState(bool in);
34 EnumToStringMap *m_map;
35#endif
36
37 GLint m_scissorBox[4];
38 GLboolean m_isScissorTestEnabled;
39
40#if !QT_CONFIG(opengles2)
41 GLint m_drawFramebuffer;
42 GLint m_readFramebuffer;
43 GLint m_renderbuffer;
44#endif
45 GLfloat m_clearColor[4];
46 GLfloat m_clearDepth;
47 GLboolean m_isBlendingEnabled;
48 GLboolean m_isDepthTestEnabled;
49 GLint m_depthFunc;
50 GLboolean m_isDepthWriteEnabled;
51 GLint m_currentProgram;
52 GLint m_maxVertexAttribs;
53 QScopedArrayPointer<GLint> m_vertexAttribArrayEnabledStates;
54 QScopedArrayPointer<GLint> m_vertexAttribArrayBoundBuffers;
55 QScopedArrayPointer<GLint> m_vertexAttribArraySizes;
56 QScopedArrayPointer<GLint> m_vertexAttribArrayTypes;
57 QScopedArrayPointer<GLint> m_vertexAttribArrayNormalized;
58 QScopedArrayPointer<GLint> m_vertexAttribArrayStrides;
59 QScopedArrayPointer<void *> m_vertexAttribArrayOffsets;
60
61 GLint m_activeTexture;
62 GLint m_texBinding2D;
63 GLint m_frontFace;
64 GLboolean m_isCullFaceEnabled;
65 GLint m_cullFaceMode;
66 GLint m_blendEquationRGB;
67 GLint m_blendEquationAlpha;
68 GLint m_blendDestAlpha;
69 GLint m_blendDestRGB;
70 GLint m_blendSrcAlpha;
71 GLint m_blendSrcRGB;
72 GLint m_boundArrayBuffer;
73 GLint m_boundElementArrayBuffer;
74 GLboolean m_polygonOffsetFillEnabled;
75 GLfloat m_polygonOffsetFactor;
76 GLfloat m_polygonOffsetUnits;
77};
78
79#endif
80

source code of qtdatavis3d/src/datavisualizationqml/glstatestore_p.h