@@ -1,83 +1,82 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | // W A R N I N G |
|
23 | 23 | // ------------- |
|
24 | 24 | // |
|
25 | 25 | // This file is not part of the Qt Chart API. It exists purely as an |
|
26 | 26 | // implementation detail. This header file may change from version to |
|
27 | 27 | // version without notice, or even be removed. |
|
28 | 28 | // |
|
29 | 29 | // We mean it. |
|
30 | 30 | |
|
31 | 31 | #ifndef GLWIDGET_H |
|
32 | 32 | #define GLWIDGET_H |
|
33 | 33 | |
|
34 | 34 | #ifndef QT_NO_OPENGL |
|
35 | 35 | |
|
36 | 36 | #include <QtWidgets/QOpenGLWidget> |
|
37 | 37 | #include <QtGui/QOpenGLFunctions> |
|
38 | 38 | #include <QtGui/QOpenGLVertexArrayObject> |
|
39 | #include <QtGui/QOpenGLBuffer> | |
|
39 | 40 | #include <QtCore/QHash> |
|
40 | 41 | #include <QtCharts/QAbstractSeries> |
|
41 | 42 | #include <QtCharts/QXYSeries> |
|
42 | 43 | |
|
43 | 44 | QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram) |
|
44 | 45 | |
|
45 | class QOpenGLBuffer; | |
|
46 | ||
|
47 | 46 | QT_CHARTS_BEGIN_NAMESPACE |
|
48 | 47 | |
|
49 | 48 | class GLXYSeriesDataManager; |
|
50 | 49 | |
|
51 | 50 | class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions |
|
52 | 51 | { |
|
53 | 52 | Q_OBJECT |
|
54 | 53 | |
|
55 | 54 | public: |
|
56 | 55 | GLWidget(GLXYSeriesDataManager *xyDataManager, QWidget *parent = 0); |
|
57 | 56 | ~GLWidget(); |
|
58 | 57 | |
|
59 | 58 | public Q_SLOTS: |
|
60 | 59 | void cleanup(); |
|
61 | 60 | void cleanXYSeriesResources(const QXYSeries *series); |
|
62 | 61 | |
|
63 | 62 | protected: |
|
64 | 63 | void initializeGL() Q_DECL_OVERRIDE; |
|
65 | 64 | void paintGL() Q_DECL_OVERRIDE; |
|
66 | 65 | void resizeGL(int width, int height) Q_DECL_OVERRIDE; |
|
67 | 66 | |
|
68 | 67 | private: |
|
69 | 68 | QOpenGLShaderProgram *m_program; |
|
70 | 69 | int m_shaderAttribLoc; |
|
71 | 70 | int m_colorUniformLoc; |
|
72 | 71 | int m_minUniformLoc; |
|
73 | 72 | int m_deltaUniformLoc; |
|
74 | 73 | int m_pointSizeUniformLoc; |
|
75 | 74 | QOpenGLVertexArrayObject m_vao; |
|
76 | 75 | |
|
77 | 76 | QHash<const QAbstractSeries *, QOpenGLBuffer *> m_seriesBufferMap; |
|
78 | 77 | GLXYSeriesDataManager *m_xyDataManager; |
|
79 | 78 | }; |
|
80 | 79 | |
|
81 | 80 | QT_CHARTS_END_NAMESPACE |
|
82 | 81 | #endif |
|
83 | 82 | #endif |
@@ -1,77 +1,76 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | #ifndef DECLARATIVERENDERNODE_P_H |
|
23 | 23 | #define DECLARATIVERENDERNODE_P_H |
|
24 | 24 | |
|
25 | 25 | #include <QtCharts/QChartGlobal> |
|
26 | 26 | #include <private/glxyseriesdata_p.h> |
|
27 | 27 | #include <QtQuick/QSGSimpleTextureNode> |
|
28 | 28 | #include <QtQuick/QQuickWindow> |
|
29 | 29 | #include <QtGui/QOpenGLVertexArrayObject> |
|
30 | 30 | #include <QtGui/QOpenGLFunctions> |
|
31 | ||
|
32 | class QOpenGLFramebufferObject; | |
|
33 | class QOpenGLBuffer; | |
|
31 | #include <QtGui/QOpenGLFramebufferObject> | |
|
32 | #include <QtGui/QOpenGLBuffer> | |
|
34 | 33 | |
|
35 | 34 | QT_CHARTS_BEGIN_NAMESPACE |
|
36 | 35 | |
|
37 | 36 | class DeclarativeRenderNode : public QObject, public QSGSimpleTextureNode, QOpenGLFunctions |
|
38 | 37 | { |
|
39 | 38 | Q_OBJECT |
|
40 | 39 | public: |
|
41 | 40 | DeclarativeRenderNode(QQuickWindow *window); |
|
42 | 41 | ~DeclarativeRenderNode(); |
|
43 | 42 | |
|
44 | 43 | void initGL(); |
|
45 | 44 | QSize textureSize() const { return m_textureSize; } |
|
46 | 45 | void setTextureSize(const QSize &size); |
|
47 | 46 | void setSeriesData(bool mapDirty, const GLXYDataMap &dataMap); |
|
48 | 47 | |
|
49 | 48 | public Q_SLOTS: |
|
50 | 49 | void render(); |
|
51 | 50 | |
|
52 | 51 | private: |
|
53 | 52 | void renderGL(); |
|
54 | 53 | void recreateFBO(); |
|
55 | 54 | void cleanXYSeriesResources(const QXYSeries *series); |
|
56 | 55 | |
|
57 | 56 | QSGTexture *m_texture; |
|
58 | 57 | QQuickWindow *m_window; |
|
59 | 58 | QQuickWindow::CreateTextureOptions m_textureOptions; |
|
60 | 59 | QSize m_textureSize; |
|
61 | 60 | bool m_recreateFbo; |
|
62 | 61 | GLXYDataMap m_xyDataMap; |
|
63 | 62 | QOpenGLFramebufferObject *m_fbo; |
|
64 | 63 | QOpenGLShaderProgram *m_program; |
|
65 | 64 | int m_shaderAttribLoc; |
|
66 | 65 | int m_colorUniformLoc; |
|
67 | 66 | int m_minUniformLoc; |
|
68 | 67 | int m_deltaUniformLoc; |
|
69 | 68 | int m_pointSizeUniformLoc; |
|
70 | 69 | QOpenGLVertexArrayObject m_vao; |
|
71 | 70 | QHash<const QAbstractSeries *, QOpenGLBuffer *> m_seriesBufferMap; |
|
72 | 71 | bool m_renderNeeded; |
|
73 | 72 | }; |
|
74 | 73 | |
|
75 | 74 | QT_CHARTS_END_NAMESPACE |
|
76 | 75 | |
|
77 | 76 | #endif // DECLARATIVERENDERNODE_P_H |
General Comments 0
You need to be logged in to leave comments.
Login now