OSDN Git Service

[Qt][MOVIE_SAVER] (MAYBE) Fix not running with Ubuntu 16.04 LTS.
[csp-qt/common_source_project-fm7.git] / source / src / qt / gui / qt_glutil_gl3_0.h
1 /*
2  * qt_glutil_gl3_0.cpp
3  * (c) 2016 K.Ohta <whatisthis.sowhat@gmail.com>
4  * License: GPLv2.
5  * Renderer with OpenGL v3.0 (extend from renderer with OpenGL v2.0).
6  * History:
7  * Jan 22, 2016 : Initial.
8  */
9
10 #ifndef _QT_COMMON_GLUTIL_3_0_H
11 #define _QT_COMMON_GLUTIL_3_0_H
12
13 #include "qt_glutil_gl2_0.h"
14 #include <QOpenGLFunctions_3_0>
15
16 class DLL_PREFIX GLDraw_3_0 : public GLDraw_2_0
17 {
18         Q_OBJECT
19 protected:
20         QOpenGLFunctions_3_0 *extfunc_3_0;
21         VertexTexCoord_t vertexTmpTexture[4];
22         QOpenGLShaderProgram *tmp_shader;
23         QOpenGLShaderProgram *grids_shader;
24         
25         QOpenGLBuffer *buffer_vertex_tmp_texture;
26         QOpenGLVertexArrayObject *vertex_tmp_texture;
27         
28         QOpenGLBuffer *grids_horizonal_buffer;
29         QOpenGLVertexArrayObject *grids_horizonal_vertex;
30         QOpenGLBuffer *grids_vertical_buffer;
31         QOpenGLVertexArrayObject *grids_vertical_vertex;
32
33         GLuint uTmpTextureID;
34         GLuint uTmpFrameBuffer;
35         GLuint uTmpDepthBuffer;
36         void setNormalVAO(QOpenGLShaderProgram *prg, QOpenGLVertexArrayObject *vp,
37                                           QOpenGLBuffer *bp, VertexTexCoord_t *tp, int size = 4);
38
39         void drawGridsHorizonal(void);
40         void drawGridsVertical(void);
41         virtual void updateGridsVAO(QOpenGLBuffer *bp,
42                                                                 QOpenGLVertexArrayObject *vp,
43                                                                 GLfloat *tp,
44                                                                 int number);
45
46         virtual void drawGridsMain_3(QOpenGLShaderProgram *prg,
47                                                                  QOpenGLBuffer *bp,
48                                                                  QOpenGLVertexArrayObject *vp,
49                                                                  int number,
50                                                                  GLfloat lineWidth = 0.2f,
51                                                                  QVector4D color = QVector4D(0.0, 0.0, 0.0, 1.0));
52
53         void drawMain(QOpenGLShaderProgram *prg, QOpenGLVertexArrayObject *vp,
54                                   QOpenGLBuffer *bp,
55                                   VertexTexCoord_t *vertex_data,
56                                   GLuint texid,
57                                   QVector4D color, bool f_smoosing,
58                                   bool do_chromakey = false,
59                                   QVector3D chromakey = QVector3D(0.0f, 0.0f, 0.0f));
60 public:
61         GLDraw_3_0(GLDrawClass *parent, EMU *emu = 0);
62         ~GLDraw_3_0();
63         void initGLObjects();
64         void initLocalGLObjects(void);
65         void uploadMainTexture(QImage *p, bool chromakey);
66         void drawScreenTexture(void);
67 public slots:
68         void setBrightness(GLfloat r, GLfloat g, GLfloat b);
69         void do_set_texture_size(QImage *p, int w, int h);
70 };
71 #endif