This abuses the template system to allow both a single anonymous shader and multiple named shaders to be defined in a namespace.
26 lines
469 B
GLSL
26 lines
469 B
GLSL
//! NAMESPACE=ol.renderer.webgl.tilelayer.shader
|
|
//! CLASS=ol.renderer.webgl.tilelayer.shader.
|
|
|
|
|
|
//! COMMON
|
|
varying vec2 v_texCoord;
|
|
|
|
|
|
//! VERTEX
|
|
attribute vec2 a_position;
|
|
attribute vec2 a_texCoord;
|
|
uniform vec4 u_tileOffset;
|
|
|
|
void main(void) {
|
|
gl_Position = vec4(a_position * u_tileOffset.xy + u_tileOffset.zw, 0., 1.);
|
|
v_texCoord = a_texCoord;
|
|
}
|
|
|
|
|
|
//! FRAGMENT
|
|
uniform sampler2D u_texture;
|
|
|
|
void main(void) {
|
|
gl_FragColor = texture2D(u_texture, v_texCoord);
|
|
}
|