kis_glsl_widget.h 1.63 KB
Newer Older
1
/*
2
 *  kis_glsl_widget.h - part of KimageShop^WKrayon^WKrita
3
 *
4
 *  Copyright (c) 2007 Thomas Burdick <tburdi1@uic.edu>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
Boudewijn Rempt's avatar
Boudewijn Rempt committed
20

21 22 23
#ifndef _KIS_GLSL_WIDGET
#define _KIS_GLSL_WIDGET

24
#include <GL/glew.h>
Tom Burdick's avatar
Tom Burdick committed
25
#include <QGLWidget>
26
#include <QGLFramebufferObject>
Tom Burdick's avatar
Tom Burdick committed
27

28 29 30 31
#include <kis_paint_device.h>

class QGLFramebufferObject;
class QString;
Tom Burdick's avatar
Tom Burdick committed
32 33


34 35
class KisGlslWidget : public QGLWidget
{
36
    Q_OBJECT
Boudewijn Rempt's avatar
Boudewijn Rempt committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61

public:
    KisGlslWidget(KisPaintDeviceSP device, QWidget *parent = 0);
    ~KisGlslWidget();

    void paintGL();
    void resizeGL(int width, int height);
    void initializeGL();

    bool isValidGLSL() const {
        return m_valid;
    }

public slots:
    void slotShaders(const QString &fragmentShader, const QString &vertexShader);

private:

    GLuint m_texture, m_fragshader, m_vertexshader, m_program;
    QGLFramebufferObject *m_framebuffer;
    bool m_valid;
    KisPaintDeviceSP m_device;
    QRect m_bounds;
    quint8* m_imgbuf;
};
62 63

#endif