| 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 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class GLStateStore : public QObject, protected QOpenGLFunctions |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | public: |
| 27 | explicit GLStateStore(QOpenGLContext *context, QObject *parent = 0); |
| 28 | ~GLStateStore(); |
| 29 | |
| 30 | void storeGLState(); |
| 31 | void restoreGLState(); |
| 32 | void initGLDefaultState(); |
| 33 | |
| 34 | #ifdef VERBOSE_STATE_STORE |
| 35 | void printCurrentState(bool in); |
| 36 | EnumToStringMap *m_map; |
| 37 | #endif |
| 38 | |
| 39 | GLint m_scissorBox[4]; |
| 40 | GLboolean m_isScissorTestEnabled; |
| 41 | |
| 42 | #if !QT_CONFIG(opengles2) |
| 43 | GLint m_drawFramebuffer; |
| 44 | GLint m_readFramebuffer; |
| 45 | GLint m_renderbuffer; |
| 46 | #endif |
| 47 | GLfloat m_clearColor[4]; |
| 48 | GLfloat m_clearDepth; |
| 49 | GLboolean m_isBlendingEnabled; |
| 50 | GLboolean m_isDepthTestEnabled; |
| 51 | GLint m_depthFunc; |
| 52 | GLboolean m_isDepthWriteEnabled; |
| 53 | GLint m_currentProgram; |
| 54 | GLint m_maxVertexAttribs; |
| 55 | QScopedArrayPointer<GLint> m_vertexAttribArrayEnabledStates; |
| 56 | QScopedArrayPointer<GLint> m_vertexAttribArrayBoundBuffers; |
| 57 | QScopedArrayPointer<GLint> m_vertexAttribArraySizes; |
| 58 | QScopedArrayPointer<GLint> m_vertexAttribArrayTypes; |
| 59 | QScopedArrayPointer<GLint> m_vertexAttribArrayNormalized; |
| 60 | QScopedArrayPointer<GLint> m_vertexAttribArrayStrides; |
| 61 | QScopedArrayPointer<void *> m_vertexAttribArrayOffsets; |
| 62 | |
| 63 | GLint m_activeTexture; |
| 64 | GLint m_texBinding2D; |
| 65 | GLint m_frontFace; |
| 66 | GLboolean m_isCullFaceEnabled; |
| 67 | GLint m_cullFaceMode; |
| 68 | GLint m_blendEquationRGB; |
| 69 | GLint m_blendEquationAlpha; |
| 70 | GLint m_blendDestAlpha; |
| 71 | GLint m_blendDestRGB; |
| 72 | GLint m_blendSrcAlpha; |
| 73 | GLint m_blendSrcRGB; |
| 74 | GLint m_boundArrayBuffer; |
| 75 | GLint m_boundElementArrayBuffer; |
| 76 | GLboolean m_polygonOffsetFillEnabled; |
| 77 | GLfloat m_polygonOffsetFactor; |
| 78 | GLfloat m_polygonOffsetUnits; |
| 79 | }; |
| 80 | |
| 81 | QT_END_NAMESPACE |
| 82 | |
| 83 | #endif |
| 84 |
