Using libretro shaders in other applications


I just discovered this awsome project and I want to use the libretro shaders with SFML but i am new to this and i don’t really know how to use these shaders. I just need to apply a shader on an image/texture. The only result i got was a green screen when i added #define FRAGMENT in the shader file.

Let’s say i want to use this fxaa shader. I know i feed it with uniform sampler2D Texture; but it seems it’s not using it. What other parameters would i need to feed to the shader in order to make it work and what they actually mean? I tryed different values for the other uniforms but it had no effect. Do i also need to use the vertex shader?


1 Like

Yes, you need some kind of vertex shader. It doesn’t have to do much, though. For example, the vertex shader that’s in the linked shader file is basically just a passthru that sets up the quad that the fragment draws to.

1 Like

Thank you, i finally got it working! I had to separate the shader in two different files, one for the vertex shader and one for the fragment shader.

I also had to feed OutputSize, TextureSize, and InputSize uniform variables to the verex shader. Then in the main() function of the vertex shader i added these lines and delete their previous declarations.

  • mat4 MVPMatrix = gl_ModelViewProjectionMatrix;
  • vec4 VertexCoord = gl_Vertex;
  • vec4 TexCoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;