[require] GLSL >= 1.10 [vertex shader] vec4 x_adjust(vec4 pos) { if (pos.x > 0.0) return vec4(-0.5, 0.0, 0.0, 0.0); else return vec4(1.5, 0.0, 0.0, 0.0); } vec4 y_adjust(vec4 pos) { vec4 x = x_adjust(pos); if (pos.y > 0.0) return vec4(0.0, -0.5, 0.5, 0.0) + x; else return vec4(0.0, 1.5, 0.5, 0.0) + x; } void main() { gl_FrontColor = gl_Vertex + y_adjust(gl_Vertex); gl_Position = gl_Vertex; } [fragment shader] void main() { gl_FragColor = gl_Color; } [test] draw rect -1 -1 2 2 probe all rgb 0.5 0.5 0.5 0.5