OpenGL fragment shader


#1


Hello,
I have a custom fragment shader:

varying highp vec2 textureCoordinate; 
uniform sampler2D inputImageTexture; 
void main() { 
    mediump vec2 p = textureCoordinate; 
    if (p.x > 0.5) { 
        p.x = 1.0 - p.x; 
    } 
    lowp vec4 outputColor = texture2D (inputImageTexture, p); 
    gl_FragColor = outputColor; 
}


I'm looking for a way to pass a juce::Image to this shader and get back either an Image object or just see the result on the screen. I've looked at the OpenGL demo pages but still haven't wrapped my head around it completely. What classes from the OpenGL code do I need to achieve this?


I obviously need:

OpenGLContext

and an:

OpenGLShaderProgram

and an?

OpenGLShaderProgram::Uniform

But I'm still a little confused on how to wire this up and pass a custom sampler2D to the shader.

Thanks