diff --git a/showcases/ascii/ascii-layer/ascii-filter.js b/showcases/ascii/ascii-layer/ascii-filter.js index 88ca8d6b71a..effa9f74518 100644 --- a/showcases/ascii/ascii-layer/ascii-filter.js +++ b/showcases/ascii/ascii-layer/ascii-filter.js @@ -3,22 +3,21 @@ import GL from '@luma.gl/constants'; import {sortCharactersByBrightness} from './utils'; const vs = ` -#version 300 es #define SHADER_NAME feedback-vertex-shader uniform sampler2D video; uniform sampler2D pixelMapTexture; -in vec2 uv; +attribute vec2 uv; -out vec4 instanceIconFrames; -out vec4 instanceColors; +varying vec4 instanceIconFrames; +varying vec4 instanceColors; float bitColor(float x) { return floor(x * 4. + 0.5) * 64.; } void main(void) { - vec4 pixel = texture(video, uv); + vec4 pixel = texture2D(video, uv); float luminance = 0.2126 * pixel.r + 0.7152 * pixel.g + 0.0722 * pixel.b; instanceColors = vec4( @@ -28,24 +27,22 @@ void main(void) { 255.0 ); - instanceIconFrames = texture(pixelMapTexture, vec2(luminance + 0.5 / 256., 0.5)); + instanceIconFrames = texture2D(pixelMapTexture, vec2(luminance + 0.5 / 256., 0.5)); gl_Position = vec4(0.0); } `; const fs = ` -#version 300 es #define SHADER_NAME feedback-fragment-shader precision highp float; -in vec4 instanceIconFrames; -in vec4 instanceColors; -out vec4 fragColor; +varying vec4 instanceIconFrames; +varying vec4 instanceColors; void main(void) { - fragColor = vec4(0.0); + gl_FragColor = vec4(0.0); } `; diff --git a/showcases/wind/src/layers/delaunay-cover-layer/delaunay-cover-layer-fragment.glsl.js b/showcases/wind/src/layers/delaunay-cover-layer/delaunay-cover-layer-fragment.glsl.js index 4a270b2dcec..370e9f37148 100644 --- a/showcases/wind/src/layers/delaunay-cover-layer/delaunay-cover-layer-fragment.glsl.js +++ b/showcases/wind/src/layers/delaunay-cover-layer/delaunay-cover-layer-fragment.glsl.js @@ -19,16 +19,14 @@ // THE SOFTWARE. export default `\ -#version 300 es #define SHADER_NAME delaunay-cover-fragment-shader -in vec4 vPosition; -in vec4 vNormal; -in vec4 vColor; -out vec4 fragColor; +varying vec4 vPosition; +varying vec4 vNormal; +varying vec4 vColor; void main(void) { float lightWeight = getLightWeight(vPosition.xyz, vNormal.xzy); - fragColor = vec4(vColor.xyz * lightWeight, vColor.a); + gl_FragColor = vec4(vColor.xyz * lightWeight, vColor.a); } `; diff --git a/showcases/wind/src/layers/delaunay-cover-layer/delaunay-cover-layer-vertex.glsl.js b/showcases/wind/src/layers/delaunay-cover-layer/delaunay-cover-layer-vertex.glsl.js index 1fbe7d409fc..169b0a1334d 100644 --- a/showcases/wind/src/layers/delaunay-cover-layer/delaunay-cover-layer-vertex.glsl.js +++ b/showcases/wind/src/layers/delaunay-cover-layer/delaunay-cover-layer-vertex.glsl.js @@ -19,19 +19,18 @@ // THE SOFTWARE. export default `\ -#version 300 es #define SHADER_NAME delaunay-cover-vertex-shader #define HEIGHT_FACTOR 25. uniform vec2 bounds; -in vec3 positions; -in vec3 next; -in vec3 next2; +attribute vec3 positions; +attribute vec3 next; +attribute vec3 next2; -out vec4 vPosition; -out vec4 vNormal; -out vec4 vColor; +varying vec4 vPosition; +varying vec4 vNormal; +varying vec4 vColor; vec4 getWorldSpacePos(vec3 positions) { vec2 pos = project_position(positions.xy); diff --git a/showcases/wind/src/layers/delaunay-interpolation/delaunay-interpolation-vertex.glsl.js b/showcases/wind/src/layers/delaunay-interpolation/delaunay-interpolation-vertex.glsl.js index 2de6d75cbb1..c85064c8467 100644 --- a/showcases/wind/src/layers/delaunay-interpolation/delaunay-interpolation-vertex.glsl.js +++ b/showcases/wind/src/layers/delaunay-interpolation/delaunay-interpolation-vertex.glsl.js @@ -19,16 +19,15 @@ // THE SOFTWARE. export default `\ -#version 300 es #define SHADER_NAME delaunay-vertex-shader uniform vec4 bbox; uniform vec2 size; -in vec3 positions; -in vec3 data; +attribute vec3 positions; +attribute vec3 data; -out vec4 vColor; +varying vec4 vColor; void main(void) { float posX = mix(-1., 1., (positions.x - bbox.x) / (bbox.y - bbox.x)); diff --git a/showcases/wind/src/layers/elevation-layer/elevation-layer-fragment.glsl.js b/showcases/wind/src/layers/elevation-layer/elevation-layer-fragment.glsl.js index a1e639cd37c..dc860f6a96c 100644 --- a/showcases/wind/src/layers/elevation-layer/elevation-layer-fragment.glsl.js +++ b/showcases/wind/src/layers/elevation-layer/elevation-layer-fragment.glsl.js @@ -1,14 +1,11 @@ export default `\ -#version 300 es #define SHADER_NAME elevation-layer-fragment-shader uniform vec2 elevationRange; -in float lightWeight; -in vec3 vNormal; -in float vAltitude; - -out vec4 fragColor; +varying float lightWeight; +varying vec3 vNormal; +varying float vAltitude; void main() { if (vAltitude < -90.0) { @@ -17,6 +14,6 @@ void main() { float opacity = smoothstep(elevationRange.x, elevationRange.y / 2.0, vAltitude) * 1.; - fragColor = vec4(vec3(15./70., 26./70., 36./70.) * lightWeight, opacity); + gl_FragColor = vec4(vec3(15./70., 26./70., 36./70.) * lightWeight, opacity); } `; diff --git a/showcases/wind/src/layers/elevation-layer/elevation-layer-vertex.glsl.js b/showcases/wind/src/layers/elevation-layer/elevation-layer-vertex.glsl.js index 9a16080b857..3860c4b8854 100644 --- a/showcases/wind/src/layers/elevation-layer/elevation-layer-vertex.glsl.js +++ b/showcases/wind/src/layers/elevation-layer/elevation-layer-vertex.glsl.js @@ -1,5 +1,4 @@ export default `\ -#version 300 es #define SHADER_NAME elevation-layer-vertex-shader uniform sampler2D elevationTexture; @@ -7,15 +6,15 @@ uniform vec4 elevationBounds; uniform vec2 elevationRange; uniform float zScale; -in vec3 positions; +attribute vec3 positions; -out float lightWeight; -out vec3 vNormal; -out float vAltitude; +varying float lightWeight; +varying vec3 vNormal; +varying float vAltitude; vec3 getWorldPosition(vec2 lngLat) { vec2 texCoords = (lngLat - elevationBounds.xy) / (elevationBounds.zw - elevationBounds.xy); - vec4 elevation = texture(elevationTexture, texCoords); + vec4 elevation = texture2D(elevationTexture, texCoords); float altitude = mix(elevationRange.x, elevationRange.y, elevation.r); diff --git a/showcases/wind/src/layers/particle-layer/particle-layer-fragment.glsl.js b/showcases/wind/src/layers/particle-layer/particle-layer-fragment.glsl.js index 0530c63c7c4..47cb80535a0 100644 --- a/showcases/wind/src/layers/particle-layer/particle-layer-fragment.glsl.js +++ b/showcases/wind/src/layers/particle-layer/particle-layer-fragment.glsl.js @@ -19,14 +19,12 @@ // THE SOFTWARE. export default `\ -#version 300 es #define SHADER_NAME particle-layer-fragment-shader precision highp float; -in vec4 vColor; -in float vAltitude; -out vec4 fragColor; +varying vec4 vColor; +varying float vAltitude; void main(void) { // if (vColor.a < 0.07) { @@ -40,6 +38,6 @@ void main(void) { if (false && length(diff) > 0.5) { discard; } - fragColor = vColor; + gl_FragColor = vColor; } `; diff --git a/showcases/wind/src/layers/particle-layer/particle-layer-vertex.glsl.js b/showcases/wind/src/layers/particle-layer/particle-layer-vertex.glsl.js index 84de3dc30c4..e037338cb3f 100644 --- a/showcases/wind/src/layers/particle-layer/particle-layer-vertex.glsl.js +++ b/showcases/wind/src/layers/particle-layer/particle-layer-vertex.glsl.js @@ -19,7 +19,6 @@ // THE SOFTWARE. export default `\ -#version 300 es #define SHADER_NAME particle-layer-vertex-shader #define HEIGHT_FACTOR 25. @@ -40,16 +39,16 @@ uniform vec4 elevationBounds; uniform vec2 elevationRange; uniform float zScale; -in vec3 positions; -in vec4 posFrom; -// in vec3 vertices; +attribute vec3 positions; +attribute vec4 posFrom; +// attribute vec3 vertices; -out vec4 vColor; -out float vAltitude; +varying vec4 vColor; +varying float vAltitude; float getAltitude(vec2 lngLat) { vec2 texCoords = (lngLat - elevationBounds.xy) / (elevationBounds.zw - elevationBounds.xy); - vec4 elevation = texture(elevationTexture, texCoords); + vec4 elevation = texture2D(elevationTexture, texCoords); return mix(elevationRange.x, elevationRange.y, elevation.r); } @@ -59,7 +58,7 @@ void main(void) { float x = (posFrom.x - bbox.x) / (bbox.y - bbox.x); float y = (posFrom.y - bbox.z) / (bbox.w - bbox.z); vec2 coord = vec2(x, 1. - y); - vec4 texel = mix(texture(dataFrom, coord), texture(dataTo, coord), delta); + vec4 texel = mix(texture2D(dataFrom, coord), texture2D(dataTo, coord), delta); vAltitude = getAltitude(posFrom.xy); //float wind = (texel.y - bounds1.x) / (bounds1.y - bounds1.x); diff --git a/showcases/wind/src/layers/particle-layer/transform-feedback-vertex.glsl.js b/showcases/wind/src/layers/particle-layer/transform-feedback-vertex.glsl.js index 9dfddf79483..91d4733337d 100644 --- a/showcases/wind/src/layers/particle-layer/transform-feedback-vertex.glsl.js +++ b/showcases/wind/src/layers/particle-layer/transform-feedback-vertex.glsl.js @@ -19,7 +19,6 @@ // THE SOFTWARE. export default `\ -#version 300 es #define SHADER_NAME particle-feedback-vertex-shader #define PI 3.1415926535 @@ -41,8 +40,8 @@ uniform vec2 bounds0; uniform vec2 bounds1; uniform vec2 bounds2; -//in vec3 positions; -in vec4 posFrom; +//attribute vec3 positions; +attribute vec4 posFrom; float rand(vec2 co){ return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); @@ -53,8 +52,8 @@ void main(void) { float x = (posFrom.x - bbox.x) / (bbox.y - bbox.x); float y = (posFrom.y - bbox.z) / (bbox.w - bbox.z); vec2 coord = vec2(x, 1. - y); - vec4 texel1 = texture(dataFrom, coord); - vec4 texel2 = texture(dataTo, coord); + vec4 texel1 = texture2D(dataFrom, coord); + vec4 texel2 = texture2D(dataTo, coord); vec4 texel = mix(texel1, texel2, delta); // angle diff --git a/showcases/wind/src/layers/wind-layer/wind-layer-fragment.js b/showcases/wind/src/layers/wind-layer/wind-layer-fragment.js index 517853c5089..da0e765c6a9 100644 --- a/showcases/wind/src/layers/wind-layer/wind-layer-fragment.js +++ b/showcases/wind/src/layers/wind-layer/wind-layer-fragment.js @@ -19,14 +19,12 @@ // THE SOFTWARE. export default `\ -#version 300 es #define SHADER_NAME wind-layer-fragment-shader -in vec4 vPosition; -in vec4 vNormal; -in vec4 vColor; -in float vAltitude; -out vec4 fragColor; +varying vec4 vPosition; +varying vec4 vNormal; +varying vec4 vColor; +varying float vAltitude; void main(void) { if (vColor.a == 0.) { @@ -38,6 +36,6 @@ void main(void) { // discard; // } float lightWeight = getLightWeight(vPosition.xyz, vNormal.xzy); - fragColor = vec4(vColor.xyz * lightWeight, 1); + gl_FragColor = vec4(vColor.xyz * lightWeight, 1); } `; diff --git a/showcases/wind/src/layers/wind-layer/wind-layer-vertex.js b/showcases/wind/src/layers/wind-layer/wind-layer-vertex.js index 26bdd0b79bd..66f6cd57616 100644 --- a/showcases/wind/src/layers/wind-layer/wind-layer-vertex.js +++ b/showcases/wind/src/layers/wind-layer/wind-layer-vertex.js @@ -19,7 +19,6 @@ // THE SOFTWARE. export default `\ -#version 300 es #define SHADER_NAME wind-layer-vertex-shader #define PI 3.1415926535 @@ -41,18 +40,18 @@ uniform vec2 bounds2; uniform vec4 elevationBounds; uniform vec2 elevationRange; -in vec3 positions; -in vec3 vertices; -in vec3 normals; +attribute vec3 positions; +attribute vec3 vertices; +attribute vec3 normals; -out vec4 vPosition; -out vec4 vNormal; -out vec4 vColor; -out float vAltitude; +varying vec4 vPosition; +varying vec4 vNormal; +varying vec4 vColor; +varying float vAltitude; float getAltitude(vec2 lngLat) { vec2 texCoords = (lngLat - elevationBounds.xy) / (elevationBounds.zw - elevationBounds.xy); - vec4 elevation = texture(elevationTexture, texCoords); + vec4 elevation = texture2D(elevationTexture, texCoords); return mix(elevationRange.x, elevationRange.y, elevation.r); } @@ -62,8 +61,8 @@ void main(void) { float x = (positions.x - bbox.x) / (bbox.y - bbox.x); float y = (positions.y - bbox.z) / (bbox.w - bbox.z); vec2 coord = vec2(x, 1. - y); - vec4 texel1 = texture(dataFrom, coord); - vec4 texel2 = texture(dataTo, coord); + vec4 texel1 = texture2D(dataFrom, coord); + vec4 texel2 = texture2D(dataTo, coord); vec4 texel = mix(texel1, texel2, delta); // angle