有人能指出我正确的方向来创建类似于在 GL ES 2.0 上运行的效果吗?
.vert
uniform vec2 uAberrationOffset;
void main() {
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
}
.frag
uniform sampler2DRect baseTex;
uniform vec2 uAberrationOffset;
void main() {
vec4 coords = gl_TexCoord[0];
// baseTex is FBO of screen (1280x800 -> non-square)
// offset red
vec4 fbo1 = texture2DRect(baseTex, coords.xy - uAberrationOffset);
// keep green where it is
vec4 fbo2 = texture2DRect(baseTex, coords.xy);
// offset blue
vec4 fbo3 = texture2DRect(baseTex, coords.xy + uAberrationOffset);
// FBO channels mixed (incl. offsets)
vec4 colFinal = vec4(fbo1.r, fbo2.g, fbo3.b, 1.);
// Output final pixel color
gl_FragColor = colFinal;
}