Commit 67f24727 authored by Thomas Guillem's avatar Thomas Guillem

opengl: use vec2 for TexCoords

parent 39f1c15a
......@@ -254,12 +254,12 @@ opengl_tex_converter_anop_init(const video_format_t *fmt,
"#version " GLSL_VERSION "\n"
"#extension GL_OES_EGL_image_external : require\n"
PRECISION
"varying vec4 TexCoord0;"
"varying vec2 TexCoord0;"
"uniform samplerExternalOES sTexture;"
"uniform mat4 uSTMatrix;"
"void main()"
"{ "
" gl_FragColor = texture2D(sTexture, (uSTMatrix * TexCoord0).xy);"
" gl_FragColor = texture2D(sTexture, (uSTMatrix * vec4(TexCoord0, 1, 1)).xy);"
"}";
GLuint fragment_shader = tc->api->CreateShader(GL_FRAGMENT_SHADER);
tc->api->ShaderSource(fragment_shader, 1, &code, NULL);
......
......@@ -542,10 +542,10 @@ opengl_tex_converter_rgba_init(const video_format_t *fmt,
"#version " GLSL_VERSION "\n"
PRECISION
"uniform sampler2D Texture[3];"
"varying vec4 TexCoord0,TexCoord1,TexCoord2;"
"varying vec2 TexCoord0;"
"void main()"
"{ "
" gl_FragColor = texture2D(Texture[0], TexCoord0.st);"
" gl_FragColor = texture2D(Texture[0], TexCoord0);"
"}";
#endif
......@@ -555,10 +555,10 @@ opengl_tex_converter_rgba_init(const video_format_t *fmt,
PRECISION
"uniform sampler2D Texture0;"
"uniform vec4 FillColor;"
"varying vec4 TexCoord0;"
"varying vec2 TexCoord0;"
"void main()"
"{ "
" gl_FragColor = texture2D(Texture0, TexCoord0.st) * FillColor;"
" gl_FragColor = texture2D(Texture0, TexCoord0) * FillColor;"
"}";
GLuint fragment_shader = tc->api->CreateShader(GL_FRAGMENT_SHADER);
......@@ -695,7 +695,7 @@ opengl_tex_converter_yuv_init(const video_format_t *fmt,
"uniform sampler2D Texture1;"
"uniform sampler2D Texture2;"
"uniform vec4 Coefficient[4];"
"varying vec4 TexCoord0,TexCoord1,TexCoord2;"
"varying vec2 TexCoord0,TexCoord1,TexCoord2;"
"void main(void) {"
" vec4 x,y,z,result;"
......@@ -704,9 +704,9 @@ opengl_tex_converter_yuv_init(const video_format_t *fmt,
* vec4(L,L,L,1). The following transform a vec4(x, y, z, w) into a
* vec4(x, x, x, 1) (we may want to use texture swizzling starting
* OpenGL 3.3). */
" float val0 = texture2D(Texture0, TexCoord0.st).x;"
" float val1 = texture2D(Texture1, TexCoord1.st).x;"
" float val2 = texture2D(Texture2, TexCoord2.st).x;"
" float val0 = texture2D(Texture0, TexCoord0).x;"
" float val1 = texture2D(Texture1, TexCoord1).x;"
" float val2 = texture2D(Texture2, TexCoord2).x;"
" x = vec4(val0, val0, val0, 1);"
" %c = vec4(val1, val1, val1, 1);"
" %c = vec4(val2, val2, val2, 1);"
......@@ -803,11 +803,11 @@ opengl_tex_converter_xyz12_init(const video_format_t *fmt,
" 0.0, 0.0, 0.0, 1.0 "
" );"
"varying vec4 TexCoord0;"
"varying vec2 TexCoord0;"
"void main()"
"{ "
" vec4 v_in, v_out;"
" v_in = texture2D(Texture0, TexCoord0.st);"
" v_in = texture2D(Texture0, TexCoord0);"
" v_in = pow(v_in, xyz_gamma);"
" v_out = matrix_xyz_rgb * v_in ;"
" v_out = pow(v_out, rgb_gamma) ;"
......
......@@ -349,7 +349,7 @@ static GLuint BuildVertexShader(vout_display_opengl_t *vgl, unsigned plane_count
static const char *template =
"#version " GLSL_VERSION "\n"
PRECISION
"varying vec4 TexCoord0;attribute vec4 MultiTexCoord0;"
"varying vec2 TexCoord0;attribute vec4 MultiTexCoord0;"
"%s%s"
"attribute vec3 VertexPosition;"
"uniform mat4 OrientationMatrix;"
......@@ -359,19 +359,19 @@ static GLuint BuildVertexShader(vout_display_opengl_t *vgl, unsigned plane_count
"uniform mat4 ZRotMatrix;"
"uniform mat4 ZoomMatrix;"
"void main() {"
" TexCoord0 = OrientationMatrix * MultiTexCoord0;"
" TexCoord0 = vec4(OrientationMatrix * MultiTexCoord0).st;"
"%s%s"
" gl_Position = ProjectionMatrix * ZoomMatrix * ZRotMatrix * XRotMatrix * YRotMatrix * vec4(VertexPosition, 1.0);"
"}";
const char *coord1_header = plane_count > 1 ?
"varying vec4 TexCoord1;attribute vec4 MultiTexCoord1;" : "";
"varying vec2 TexCoord1;attribute vec4 MultiTexCoord1;" : "";
const char *coord1_code = plane_count > 1 ?
" TexCoord1 = OrientationMatrix * MultiTexCoord1;" : "";
" TexCoord1 = vec4(OrientationMatrix * MultiTexCoord1).st;" : "";
const char *coord2_header = plane_count > 2 ?
"varying vec4 TexCoord2;attribute vec4 MultiTexCoord2;" : "";
"varying vec2 TexCoord2;attribute vec4 MultiTexCoord2;" : "";
const char *coord2_code = plane_count > 2 ?
" TexCoord2 = OrientationMatrix * MultiTexCoord2;" : "";
" TexCoord2 = vec4(OrientationMatrix * MultiTexCoord2).st;" : "";
char *code;
if (asprintf(&code, template, coord1_header, coord2_header,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment