Permalink
Browse files

Merge pull request #3793 from FernetMenta/shader

LinuxRendererGL: make sure we have a shader defined
  • Loading branch information...
2 parents 66d61d3 + 1eeee8b commit e52e9a7de37594db94d6a0a1e8ebf05efcdba0f5 @FernetMenta FernetMenta committed Dec 10, 2013
@@ -830,6 +830,15 @@ void CLinuxRendererGL::UpdateVideoFilter()
break;
}
}
+ else
+ {
+ m_pVideoFilterShader = new DefaultFilterShader();
+ if (!m_pVideoFilterShader->CompileAndLink())
+ {
+ CLog::Log(LOGERROR, "GL: Error compiling and linking video filter shader");
+ break;
+ }
+ }
return;
case VS_SCALINGMETHOD_LANCZOS2:
@@ -65,6 +65,16 @@ BaseVideoFilterShader::BaseVideoFilterShader()
"gl_FrontColor = gl_Color;"
"}";
VertexShader()->SetSource(shaderv);
+
+ string shaderp =
+ "uniform sampler2D img;"
+ "varying vec2 cord;"
+ "void main()"
+ "{"
+ "gl_FragColor.rgb = texture2D(img, cord).rgb;"
+ "gl_FragColor.a = gl_Color.a;"
+ "}";
+ PixelShader()->SetSource(shaderp);
}
ConvolutionFilterShader::ConvolutionFilterShader(ESCALINGMETHOD method, bool stretch)
@@ -230,4 +240,16 @@ bool StretchFilterShader::OnEnabled()
return true;
}
+void DefaultFilterShader::OnCompiledAndLinked()
+{
+ m_hSourceTex = glGetUniformLocation(ProgramHandle(), "img");
+}
+
+bool DefaultFilterShader::OnEnabled()
+{
+ glUniform1i(m_hSourceTex, m_sourceTexUnit);
+ VerifyGLState();
+ return true;
+}
+
#endif
@@ -87,6 +87,13 @@ namespace Shaders {
bool OnEnabled();
};
+ class DefaultFilterShader : public BaseVideoFilterShader
+ {
+ public:
+ void OnCompiledAndLinked();
+ bool OnEnabled();
+ };
+
} // end namespace
#endif

0 comments on commit e52e9a7

Please sign in to comment.