[Qt][OpenGL][Shader] Move shaders per gl version.
[Qt][OpenGL][Shader] Remove pre-optimized shaders.
+++ /dev/null
-#ifdef GL_ES
- precision mediump float;
-#endif
-
-varying vec2 v_texcoord;
-uniform vec4 color;
-uniform vec3 chromakey;
-uniform bool do_chromakey;
-
-uniform sampler2D a_texture;
-
-// This is from sample of Qt5 , see http://doc.qt.io/qt-5/qtopengl-cube-example.html .
-void main()
-{
- // Set fragment color from texture
- vec4 pixel_t = texture2D(a_texture, v_texcoord );
- vec4 pixel_r = pixel_t;
- vec4 c = vec4(chromakey, 1.0);
-
- if(do_chromakey == true) {
- pixel_r.a = 1.0;
- if(pixel_r != c) { // Chromakey;
- pixel_r = pixel_r * color;
- } else {
- pixel_r = vec4(0.0, 0.0, 0.0, 0.0);
- }
- } else {
- pixel_r = pixel_r * color;
- }
- gl_FragColor = pixel_r;
-}
+++ /dev/null
-#ifdef GL_ES
- precision mediump float;
-#endif
-
-varying vec2 v_texcoord;
-uniform vec4 color;
-uniform int tex_width;
-uniform int tex_height;
-uniform sampler2D a_texture;
-//attribute tex_size = vec2(tex_width, tex_height);
-
-// This is from sample of Qt5 , see http://doc.qt.io/qt-5/qtopengl-cube-example.html .
-void main()
-{
- // Set fragment color from texture
- vec4 pixel_t = texture2D(a_texture, v_texcoord);
-
- gl_FragColor = pixel_t;
-}
--- /dev/null
+varying vec2 v_texcoord;
+uniform vec4 color;
+uniform vec3 chromakey;
+uniform bool do_chromakey;
+uniform sampler2D a_texture;
+void main ()
+{
+ vec4 pixel_r_1;
+ vec4 pixel;
+
+ pixel_r_1 = texture2D(a_texture, v_texcoord);
+
+ if(pixel_r_1.rgb != chromakey.rgb) {
+ pixel_r_1 = pixel_r_1 * color;
+ pixel = vec4(pixel_r_1.rgb, 1.0);
+ gl_FragColor = pixel;
+ } else {
+ discard;
+ }
+}
+
--- /dev/null
+varying vec2 v_texcoord;
+uniform sampler2D a_texture;
+void main ()
+{
+ gl_FragColor = texture2D (a_texture, v_texcoord);
+}
+
--- /dev/null
+varying vec2 v_texcoord;
+uniform vec4 color;
+uniform vec3 chromakey;
+uniform bool do_chromakey;
+uniform sampler2D a_texture;
+void main ()
+{
+ vec4 pixel_r_1;
+ vec4 pixel;
+ float alpha;
+ pixel_r_1 = texture2D(a_texture, v_texcoord);
+ //alpha = pixel_r_1.a * color.a;
+
+ pixel_r_1 = pixel_r_1 * color;
+ pixel = pixel_r_1 * color; //;vec4(pixel_r_1.rgb, alpha);
+ gl_FragColor = pixel;
+
+}
+
--- /dev/null
+varying vec2 v_texcoord;
+uniform sampler2D a_texture;
+uniform vec4 color;
+void main ()
+{
+ gl_FragColor = (texture2D (a_texture, v_texcoord) * color);
+}
+
--- /dev/null
+attribute vec3 vertex;
+attribute vec2 texcoord;
+varying vec2 v_texcoord;
+uniform bool rotate;
+void main ()
+{
+ if (!(rotate)) {
+ vec4 tmpvar_1;
+ tmpvar_1.w = 1.0;
+ tmpvar_1.xyz = vertex;
+ gl_Position = tmpvar_1;
+ v_texcoord = texcoord;
+ } else {
+ vec4 tmpvar_2;
+ tmpvar_2.w = 1.0;
+ tmpvar_2.xyz = vertex;
+ gl_Position = (mat4(0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0) * tmpvar_2);
+ v_texcoord = texcoord;
+ };
+}
+
+++ /dev/null
-#ifdef GL_ES
- precision mediump float;
-#endif
-
-uniform vec4 color; // Note: BRGA.
-
-// This is from sample of Qt5 , see http://doc.qt.io/qt-5/qtopengl-cube-example.html .
-void main()
-{
- // Set fragment color from texture
- gl_FragColor = color;
-}
+++ /dev/null
-#ifdef GL_ES
- precision mediump float;
-#endif
-
-attribute vec3 vertex;
-uniform bool rotate;
-
-const vec4 rot_line1 = vec4(0.0, -1.0, 0.0, 0.0);
-const vec4 rot_line2 = vec4(1.0, 0.0, 0.0, 0.0);
-const vec4 rot_line3 = vec4(0.0, 0.0, 1.0, 0.0);
-const vec4 rot_line4 = vec4(0.0, 0.0, 0.0, 1.0);
-const mat4 rot_matrix = mat4(rot_line1, rot_line2,
- rot_line3, rot_line4);
-// This is from sample of Qt5 , see http://doc.qt.io/qt-5/qtopengl-cube-example.html .
-void main()
-{
- // Calculate vertex position in screen space
- if(!rotate) {
- gl_Position = vec4(vertex, 1.0);
- } else {
- gl_Position = rot_matrix * vec4(vertex, 1.0);
- }
-}
-
+++ /dev/null
-#ifdef GL_ES
- precision mediump float;
-#endif
-
-attribute vec3 vertex;
-// This is from sample of Qt5 , see http://doc.qt.io/qt-5/qtopengl-cube-example.html .
-void main()
-{
- // Calculate vertex position in screen space
- gl_Position = vec4(vertex, 1.0);
-}
-
+++ /dev/null
-#ifdef GL_ES
- precision mediump float;
-#endif
-
-varying vec2 v_texcoord;
-uniform vec4 color;
-
-uniform sampler2D a_texture;
-
-// This is from sample of Qt5 , see http://doc.qt.io/qt-5/qtopengl-cube-example.html .
-void main()
-{
- // Set fragment color from texture
- vec4 pixel_t = texture2D(a_texture, v_texcoord );
- vec4 pixel_r;
- pixel_r = pixel_t * color;
- gl_FragColor = pixel_r;
-}
//#include "emu.h"
-#include <QOpenGLFramebufferObject>
+
#include <QOpenGLFramebufferObject>
#include <QColor>
#include <QImageReader>
+#include <QRect>
+#include <QOpenGLFunctions_2_0>
#include "qt_gldraw.h"
-//#include "csp_logger.h"
#include "qt_glutil_gl2_0.h"
#include "menu_flags.h"
if(vm_buttons_d != NULL) {
button_shader = new QOpenGLShaderProgram(p_wid);
if(button_shader != NULL) {
- button_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/vertex_shader.glsl");
- button_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/normal_fragment_shader.glsl");
+ button_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/gl2/vertex_shader.glsl");
+ button_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/gl2/normal_fragment_shader.glsl");
button_shader->link();
}
if(using_flags->is_use_one_board_computer()) {
bitmap_shader = new QOpenGLShaderProgram(p_wid);
if(bitmap_shader != NULL) {
- bitmap_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/vertex_shader.glsl");
- bitmap_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/normal_fragment_shader.glsl");
+ bitmap_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/gl2/vertex_shader.glsl");
+ bitmap_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/gl2/normal_fragment_shader.glsl");
bitmap_shader->link();
}
buffer_bitmap_vertex = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
{
main_shader = new QOpenGLShaderProgram(p_wid);
if(main_shader != NULL) {
- main_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/vertex_shader.glsl");
- main_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/chromakey_fragment_shader2.glsl");
+ main_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/gl2/vertex_shader.glsl");
+ main_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/gl2/chromakey_fragment_shader2.glsl");
main_shader->link();
}
buffer_screen_vertex = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
{
osd_shader = new QOpenGLShaderProgram(p_wid);
if(osd_shader != NULL) {
- osd_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/vertex_shader.glsl");
- osd_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/icon_fragment_shader.glsl");
+ osd_shader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/gl2/vertex_shader.glsl");
+ osd_shader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/gl2/icon_fragment_shader.glsl");
osd_shader->link();
}
for(int i = 0; i < 32; i++) {
#ifndef _QT_COMMON_GLUTIL_2_0_H
#define _QT_COMMON_GLUTIL_2_0_H
-#include <QtGui>
-#include <QColor>
-#include <QPainter>
-#include <QPen>
-#include <QRect>
-#include <QGLWidget>
-#include <QImage>
-#include <QOpenGLFunctions_2_0>
-#include <QTimer>
+#include <QWidget>
+#include <QString>
#include <QList>
#include "common.h"
-
#include "qt_glpack.h"
+QT_BEGIN_NAMESPACE
class EMU;
class QEvent;
class GLDrawClass;
class QOpenGLFramebufferObjectFormat;
class USING_FLAGS;
class CSP_Logger;
+class QOpenGLFunctions_2_0;
+class QOpenGLBuffer;
+class QOpenGLVertexArrayObject;
+class QOpenGLShaderProgram;
+
class DLL_PREFIX GLDraw_2_0 : public QObject
{
Q_OBJECT
signals:
int sig_push_image_to_movie(int, int, int, QImage *);
};
+QT_END_NAMESPACE
+
#endif // _QT_COMMON_GLUTIL_2_0_H
#include "qt_glutil_gl3_0.h"
#include "csp_logger.h"
#include "menu_flags.h"
+#include <QOpenGLFunctions_3_0>
//extern USING_FLAGS *using_flags;
#if 0
if(using_flags->is_use_one_board_computer() || (using_flags->get_max_button() > 0)) {
initPackedGLObject(&main_pass,
using_flags->get_screen_width() * 2, using_flags->get_screen_height() * 2,
- ":/vertex_shader.glsl" , ":/chromakey_fragment_shader2.glsl",
+ ":/gl3/vertex_shader.glsl" , ":/gl3/chromakey_fragment_shader2.glsl",
"Main Shader");
} else {
initPackedGLObject(&main_pass,
using_flags->get_screen_width() * 2, using_flags->get_screen_height() * 2,
- ":/vertex_shader.glsl" , ":/fragment_shader.glsl",
+ ":/gl3/vertex_shader.glsl" , ":/gl3/fragment_shader.glsl",
"Main Shader");
}
if(main_pass != NULL) {
}
initPackedGLObject(&std_pass,
using_flags->get_screen_width(), using_flags->get_screen_height(),
- ":/vertex_shader.glsl" , ":/chromakey_fragment_shader.glsl",
+ ":/gl3/vertex_shader.glsl" , ":/gl3/chromakey_fragment_shader.glsl",
"Standard Shader");
initPackedGLObject(&led_pass,
10, 10,
- ":/led_vertex_shader.glsl" , ":/led_fragment_shader.glsl",
+ ":/gl3/led_vertex_shader.glsl" , ":/gl3/led_fragment_shader.glsl",
"LED Shader");
for(int i = 0; i < 32; i++) {
led_pass_vao[i] = new QOpenGLVertexArrayObject;
}
initPackedGLObject(&osd_pass,
48.0, 48.0,
- ":/vertex_shader.glsl" , ":/icon_fragment_shader.glsl",
+ ":/gl3/vertex_shader.glsl" , ":/gl3/icon_fragment_shader.glsl",
"OSD Shader");
for(int i = 0; i < 32; i++) {
osd_pass_vao[i] = new QOpenGLVertexArrayObject;
initPackedGLObject(&ntsc_pass1,
_width, _height,
- ":/vertex_shader.glsl" , ":/ntsc_pass1.glsl",
+ ":/gl3/vertex_shader.glsl" , ":/gl3/ntsc_pass1.glsl",
"NTSC Shader Pass1");
initPackedGLObject(&ntsc_pass2,
_width / 2, _height,
- ":/vertex_shader.glsl" , ":/ntsc_pass2.glsl",
+ ":/gl3/vertex_shader.glsl" , ":/gl3/ntsc_pass2.glsl",
"NTSC Shader Pass2");
{
int ii;
initBitmapVertex();
initPackedGLObject(&bitmap_block,
_width * 2, _height * 2,
- ":/vertex_shader.glsl", ":/normal_fragment_shader.glsl",
+ ":/gl3/vertex_shader.glsl", ":/gl3/normal_fragment_shader.glsl",
"Background Bitmap Shader");
if(bitmap_block != NULL) {
setNormalVAO(bitmap_block->getShader(), bitmap_block->getVAO(),
vertexBitmap, 4);
}
}
- initGridShaders(":/grids_vertex_shader_fixed.glsl", ":/grids_vertex_shader.glsl", ":/grids_fragment_shader.glsl");
+ initGridShaders(":/gl3/grids_vertex_shader_fixed.glsl", ":/gl3/grids_vertex_shader.glsl", ":/gl3/grids_fragment_shader.glsl");
initGridVertexObject(&grids_horizonal_buffer, &grids_horizonal_vertex, using_flags->get_real_screen_height() + 3);
doSetGridsHorizonal(using_flags->get_real_screen_height(), true);
#ifndef _QT_COMMON_GLUTIL_3_0_H
#define _QT_COMMON_GLUTIL_3_0_H
-
+#include <QString>
#include "qt_glutil_gl2_0.h"
-#include <QOpenGLFunctions_3_0>
+QT_BEGIN_NAMESPACE
class GLScreenPack;
class CSP_Logger;
+class QOpenGLFunctions_3_0;
+class QOpenGLBuffer;
+class QOpenGLVertexArrayObject;
+class QOpenGLShaderProgram;
+
class DLL_PREFIX GLDraw_3_0 : public GLDraw_2_0
{
Q_OBJECT
virtual void paintGL(void);
virtual void resizeGL(int width, int height);
};
+QT_END_NAMESPACE
#endif
+++ /dev/null
-#ifdef GL_ES
- precision mediump float;
-#endif
-
-attribute vec3 vertex;
-attribute vec2 texcoord;
-varying vec2 v_texcoord;
-
-uniform bool rotate;
-
-// This is from sample of Qt5 , see http://doc.qt.io/qt-5/qtopengl-cube-example.html .
-void main()
-{
- gl_Position = vec4(vertex, 1.0);
- v_texcoord = texcoord;
-}
-
+++ /dev/null
-#ifdef GL_ES
- precision mediump float;
-#endif
-
-attribute vec3 vertex;
-attribute vec2 texcoord;
-varying vec2 v_texcoord;
-
-uniform bool rotate;
-
-const vec4 rot_line1 = vec4(0.0, -1.0, 0.0, 0.0);
-const vec4 rot_line2 = vec4(1.0, 0.0, 0.0, 0.0);
-const vec4 rot_line3 = vec4(0.0, 0.0, 1.0, 0.0);
-const vec4 rot_line4 = vec4(0.0, 0.0, 0.0, 1.0);
-const mat4 rot_matrix = mat4(rot_line1, rot_line2,
- rot_line3, rot_line4);
-
-// This is from sample of Qt5 , see http://doc.qt.io/qt-5/qtopengl-cube-example.html .
-void main()
-{
- if(!rotate) {
- gl_Position = vec4(vertex, 1.0);
- v_texcoord = texcoord;
- } else {
- gl_Position = rot_matrix * vec4(vertex, 1.0);
- v_texcoord = texcoord;
- }
-}
-