横
attribute vec2 aPosition;
uniform vec2 uResolution;
varying vec2 vPosition;
void main() {
vPosition = aPosition / uResolution;
gl_Position = vec4(aPosition / uResolution * 2.0 - 1.0, 0.0, 1.0);
}
precision mediump float;
varying vec2 vPosition;
void main() {
gl_FragColor = vec4(vPosition.x, 0.0, 0.0, 1.0);
}
縦
attribute vec2 aPosition;
uniform vec2 uResolution;
varying vec2 vPosition;
void main() {
vPosition = aPosition / uResolution;
gl_Position = vec4(aPosition / uResolution * 2.0 - 1.0, 0.0, 1.0);
}
precision mediump float;
varying vec2 vPosition;
void main() {
gl_FragColor = vec4(vPosition.y, 0.0, 0.0, 1.0);
}
縦横
attribute vec2 aPosition;
uniform vec2 uResolution;
varying vec2 vPosition;
void main() {
vPosition = aPosition / uResolution;
gl_Position = vec4(aPosition / uResolution * 2.0 - 1.0, 0.0, 1.0);
}
precision mediump float;
varying vec2 vPosition;
void main() {
gl_FragColor = vec4(vPosition.xy, 0.0, 1.0);
}