| String fragmentShader = "uniform vec4 Color1;" NEW_LINE | |
| "uniform vec4 Color2;" NEW_LINE | |
| "uniform vec2 ScreenBounds;" NEW_LINE | |
| "void main(void)" NEW_LINE | |
| "{" NEW_LINE | |
| " " //juce is ARGB, GL is RGBA. Destination is xyzw | |
| " " NEW_LINE | |
| /* | |
| gl_FragCoord is in window coords. so, 1024 x 768 or whtaever | |
| */ | |
| "vec2 pos = gl_FragCoord.xy / ScreenBounds.xy;" NEW_LINE | |
| "gl_FragColor = vec4(mix(Color1, Color2, pos.y));" NEW_LINE | |
| "}" NEW_LINE; | |
| // | |
| auto r = getLocalBounds().toFloat(); | |
| shaderProgram->setUniform("ScreenBounds", | |
| r.getWidth(), | |
| r.getHeight(), | |
| 0.f, | |
| 0.f); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment