21 #ifndef AVDEVICE_OPENGL_SHADERS_H
22 #define AVDEVICE_OPENGL_SHADERS_H
27 "uniform mat4 u_projectionMatrix;"
28 "uniform mat4 u_modelViewMatrix;"
30 "attribute vec4 a_position;"
31 "attribute vec2 a_textureCoords;"
33 "varying vec2 texture_coordinate;"
37 "gl_Position = u_projectionMatrix * (a_position * u_modelViewMatrix);"
38 "texture_coordinate = a_textureCoords;"
45 #if defined(GL_ES_VERSION_2_0)
46 "precision mediump float;"
48 "uniform sampler2D u_texture0;"
49 "uniform mat4 u_colorMap;"
51 "varying vec2 texture_coordinate;"
55 "gl_FragColor = texture2D(u_texture0, texture_coordinate) * u_colorMap;"
62 #if defined(GL_ES_VERSION_2_0)
63 "precision mediump float;"
65 "uniform sampler2D u_texture0;"
66 "uniform mat4 u_colorMap;"
68 "varying vec2 texture_coordinate;"
72 "gl_FragColor = vec4((texture2D(u_texture0, texture_coordinate) * u_colorMap).rgb, 1.0);"
79 #if defined(GL_ES_VERSION_2_0)
80 "precision mediump float;"
82 "uniform sampler2D u_texture0;"
83 "uniform sampler2D u_texture1;"
84 "uniform sampler2D u_texture2;"
85 "uniform sampler2D u_texture3;"
87 "varying vec2 texture_coordinate;"
91 "gl_FragColor = vec4(texture2D(u_texture0, texture_coordinate).r,"
92 "texture2D(u_texture1, texture_coordinate).r,"
93 "texture2D(u_texture2, texture_coordinate).r,"
94 "texture2D(u_texture3, texture_coordinate).r);"
101 #if defined(GL_ES_VERSION_2_0)
102 "precision mediump float;"
104 "uniform sampler2D u_texture0;"
105 "uniform sampler2D u_texture1;"
106 "uniform sampler2D u_texture2;"
108 "varying vec2 texture_coordinate;"
112 "gl_FragColor = vec4(texture2D(u_texture0, texture_coordinate).r,"
113 "texture2D(u_texture1, texture_coordinate).r,"
114 "texture2D(u_texture2, texture_coordinate).r,"
122 #if defined(GL_ES_VERSION_2_0)
123 "precision mediump float;"
125 "uniform sampler2D u_texture0;"
126 "uniform sampler2D u_texture1;"
127 "uniform sampler2D u_texture2;"
128 "uniform float u_chroma_div_w;"
129 "uniform float u_chroma_div_h;"
131 "varying vec2 texture_coordinate;"
137 "yuv.r = texture2D(u_texture0, texture_coordinate).r - 0.0625;"
138 "yuv.g = texture2D(u_texture1, vec2(texture_coordinate.x / u_chroma_div_w, texture_coordinate.y / u_chroma_div_h)).r - 0.5;"
139 "yuv.b = texture2D(u_texture2, vec2(texture_coordinate.x / u_chroma_div_w, texture_coordinate.y / u_chroma_div_h)).r - 0.5;"
141 "gl_FragColor = clamp(vec4(mat3(1.1643, 1.16430, 1.1643,"
142 "0.0, -0.39173, 2.0170,"
143 "1.5958, -0.81290, 0.0) * yuv, 1.0), 0.0, 1.0);"
151 #if defined(GL_ES_VERSION_2_0)
152 "precision mediump float;"
154 "uniform sampler2D u_texture0;"
155 "uniform sampler2D u_texture1;"
156 "uniform sampler2D u_texture2;"
157 "uniform sampler2D u_texture3;"
158 "uniform float u_chroma_div_w;"
159 "uniform float u_chroma_div_h;"
161 "varying vec2 texture_coordinate;"
167 "yuv.r = texture2D(u_texture0, texture_coordinate).r - 0.0625;"
168 "yuv.g = texture2D(u_texture1, vec2(texture_coordinate.x / u_chroma_div_w, texture_coordinate.y / u_chroma_div_h)).r - 0.5;"
169 "yuv.b = texture2D(u_texture2, vec2(texture_coordinate.x / u_chroma_div_w, texture_coordinate.y / u_chroma_div_h)).r - 0.5;"
171 "gl_FragColor = clamp(vec4(mat3(1.1643, 1.16430, 1.1643,"
172 "0.0, -0.39173, 2.0170,"
173 "1.5958, -0.81290, 0.0) * yuv, texture2D(u_texture3, texture_coordinate).r), 0.0, 1.0);"
177 #if defined(GL_ES_VERSION_2_0)
178 "precision mediump float;"
180 "uniform sampler2D u_texture0;"
181 "varying vec2 texture_coordinate;"
184 "float c = texture2D(u_texture0, texture_coordinate).r;"
185 "gl_FragColor = vec4(c, c, c, 1.0);"
static const char *const FF_OPENGL_FRAGMENT_SHADER_RGBA_PLANAR
Fragment shader for planar RGBA formats.
static const char *const FF_OPENGL_VERTEX_SHADER
static const char *const FF_OPENGL_FRAGMENT_SHADER_YUVA_PLANAR
Fragment shader for planar YUVA formats.
static const char *const FF_OPENGL_FRAGMENT_SHADER_RGB_PLANAR
Fragment shader for planar RGB formats.
static const char *const FF_OPENGL_FRAGMENT_SHADER_RGBA_PACKET
Fragment shader for packet RGBA formats.
static const char *const FF_OPENGL_FRAGMENT_SHADER_GRAY
static const char *const FF_OPENGL_FRAGMENT_SHADER_YUV_PLANAR
Fragment shader for planar YUV formats.
static const char *const FF_OPENGL_FRAGMENT_SHADER_RGB_PACKET
Fragment shader for packet RGB formats.