Added support for shaders written in non-legacy GLSL.

This commit is contained in:
binary1248 2018-05-20 14:06:24 +02:00
parent 1dcad60878
commit db7e683688
No known key found for this signature in database
GPG key ID: E5E52A5D6082224A
18 changed files with 690 additions and 74 deletions

View file

@ -1,15 +1,25 @@
uniform float wave_phase;
uniform vec2 wave_amplitude;
attribute vec2 positionAttribute;
attribute vec4 colorAttribute;
attribute vec2 texCoordAttribute;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;
varying vec4 texCoord;
varying vec4 frontColor;
void main()
{
vec4 vertex = gl_Vertex;
vertex.x += cos(gl_Vertex.y * 0.02 + wave_phase * 3.8) * wave_amplitude.x
+ sin(gl_Vertex.y * 0.02 + wave_phase * 6.3) * wave_amplitude.x * 0.3;
vertex.y += sin(gl_Vertex.x * 0.02 + wave_phase * 2.4) * wave_amplitude.y
+ cos(gl_Vertex.x * 0.02 + wave_phase * 5.2) * wave_amplitude.y * 0.3;
vec4 vertex = vec4(positionAttribute, 0.0, 1.0);
vertex.x += cos(positionAttribute.y * 0.02 + wave_phase * 3.8) * wave_amplitude.x
+ sin(positionAttribute.y * 0.02 + wave_phase * 6.3) * wave_amplitude.x * 0.3;
vertex.y += sin(positionAttribute.x * 0.02 + wave_phase * 2.4) * wave_amplitude.y
+ cos(positionAttribute.x * 0.02 + wave_phase * 5.2) * wave_amplitude.y * 0.3;
gl_Position = gl_ModelViewProjectionMatrix * vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_FrontColor = gl_Color;
gl_Position = modelViewProjectionMatrix * vertex;
texCoord = textureMatrix * vec4(texCoordAttribute, 0.0, 1.0);
frontColor = colorAttribute;
}