I want to write an app for Android with OpenGL ES 2.0 that displays a colored rectangle, like that:
This are my 2 shaders:
// Vertex Shader
attribute vec4 vPosition;
void main() {
gl_Position = vPosition;
}
// Fragment Shader
uniform vec4 u_colorRGBA;
void main() {
gl_FragColor = u_colorRGBA;
}
I can draw rectangles with different colors, but i want to draw them so each corner has a diffrent color. Can i pass variables from the vertex shader to the fragment shader to define the color of each corner? If so how do i define the variables and pass them over? Or is there another way to do it?