summaryrefslogtreecommitdiffstats
path: root/src/scenegraph/coreapi/qsgcontext.h
blob: afdb34bdc2108dad956e67eb531f13e222ba914e (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
54
55
#ifndef QSGCONTEXT_H
#define QSGCONTEXT_H

#include <QObject>

#include <QGLContext>

#include "node.h"
#include "qmlscene_global.h"

class QSGContextPrivate;
class RectangleNodeInterface;
class TextureNodeInterface;
class GlyphNodeInterface;
class Renderer;
class QSGTextureManager;

class QT_SCENEGRAPH_EXPORT QSGContext : public QObject
{
    Q_OBJECT
    Q_DECLARE_PRIVATE(QSGContext);

public:
    explicit QSGContext(QObject *parent = 0);

    void initialize(QGLContext *context);

    Renderer *renderer() const;

    QSGTextureManager *textureManager() const;

    void setRootNode(RootNode *node);
    RootNode *rootNode() const;

    QGLContext *glContext() const;

    static QSGContext *current; // Evil nasty hack!! Get rid of this!

    bool isReady() const;

    virtual void renderNextFrame();

    virtual RectangleNodeInterface *createRectangleNode();
    virtual TextureNodeInterface *createTextureNode();
    virtual GlyphNodeInterface *createGlyphNode();
    virtual Renderer *createRenderer();
    virtual QSGTextureManager *createTextureManager();

signals:
    void ready();

    void aboutToRenderNextFrame();
};

#endif // QSGCONTEXT_H