Hi,
I am experimenting with ofxHapPlayer and it works well, but there is an issue that I would like to fix. When decoding HAPQ movies the addon uses a shader, that is written for the standard renderer with GLSL version 1.2. My app uses the programmable renderer and hence needs the shaders to be written with GLSL 1.5 (that may not be true, my knowledge of the matter is quite shaky).
I tried porting the shaders to the new version but I am missing something. Can someone help me with this?
The current shaders are these (vertex and fragment):
void main(void)
{
gl_FrontColor = gl_Color;
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
}
uniform sampler2D cocgsy_src;
const vec4 offsets = vec4(-0.50196078431373, -0.50196078431373, 0.0, 0.0);
void main()
{
vec4 CoCgSY = texture2D(cocgsy_src, gl_TexCoord[0].xy);\
CoCgSY += offsets;\
float scale = ( CoCgSY.z * ( 255.0 / 8.0 ) ) + 1.0;\
float Co = CoCgSY.x / scale;\
float Cg = CoCgSY.y / scale;\
float Y = CoCgSY.w;\
vec4 rgba = vec4(Y + Co - Cg, Y + Cg, Y - Co - Cg, 1.0);\
gl_FragColor = rgba * gl_Color;\
}
The (not working) ones I wrote trying to convert them to GLSL 1.5 are like this:
#version 150
uniform mat4 modelViewProjectionMatrix;
in vec4 position;
void main()
{
gl_Position = modelViewProjectionMatrix * position;
}
#version 150
uniform sampler2DRect cocgsy_src;
const vec4 offsets = vec4(-0.50196078431373, -0.50196078431373, 0.0, 0.0);
out vec4 outputColor;
in vec4 color;
void main()
{
vec4 CoCgSY = texture(cocgsy_src, vec2(gl_FragCoord.x, gl_FragCoord.y));
CoCgSY += offsets;
float scale = ( CoCgSY.z * ( 255.0 / 8.0 ) ) + 1.0;
float Co = CoCgSY.x / scale;
float Cg = CoCgSY.y / scale;
float Y = CoCgSY.w;
vec4 rgba = vec4(Y + Co - Cg, Y + Cg, Y - Co - Cg, 1.0);
outputColor = rgba * color;
}
Thanks for helping
Davide