OSDN Git Service

[Qt][OSD][LAMP] Improbe LED displaying.
[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
14 #include "qt_glutil_gl2_0.h"
15 #include <QOpenGLFunctions_3_0>
16
17 class GLScreenPack;
18 class CSP_Logger;
19 class DLL_PREFIX GLDraw_3_0 : public GLDraw_2_0
20 {
21         Q_OBJECT
22 private:
23         QOpenGLFunctions_3_0 *extfunc;
24         float ringing_phase;
25 protected:
26         GLScreenPack *main_pass;
27         GLScreenPack *std_pass;
28         GLScreenPack *ntsc_pass1;
29         GLScreenPack *ntsc_pass2;
30         GLScreenPack *bitmap_block;
31         GLScreenPack *led_pass[32];
32
33         VertexTexCoord_t vertexTmpTexture[4];
34         
35         QOpenGLShaderProgram *grids_shader;
36         QOpenGLBuffer *grids_horizonal_buffer;
37         QOpenGLVertexArrayObject *grids_horizonal_vertex;
38         QOpenGLBuffer *grids_vertical_buffer;
39         QOpenGLVertexArrayObject *grids_vertical_vertex;
40
41         GLuint uTmpTextureID;
42         
43         virtual void setNormalVAO(QOpenGLShaderProgram *prg, QOpenGLVertexArrayObject *vp,
44                                           QOpenGLBuffer *bp, VertexTexCoord_t *tp, int size = 4);
45         virtual bool initGridShaders(const QString vertex_fixed, const QString vertex_rotate, const QString fragment);
46         virtual bool initGridVertexObject(QOpenGLBuffer **vbo, QOpenGLVertexArrayObject **vao, int alloc_size);
47         virtual void set_texture_vertex(float wmul = 1.0f, float hmul = 1.0f);
48         virtual void updateGridsVAO(QOpenGLBuffer *bp,
49                                                                         QOpenGLVertexArrayObject *vp,
50                                                                         GLfloat *tp,
51                                                                         int number);
52
53         virtual void drawGridsMain_3(QOpenGLShaderProgram *prg,
54                                                                  QOpenGLBuffer *bp,
55                                                                  QOpenGLVertexArrayObject *vp,
56                                                                  int number,
57                                                                  GLfloat lineWidth = 0.2f,
58                                                                  QVector4D color = QVector4D(0.0, 0.0, 0.0, 1.0));
59         virtual void resizeGL_Screen(void);
60         virtual void initPackedGLObject(GLScreenPack **p,
61                                                                 int _width, int _height,
62                                                                 const QString vertex_shader, const QString fragment_shader,
63                                                                 const QString _name);
64
65         virtual void drawGridsHorizonal(void);
66         virtual void drawGridsVertical(void);
67
68         virtual void drawMain(GLScreenPack *obj,
69                                   GLuint texid,
70                                   QVector4D color, bool f_smoosing,
71                                   bool do_chromakey = false,
72                                   QVector3D chromakey = QVector3D(0.0f, 0.0f, 0.0f));
73         virtual void renderToTmpFrameBuffer_nPass(GLuint src_texture,
74                                                                                   GLuint src_w,
75                                                                                   GLuint src_h,
76                                                                                   GLScreenPack *renderObject,
77                                                                                   GLuint dst_w,
78                                                                                   GLuint dst_h,
79                                                                                   bool use_chromakey = false);
80         virtual void drawBitmapTexture(void);
81         virtual void drawButtonsMain(int num, bool f_smoosing);
82         virtual void drawOsdLeds();
83         virtual void drawLedMain(GLScreenPack *obj, QVector4D color);
84         virtual void set_led_vertex(int bit);
85
86 public:
87         GLDraw_3_0(GLDrawClass *parent, USING_FLAGS *p, CSP_Logger *logger, EMU *emu = 0);
88         ~GLDraw_3_0();
89         void drawButtons(void);
90         virtual void initGLObjects();
91         virtual void initLocalGLObjects(void);
92         virtual void initFBO(void);
93         //virtual void initBitmapVertex(void);
94         
95         virtual void uploadMainTexture(QImage *p, bool chromakey);
96         virtual void drawScreenTexture(void);
97         virtual void do_set_screen_multiply(float mul);
98         virtual void doSetGridsHorizonal(int lines, bool force);
99         virtual void doSetGridsVertical(int pixels, bool force);
100 public slots:
101         void setBrightness(GLfloat r, GLfloat g, GLfloat b);
102         void do_set_texture_size(QImage *p, int w, int h);
103         virtual void paintGL(void);
104         virtual void resizeGL(int width, int height);
105 };
106 #endif