summaryrefslogtreecommitdiffstats
path: root/tests/manual/opengl/glbox.h
blob: d063d8b56925a2b2dc6ab6ef06e7d948ef346c86 (plain)
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
53
// Copyright (C) 2015 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

/****************************************************************************
**
** This is a simple QGLWidget displaying an openGL wireframe box
**
****************************************************************************/

#ifndef GLBOX_H
#define GLBOX_H

#include <QOpenGLWidget>
#include <QOpenGLFunctions_1_1>
//! [0]
#include <QAxBindable>

class GLBox : public QOpenGLWidget,
              public QOpenGLFunctions_1_1,
              public QAxBindable
{
    Q_OBJECT
    Q_CLASSINFO("ClassID",     "{5fd9c22e-ed45-43fa-ba13-1530bb6b03e0}")
    Q_CLASSINFO("InterfaceID", "{33b051af-bb25-47cf-a390-5cfd2987d26a}")
    Q_CLASSINFO("EventsID",    "{8c996c29-eafa-46ac-a6f9-901951e765b5}")
    //! [0] //! [1]

public:
    explicit GLBox(QWidget *parent, const char *name = nullptr);
    virtual ~GLBox();
    QAxAggregated *createAggregate() override;

public slots:
    void                setXRotation(int degrees);
//! [1]
    void                setYRotation(int degrees);
    void                setZRotation(int degrees);

protected:
    void                initializeGL() override;
    void                paintGL() override;
    void                resizeGL(int w, int h) override;
    virtual GLuint      makeObject();

private:
    GLuint  m_object = 0;
    GLdouble m_xRot = 0;
    GLdouble m_yRot = 0;
    GLdouble m_zRot = 0;
    GLdouble m_scale = 1.25;
};

#endif // GLBOX_H