From 774ebd19511c4820016a795e854de9c17cd4749b Mon Sep 17 00:00:00 2001 From: "Stephen M. Cameron" Date: Sun, 17 Feb 2019 20:07:19 -0500 Subject: [PATCH] Make it work with opengl 2.0 again The only thing we were using from 3.0 was "in" and "out" instead of "attribute" and "varying" in the vertex shaders and "in" instead of "varying" in the fragment shaders. Signed-off-by: Stephen M. Cameron --- graph_dev_opengl.c | 2 +- share/snis/shader/alpha_by_normal.shader | 18 +++++----- share/snis/shader/atmosphere.frag | 6 ++-- share/snis/shader/atmosphere.vert | 10 +++--- share/snis/shader/color_by_w.frag | 2 +- share/snis/shader/color_by_w.vert | 4 +-- share/snis/shader/fs-effect-copy.shader | 8 ++--- share/snis/shader/line-single-color.frag | 4 +-- share/snis/shader/line-single-color.vert | 12 +++---- share/snis/shader/per_vertex_color.frag | 2 +- share/snis/shader/per_vertex_color.vert | 6 ++-- share/snis/shader/point_cloud.vert | 2 +- .../shader/single-color-lit-per-pixel.frag | 6 ++-- .../shader/single-color-lit-per-pixel.vert | 10 +++--- .../shader/single-color-lit-per-vertex.frag | 2 +- .../shader/single-color-lit-per-vertex.vert | 6 ++-- share/snis/shader/single_color.vert | 2 +- share/snis/shader/skybox.frag | 2 +- share/snis/shader/skybox.vert | 4 +-- share/snis/shader/smaa-blend.shader | 16 ++++----- share/snis/shader/smaa-edge.shader | 12 +++---- share/snis/shader/smaa-neighborhood.shader | 12 +++---- .../shader/textured-and-lit-per-pixel.shader | 34 +++++++++--------- .../shader/textured-and-lit-per-vertex.shader | 14 ++++---- .../textured-cubemap-and-lit-per-pixel.shader | 32 ++++++++--------- ...textured-cubemap-and-lit-per-vertex.shader | 12 +++---- ...d-lit-with-annulus-shadow-per-pixel.shader | 32 ++++++++--------- .../textured-cubemap-shield-per-pixel.shader | 16 ++++----- share/snis/shader/textured-particle.frag | 4 +-- share/snis/shader/textured-particle.vert | 20 +++++------ ...xtured-with-sphere-shadow-per-pixel.shader | 36 +++++++++---------- share/snis/shader/textured.shader | 12 +++---- .../wireframe-transparent-sphere-clip.frag | 6 ++-- .../wireframe-transparent-sphere-clip.vert | 10 +++--- share/snis/shader/wireframe_filled.frag | 2 +- share/snis/shader/wireframe_filled.vert | 12 +++---- share/snis/shader/wireframe_transparent.frag | 2 +- share/snis/shader/wireframe_transparent.vert | 6 ++-- 38 files changed, 199 insertions(+), 199 deletions(-) diff --git a/graph_dev_opengl.c b/graph_dev_opengl.c index 09c90d24..acfda1d1 100644 --- a/graph_dev_opengl.c +++ b/graph_dev_opengl.c @@ -24,7 +24,7 @@ #include "snis_typeface.h" #include "opengl_cap.h" -#define OPENGL_VERSION_STRING "#version 130\n" +#define OPENGL_VERSION_STRING "#version 120\n" #define AMBIENT_LIGHT_DEFINE "#define AMBIENT 0.05\n" #define UNIVERSAL_SHADER_HEADER \ OPENGL_VERSION_STRING \ diff --git a/share/snis/shader/alpha_by_normal.shader b/share/snis/shader/alpha_by_normal.shader index 33bfd7ad..227e5af1 100644 --- a/share/snis/shader/alpha_by_normal.shader +++ b/share/snis/shader/alpha_by_normal.shader @@ -2,10 +2,10 @@ uniform float u_Invert; #if defined(INCLUDE_VS) - out vec4 v_TintColor; - out float v_EyeDot; + varying vec4 v_TintColor; + varying float v_EyeDot; #if defined(TEXTURED_ALPHA_BY_NORMAL) - out vec2 v_TexCoord; // This will be passed into the fragment shader. + varying vec2 v_TexCoord; // This will be passed into the fragment shader. #endif uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. @@ -13,10 +13,10 @@ uniform float u_Invert; uniform vec4 u_TintColor; uniform mat3 u_NormalMatrix; - in vec4 a_Position; // Per-vertex position information we will pass in. - in vec3 a_Normal; + attribute vec4 a_Position; // Per-vertex position information we will pass in. + attribute vec3 a_Normal; #if defined(TEXTURED_ALPHA_BY_NORMAL) - in vec2 a_TexCoord; // Per-vertex texture coord we will pass in. + attribute vec2 a_TexCoord; // Per-vertex texture coord we will pass in. #endif void main() { @@ -38,10 +38,10 @@ uniform float u_Invert; #endif #if defined(INCLUDE_FS) - in vec4 v_TintColor; - in float v_EyeDot; + varying vec4 v_TintColor; + varying float v_EyeDot; #if defined(TEXTURED_ALPHA_BY_NORMAL) - in vec2 v_TexCoord; // This will be passed into the fragment shader. + varying vec2 v_TexCoord; // This will be passed into the fragment shader. #endif #if defined(TEXTURED_ALPHA_BY_NORMAL) diff --git a/share/snis/shader/atmosphere.frag b/share/snis/shader/atmosphere.frag index 6d50e5f7..be75590a 100644 --- a/share/snis/shader/atmosphere.frag +++ b/share/snis/shader/atmosphere.frag @@ -2,9 +2,9 @@ uniform vec3 u_LightPos; // The position of the light in eye space. uniform float u_Alpha; // Relative alpha, 0.0 - 1.0. -in vec3 v_Position; // Interpolated position for this fragment. -in vec3 v_Color; // This is the color from the vertex shader interpolated across the triangle per fragment -in vec3 v_Normal; // Interpolated normal for this fragment. +varying vec3 v_Position; // Interpolated position for this fragment. +varying vec3 v_Color; // This is the color from the vertex shader interpolated across the triangle per fragment +varying vec3 v_Normal; // Interpolated normal for this fragment. #if !defined(AMBIENT) #define AMBIENT 0.01 diff --git a/share/snis/shader/atmosphere.vert b/share/snis/shader/atmosphere.vert index eb87f92d..d47c9ce6 100644 --- a/share/snis/shader/atmosphere.vert +++ b/share/snis/shader/atmosphere.vert @@ -4,12 +4,12 @@ uniform mat4 u_MVMatrix; // A constant representing the combined model/vie uniform mat3 u_NormalMatrix; uniform vec3 u_Color; // Per-object color information we will pass in. -in vec4 a_Position; // Per-vertex position information we will pass in. -in vec3 a_Normal; // Per-vertex normal information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec3 a_Normal; // Per-vertex normal information we will pass in. -out vec3 v_Position; // This will be passed into the fragment shader. -out vec3 v_Color; // This will be passed into the fragment shader. -out vec3 v_Normal; // This will be passed into the fragment shader. +varying vec3 v_Position; // This will be passed into the fragment shader. +varying vec3 v_Color; // This will be passed into the fragment shader. +varying vec3 v_Normal; // This will be passed into the fragment shader. // The entry point for our vertex shader. void main() diff --git a/share/snis/shader/color_by_w.frag b/share/snis/shader/color_by_w.frag index 5207d11c..7e98c815 100644 --- a/share/snis/shader/color_by_w.frag +++ b/share/snis/shader/color_by_w.frag @@ -1,5 +1,5 @@ -in vec3 v_Color; // Per-vertex color information +varying vec3 v_Color; // Per-vertex color information void main() { diff --git a/share/snis/shader/color_by_w.vert b/share/snis/shader/color_by_w.vert index 0863878b..44e3e05a 100644 --- a/share/snis/shader/color_by_w.vert +++ b/share/snis/shader/color_by_w.vert @@ -9,9 +9,9 @@ uniform float u_CenterW; uniform vec3 u_FarColor; uniform float u_FarW; -in vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. -out vec3 v_Color; +varying vec3 v_Color; void main() { diff --git a/share/snis/shader/fs-effect-copy.shader b/share/snis/shader/fs-effect-copy.shader index 087fd685..a8f578f4 100644 --- a/share/snis/shader/fs-effect-copy.shader +++ b/share/snis/shader/fs-effect-copy.shader @@ -20,11 +20,11 @@ #ifdef INCLUDE_VS - out vec2 v_TexCoord; + varying vec2 v_TexCoord; uniform mat4 u_MVPMatrix; - in vec4 a_Position; - in vec2 a_TexCoord; + attribute vec4 a_Position; + attribute vec2 a_TexCoord; void main(void) { @@ -34,7 +34,7 @@ #endif #ifdef INCLUDE_FS - in vec2 v_TexCoord; + varying vec2 v_TexCoord; uniform sampler2D texture0Sampler; uniform vec4 u_TintColor; diff --git a/share/snis/shader/line-single-color.frag b/share/snis/shader/line-single-color.frag index 8ad52121..563bca1f 100644 --- a/share/snis/shader/line-single-color.frag +++ b/share/snis/shader/line-single-color.frag @@ -25,8 +25,8 @@ uniform float u_DotSize; uniform float u_DotPitch; uniform vec4 u_LineColor; -in float v_IsDotted; -in vec4 v_Dist; +varying float v_IsDotted; +varying vec4 v_Dist; void main(void) { diff --git a/share/snis/shader/line-single-color.vert b/share/snis/shader/line-single-color.vert index 5bebed87..62dbad19 100644 --- a/share/snis/shader/line-single-color.vert +++ b/share/snis/shader/line-single-color.vert @@ -24,14 +24,14 @@ uniform mat4 u_MVPMatrix; uniform vec2 u_Viewport; -in vec4 a_MultiOne; -in vec4 a_Position; +attribute vec4 a_MultiOne; +attribute vec4 a_Position; // Coordinates of the line vertices this vertex belongs to -in vec4 a_LineVertex0; -in vec4 a_LineVertex1; +attribute vec4 a_LineVertex0; +attribute vec4 a_LineVertex1; -out float v_IsDotted; -out vec4 v_Dist; +varying float v_IsDotted; +varying vec4 v_Dist; void main(void) { diff --git a/share/snis/shader/per_vertex_color.frag b/share/snis/shader/per_vertex_color.frag index 55f65627..1e399391 100644 --- a/share/snis/shader/per_vertex_color.frag +++ b/share/snis/shader/per_vertex_color.frag @@ -1,5 +1,5 @@ -in vec4 v_Color; // Per-vertex color information we got passed. +varying vec4 v_Color; // Per-vertex color information we got passed. void main() { diff --git a/share/snis/shader/per_vertex_color.vert b/share/snis/shader/per_vertex_color.vert index 01170a6e..65949991 100644 --- a/share/snis/shader/per_vertex_color.vert +++ b/share/snis/shader/per_vertex_color.vert @@ -1,10 +1,10 @@ uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. -in vec4 a_Position; // Per-vertex position information we will pass in. -in vec4 a_Color; // Per-vertex color information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec4 a_Color; // Per-vertex color information we will pass in. -out vec4 v_Color; // Per-vertex color information we will pass down. +varying vec4 v_Color; // Per-vertex color information we will pass down. void main() { diff --git a/share/snis/shader/point_cloud.vert b/share/snis/shader/point_cloud.vert index 1d08e2f4..00d2eadf 100644 --- a/share/snis/shader/point_cloud.vert +++ b/share/snis/shader/point_cloud.vert @@ -2,7 +2,7 @@ uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. uniform float u_PointSize; -in vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. void main() { diff --git a/share/snis/shader/single-color-lit-per-pixel.frag b/share/snis/shader/single-color-lit-per-pixel.frag index 7d96f684..a3a25799 100644 --- a/share/snis/shader/single-color-lit-per-pixel.frag +++ b/share/snis/shader/single-color-lit-per-pixel.frag @@ -1,9 +1,9 @@ uniform vec3 u_LightPos; // The position of the light in eye space. -in vec3 v_Position; // Interpolated position for this fragment. -in vec3 v_Color; // This is the color from the vertex shader interpolated across the triangle per fragment -in vec3 v_Normal; // Interpolated normal for this fragment. +varying vec3 v_Position; // Interpolated position for this fragment. +varying vec3 v_Color; // This is the color from the vertex shader interpolated across the triangle per fragment +varying vec3 v_Normal; // Interpolated normal for this fragment. #if !defined(AMBIENT) #define AMBIENT 0.1 diff --git a/share/snis/shader/single-color-lit-per-pixel.vert b/share/snis/shader/single-color-lit-per-pixel.vert index eb87f92d..d47c9ce6 100644 --- a/share/snis/shader/single-color-lit-per-pixel.vert +++ b/share/snis/shader/single-color-lit-per-pixel.vert @@ -4,12 +4,12 @@ uniform mat4 u_MVMatrix; // A constant representing the combined model/vie uniform mat3 u_NormalMatrix; uniform vec3 u_Color; // Per-object color information we will pass in. -in vec4 a_Position; // Per-vertex position information we will pass in. -in vec3 a_Normal; // Per-vertex normal information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec3 a_Normal; // Per-vertex normal information we will pass in. -out vec3 v_Position; // This will be passed into the fragment shader. -out vec3 v_Color; // This will be passed into the fragment shader. -out vec3 v_Normal; // This will be passed into the fragment shader. +varying vec3 v_Position; // This will be passed into the fragment shader. +varying vec3 v_Color; // This will be passed into the fragment shader. +varying vec3 v_Normal; // This will be passed into the fragment shader. // The entry point for our vertex shader. void main() diff --git a/share/snis/shader/single-color-lit-per-vertex.frag b/share/snis/shader/single-color-lit-per-vertex.frag index e18969a9..d7bf1819 100644 --- a/share/snis/shader/single-color-lit-per-vertex.frag +++ b/share/snis/shader/single-color-lit-per-vertex.frag @@ -1,5 +1,5 @@ -in vec3 v_Color; +varying vec3 v_Color; void main() { diff --git a/share/snis/shader/single-color-lit-per-vertex.vert b/share/snis/shader/single-color-lit-per-vertex.vert index 8b143bd5..68377252 100644 --- a/share/snis/shader/single-color-lit-per-vertex.vert +++ b/share/snis/shader/single-color-lit-per-vertex.vert @@ -6,10 +6,10 @@ uniform vec3 u_Color; // Per-object color information we will pass in. uniform vec3 u_LightPos; // The position of the light in eye space. -in vec4 a_Position; // Per-vertex position information we will pass in. -in vec3 a_Normal; // Per-vertex normal information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec3 a_Normal; // Per-vertex normal information we will pass in. -out vec3 v_Color; // This will be passed into the fragment shader. +varying vec3 v_Color; // This will be passed into the fragment shader. #if !defined(AMBIENT) #define AMBIENT 0.1 diff --git a/share/snis/shader/single_color.vert b/share/snis/shader/single_color.vert index 3b2cdbfb..e18a3548 100644 --- a/share/snis/shader/single_color.vert +++ b/share/snis/shader/single_color.vert @@ -1,7 +1,7 @@ uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. -in vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. void main() { diff --git a/share/snis/shader/skybox.frag b/share/snis/shader/skybox.frag index 8ba67f73..ca809576 100644 --- a/share/snis/shader/skybox.frag +++ b/share/snis/shader/skybox.frag @@ -1,7 +1,7 @@ uniform samplerCube texture; -in vec3 texCoord; +varying vec3 texCoord; void main (void) { gl_FragColor = textureCube(texture, texCoord); diff --git a/share/snis/shader/skybox.vert b/share/snis/shader/skybox.vert index c26753dd..99d7c731 100644 --- a/share/snis/shader/skybox.vert +++ b/share/snis/shader/skybox.vert @@ -1,8 +1,8 @@ uniform mat4 MVP; -in vec3 vertex; -out vec3 texCoord; +attribute vec3 vertex; +varying vec3 texCoord; void main() { texCoord = vertex; diff --git a/share/snis/shader/smaa-blend.shader b/share/snis/shader/smaa-blend.shader index 4de90ecc..3059c22e 100644 --- a/share/snis/shader/smaa-blend.shader +++ b/share/snis/shader/smaa-blend.shader @@ -19,14 +19,14 @@ */ #if defined(INCLUDE_VS) - out vec2 v_TexCoord; - out vec2 v_PixCoord; - out vec4 v_Offset[3]; + varying vec2 v_TexCoord; + varying vec2 v_PixCoord; + varying vec4 v_Offset[3]; uniform mat4 u_MVPMatrix; - in vec4 a_Position; - in vec2 a_TexCoord; + attribute vec4 a_Position; + attribute vec2 a_TexCoord; void main() { @@ -38,9 +38,9 @@ #endif #if defined(INCLUDE_FS) - in vec2 v_TexCoord; - in vec2 v_PixCoord; - in vec4 v_Offset[3]; + varying vec2 v_TexCoord; + varying vec2 v_PixCoord; + varying vec4 v_Offset[3]; uniform sampler2D u_EdgeTex; uniform sampler2D u_AreaTex; uniform sampler2D u_SearchTex; diff --git a/share/snis/shader/smaa-edge.shader b/share/snis/shader/smaa-edge.shader index 7db8a4d6..2f225ecd 100644 --- a/share/snis/shader/smaa-edge.shader +++ b/share/snis/shader/smaa-edge.shader @@ -19,13 +19,13 @@ */ #if defined(INCLUDE_VS) - out vec2 v_TexCoord; - out vec4 v_Offset[3]; + varying vec2 v_TexCoord; + varying vec4 v_Offset[3]; uniform mat4 u_MVPMatrix; - in vec4 a_Position; - in vec2 a_TexCoord; + attribute vec4 a_Position; + attribute vec2 a_TexCoord; void main() { @@ -37,8 +37,8 @@ #endif #if defined(INCLUDE_FS) - in vec2 v_TexCoord; - in vec4 v_Offset[3]; + varying vec2 v_TexCoord; + varying vec4 v_Offset[3]; uniform sampler2D u_AlbedoTex; diff --git a/share/snis/shader/smaa-neighborhood.shader b/share/snis/shader/smaa-neighborhood.shader index 57b36d64..9fe3c88c 100644 --- a/share/snis/shader/smaa-neighborhood.shader +++ b/share/snis/shader/smaa-neighborhood.shader @@ -19,13 +19,13 @@ */ #if defined(INCLUDE_VS) - out vec2 v_TexCoord; - out vec4 v_Offset; + varying vec2 v_TexCoord; + varying vec4 v_Offset; uniform mat4 u_MVPMatrix; - in vec4 a_Position; - in vec2 a_TexCoord; + attribute vec4 a_Position; + attribute vec2 a_TexCoord; void main() { @@ -37,8 +37,8 @@ #endif #if defined(INCLUDE_FS) - in vec2 v_TexCoord; - in vec4 v_Offset; + varying vec2 v_TexCoord; + varying vec4 v_Offset; uniform sampler2D u_AlbedoTex; uniform sampler2D u_BlendTex; diff --git a/share/snis/shader/textured-and-lit-per-pixel.shader b/share/snis/shader/textured-and-lit-per-pixel.shader index ab9a116a..13d8be26 100644 --- a/share/snis/shader/textured-and-lit-per-pixel.shader +++ b/share/snis/shader/textured-and-lit-per-pixel.shader @@ -21,28 +21,28 @@ uniform float u_SpecularIntensity; /* between 0 and 1, 1 is very shiny, 0 is fla #endif #if defined(INCLUDE_VS) - out vec3 v_Position; - out UV_TYPE v_TexCoord; - out vec3 v_Normal; + varying vec3 v_Position; + varying UV_TYPE v_TexCoord; + varying vec3 v_Normal; #ifdef USE_NORMAL_MAP - out vec3 v_Tangent; - out vec3 v_BiTangent; - out mat3 tbn; + varying vec3 v_Tangent; + varying vec3 v_BiTangent; + varying mat3 tbn; #endif uniform mat4 u_MVPMatrix; uniform mat4 u_MVMatrix; uniform mat3 u_NormalMatrix; - in vec4 a_Position; + attribute vec4 a_Position; #if !defined(USE_CUBEMAP) - in vec2 a_TexCoord; + attribute vec2 a_TexCoord; #endif - in vec3 a_Normal; + attribute vec3 a_Normal; #ifdef USE_NORMAL_MAP - in vec3 a_Tangent; - in vec3 a_BiTangent; + attribute vec3 a_Tangent; + attribute vec3 a_BiTangent; #endif void main() @@ -66,14 +66,14 @@ uniform float u_SpecularIntensity; /* between 0 and 1, 1 is very shiny, 0 is fla #endif #if defined(INCLUDE_FS) - in vec3 v_Position; - in UV_TYPE v_TexCoord; - in vec3 v_Normal; + varying vec3 v_Position; + varying UV_TYPE v_TexCoord; + varying vec3 v_Normal; #ifdef USE_NORMAL_MAP - in vec3 v_Tangent; - in vec3 v_BiTangent; - in mat3 tbn; + varying vec3 v_Tangent; + varying vec3 v_BiTangent; + varying mat3 tbn; #endif uniform TEX_SAMPLER u_AlbedoTex; diff --git a/share/snis/shader/textured-and-lit-per-vertex.shader b/share/snis/shader/textured-and-lit-per-vertex.shader index 7c5697c6..f798b446 100644 --- a/share/snis/shader/textured-and-lit-per-vertex.shader +++ b/share/snis/shader/textured-and-lit-per-vertex.shader @@ -1,16 +1,16 @@ #if defined(INCLUDE_VS) - out vec3 v_LightColor; - out vec2 v_TexCoord; + varying vec3 v_LightColor; + varying vec2 v_TexCoord; uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. uniform mat4 u_MVMatrix; // A constant representing the combined model/view matrix. uniform mat3 u_NormalMatrix; uniform vec3 u_LightPos; // The position of the light in eye space. - in vec4 a_Position; // Per-vertex position information we will pass in. - in vec3 a_Normal; // Per-vertex normal information we will pass in. - in vec2 a_TexCoord; // Per-vertex texture coord we will pass in. + attribute vec4 a_Position; // Per-vertex position information we will pass in. + attribute vec3 a_Normal; // Per-vertex normal information we will pass in. + attribute vec2 a_TexCoord; // Per-vertex texture coord we will pass in. #if !defined(AMBIENT) #define AMBIENT 0.1 @@ -40,8 +40,8 @@ #endif #if defined(INCLUDE_FS) - in vec3 v_LightColor; - in vec2 v_TexCoord; + varying vec3 v_LightColor; + varying vec2 v_TexCoord; uniform sampler2D u_AlbedoTex; uniform vec4 u_TintColor; diff --git a/share/snis/shader/textured-cubemap-and-lit-per-pixel.shader b/share/snis/shader/textured-cubemap-and-lit-per-pixel.shader index a850d9c0..92ccb5b2 100644 --- a/share/snis/shader/textured-cubemap-and-lit-per-pixel.shader +++ b/share/snis/shader/textured-cubemap-and-lit-per-pixel.shader @@ -27,25 +27,25 @@ #endif #if defined(INCLUDE_VS) - out vec3 v_Position; - out vec3 v_Normal; - out vec3 v_TexCoord; + varying vec3 v_Position; + varying vec3 v_Normal; + varying vec3 v_TexCoord; #if defined(USE_NORMAL_MAP) - out vec3 v_Tangent; - out vec3 v_BiTangent; - out mat3 tbn; + varying vec3 v_Tangent; + varying vec3 v_BiTangent; + varying mat3 tbn; #endif uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. uniform mat4 u_MVMatrix; // A constant representing the combined model/view matrix. uniform mat3 u_NormalMatrix; - in vec4 a_Position; // Per-vertex position information we will pass in. - in vec3 a_Normal; // Per-vertex normal, tangent, and bitangent information we will pass in. + attribute vec4 a_Position; // Per-vertex position information we will pass in. + attribute vec3 a_Normal; // Per-vertex normal, tangent, and bitangent information we will pass in. #if defined(USE_NORMAL_MAP) - in vec3 a_Tangent; - in vec3 a_BiTangent; + attribute vec3 a_Tangent; + attribute vec3 a_BiTangent; #endif void main() @@ -69,14 +69,14 @@ #endif #if defined(INCLUDE_FS) - in vec3 v_Position; - in vec3 v_Normal; - in vec3 v_TexCoord; + varying vec3 v_Position; + varying vec3 v_Normal; + varying vec3 v_TexCoord; #if defined(USE_NORMAL_MAP) - in vec3 v_Tangent; - in vec3 v_BiTangent; - in mat3 tbn; + varying vec3 v_Tangent; + varying vec3 v_BiTangent; + varying mat3 tbn; #endif uniform samplerCube u_AlbedoTex; diff --git a/share/snis/shader/textured-cubemap-and-lit-per-vertex.shader b/share/snis/shader/textured-cubemap-and-lit-per-vertex.shader index b803829b..d67d482b 100644 --- a/share/snis/shader/textured-cubemap-and-lit-per-vertex.shader +++ b/share/snis/shader/textured-cubemap-and-lit-per-vertex.shader @@ -5,15 +5,15 @@ #endif #if defined(INCLUDE_VS) - out vec3 v_TexCoord; - out vec3 v_LightColor; + varying vec3 v_TexCoord; + varying vec3 v_LightColor; uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. uniform mat4 u_MVMatrix; // A constant representing the combined model/view matrix. uniform mat3 u_NormalMatrix; uniform vec3 u_LightPos; // The position of the light in eye space. - in vec4 a_Position; // Per-vertex position information we will pass in. - in vec3 a_Normal; // Per-vertex normal information we will pass in. + attribute vec4 a_Position; // Per-vertex position information we will pass in. + attribute vec3 a_Normal; // Per-vertex normal information we will pass in. void main() { @@ -39,8 +39,8 @@ #endif #if defined(INCLUDE_FS) - in vec3 v_TexCoord; - in vec3 v_LightColor; + varying vec3 v_TexCoord; + varying vec3 v_LightColor; uniform samplerCube u_AlbedoTex; uniform samplerCube u_NormalMapTex; uniform vec4 u_TintColor; diff --git a/share/snis/shader/textured-cubemap-and-lit-with-annulus-shadow-per-pixel.shader b/share/snis/shader/textured-cubemap-and-lit-with-annulus-shadow-per-pixel.shader index 6aa18d97..f05cdfc7 100644 --- a/share/snis/shader/textured-cubemap-and-lit-with-annulus-shadow-per-pixel.shader +++ b/share/snis/shader/textured-cubemap-and-lit-with-annulus-shadow-per-pixel.shader @@ -22,25 +22,25 @@ */ #if defined(INCLUDE_VS) - out vec3 v_Position; - out vec3 v_Normal; - out vec3 v_TexCoord; + varying vec3 v_Position; + varying vec3 v_Normal; + varying vec3 v_TexCoord; #if defined(USE_NORMAL_MAP) - out vec3 v_Tangent; - out vec3 v_BiTangent; - out mat3 tbn; + varying vec3 v_Tangent; + varying vec3 v_BiTangent; + varying mat3 tbn; #endif uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. uniform mat4 u_MVMatrix; // A constant representing the combined model/view matrix. uniform mat3 u_NormalMatrix; - in vec4 a_Position; // Per-vertex position information we will pass in. - in vec3 a_Normal; // Per-vertex normal, tangent, and bitangent information we will pass in. + attribute vec4 a_Position; // Per-vertex position information we will pass in. + attribute vec3 a_Normal; // Per-vertex normal, tangent, and bitangent information we will pass in. #if defined(USE_NORMAL_MAP) - in vec3 a_Tangent; - in vec3 a_BiTangent; + attribute vec3 a_Tangent; + attribute vec3 a_BiTangent; #endif void main() @@ -65,14 +65,14 @@ #endif #if defined(INCLUDE_FS) - in vec3 v_Position; - in vec3 v_Normal; - in vec3 v_TexCoord; + varying vec3 v_Position; + varying vec3 v_Normal; + varying vec3 v_TexCoord; #if defined(USE_NORMAL_MAP) - in vec3 v_Tangent; - in vec3 v_BiTangent; - in mat3 tbn; + varying vec3 v_Tangent; + varying vec3 v_BiTangent; + varying mat3 tbn; #endif uniform samplerCube u_AlbedoTex; diff --git a/share/snis/shader/textured-cubemap-shield-per-pixel.shader b/share/snis/shader/textured-cubemap-shield-per-pixel.shader index 31347e3c..b0967c1d 100644 --- a/share/snis/shader/textured-cubemap-shield-per-pixel.shader +++ b/share/snis/shader/textured-cubemap-shield-per-pixel.shader @@ -27,16 +27,16 @@ #if defined(INCLUDE_VS) - out vec3 v_Position; - out vec3 v_Normal; - out vec3 v_TexCoord; + varying vec3 v_Position; + varying vec3 v_Normal; + varying vec3 v_TexCoord; uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. uniform mat4 u_MVMatrix; // A constant representing the combined model/view matrix. uniform mat3 u_NormalMatrix; - in vec4 a_Position; // Per-vertex position information we will pass in. - in vec3 a_Normal; // Per-vertex normal information we will pass in. + attribute vec4 a_Position; // Per-vertex position information we will pass in. + attribute vec3 a_Normal; // Per-vertex normal information we will pass in. void main() { @@ -55,9 +55,9 @@ #endif #if defined(INCLUDE_FS) - in vec3 v_Position; - in vec3 v_Normal; - in vec3 v_TexCoord; + varying vec3 v_Position; + varying vec3 v_Normal; + varying vec3 v_TexCoord; uniform samplerCube u_AlbedoTex; uniform vec4 u_TintColor; diff --git a/share/snis/shader/textured-particle.frag b/share/snis/shader/textured-particle.frag index 21cd0e78..10279385 100644 --- a/share/snis/shader/textured-particle.frag +++ b/share/snis/shader/textured-particle.frag @@ -1,8 +1,8 @@ uniform sampler2D u_AlbedoTex; -in vec2 v_TexCoord; -in vec4 v_TintColor; +varying vec2 v_TexCoord; +varying vec4 v_TintColor; void main() { diff --git a/share/snis/shader/textured-particle.vert b/share/snis/shader/textured-particle.vert index de24974a..9918a6f0 100644 --- a/share/snis/shader/textured-particle.vert +++ b/share/snis/shader/textured-particle.vert @@ -7,16 +7,16 @@ uniform vec3 u_CameraRightVec; // model space camera right vector uniform float u_Time; // 0.0 to 1.0 animation position uniform float u_Radius; // size of billboard vertex offset -in vec4 a_MultiOne; // 0,1=texture coordinate 0,1; 2=time offset -in vec3 a_StartPosition; // start position -in vec3 a_StartTintColor; // start tint color -in vec2 a_StartAPM; // start APM 0=additivity; 1=opacity -in vec3 a_EndPosition; // end position -in vec3 a_EndTintColor; // end tint color -in vec2 a_EndAPM; // end APM 0=additivity; 1=opacity - -out vec2 v_TexCoord; // texture coordinate passed to fragment shader -out vec4 v_TintColor; // tint color passed to fragment shader +attribute vec4 a_MultiOne; // 0,1=texture coordinate 0,1; 2=time offset +attribute vec3 a_StartPosition; // start position +attribute vec3 a_StartTintColor; // start tint color +attribute vec2 a_StartAPM; // start APM 0=additivity; 1=opacity +attribute vec3 a_EndPosition; // end position +attribute vec3 a_EndTintColor; // end tint color +attribute vec2 a_EndAPM; // end APM 0=additivity; 1=opacity + +varying vec2 v_TexCoord; // texture coordinate passed to fragment shader +varying vec4 v_TintColor; // tint color passed to fragment shader void main() { diff --git a/share/snis/shader/textured-with-sphere-shadow-per-pixel.shader b/share/snis/shader/textured-with-sphere-shadow-per-pixel.shader index b61d57cf..fa47b190 100644 --- a/share/snis/shader/textured-with-sphere-shadow-per-pixel.shader +++ b/share/snis/shader/textured-with-sphere-shadow-per-pixel.shader @@ -24,17 +24,17 @@ #if defined(INCLUDE_VS) - in vec4 a_Position; // Per-vertex position information we will pass in. - in vec2 a_TexCoord; // Per-vertex texture coord we will pass in. - in vec3 a_Normal; // Per-vertex normal we pass in. - - out vec4 v_TintColor; - out vec2 v_TexCoord; - out vec3 v_Position; // Fragment position in eye space - out vec3 v_LightDir; // normalized vector from fragment to light in eye space - out float v_darkside_shading; // Shading multiplier for ring, 1.0 on light side, 0.2 on dark side - out vec3 v_Normal; // Normal at fragment (i.e. normal to the ring plane) - out float v_sameside; // 1.0 if eye and light are on same side of ring plane, 0.0 otherwise + attribute vec4 a_Position; // Per-vertex position information we will pass in. + attribute vec2 a_TexCoord; // Per-vertex texture coord we will pass in. + attribute vec3 a_Normal; // Per-vertex normal we pass in. + + varying vec4 v_TintColor; + varying vec2 v_TexCoord; + varying vec3 v_Position; // Fragment position in eye space + varying vec3 v_LightDir; // normalized vector from fragment to light in eye space + varying float v_darkside_shading; // Shading multiplier for ring, 1.0 on light side, 0.2 on dark side + varying vec3 v_Normal; // Normal at fragment (i.e. normal to the ring plane) + varying float v_sameside; // 1.0 if eye and light are on same side of ring plane, 0.0 otherwise uniform mat4 u_MVMatrix; // A constant representing the combined model/view matrix. uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. @@ -72,13 +72,13 @@ #endif #if defined(INCLUDE_FS) - in vec4 v_TintColor; - in vec2 v_TexCoord; - in vec3 v_Position; // Fragment position in eye space - in vec3 v_LightDir; // normalized vector from fragment to light in eye space - in float v_darkside_shading; // Shading multiplier for ring, 1.0 on light side, 0.2 on dark side - in vec3 v_Normal; // Normal at fragment (i.e. normal to the ring plane) - in float v_sameside; // 1.0 if eye and light are on same side of ring plane, 0.0 otherwise + varying vec4 v_TintColor; + varying vec2 v_TexCoord; + varying vec3 v_Position; // Fragment position in eye space + varying vec3 v_LightDir; // normalized vector from fragment to light in eye space + varying float v_darkside_shading; // Shading multiplier for ring, 1.0 on light side, 0.2 on dark side + varying vec3 v_Normal; // Normal at fragment (i.e. normal to the ring plane) + varying float v_sameside; // 1.0 if eye and light are on same side of ring plane, 0.0 otherwise uniform sampler2D u_AlbedoTex; uniform vec4 u_Sphere; /* eye space occluding sphere, x,y,z = center, w = radius^2 */ diff --git a/share/snis/shader/textured.shader b/share/snis/shader/textured.shader index 70eaa1f4..ee3ab47c 100644 --- a/share/snis/shader/textured.shader +++ b/share/snis/shader/textured.shader @@ -1,14 +1,14 @@ #if defined(INCLUDE_VS) - out vec4 v_TintColor; - out vec2 v_TexCoord; // This will be passed into the fragment shader. + varying vec4 v_TintColor; + varying vec2 v_TexCoord; // This will be passed into the fragment shader. uniform mat4 u_MVPMatrix; // A constant representing the combined model/view/projection matrix. uniform vec4 u_TintColor; - in vec3 a_Position; // Per-vertex position information we will pass in. - in vec2 a_TexCoord; // Per-vertex texture coord we will pass in. + attribute vec3 a_Position; // Per-vertex position information we will pass in. + attribute vec2 a_TexCoord; // Per-vertex texture coord we will pass in. void main() { @@ -19,8 +19,8 @@ #endif #if defined(INCLUDE_FS) - in vec4 v_TintColor; - in vec2 v_TexCoord; // This will be passed into the fragment shader. + varying vec4 v_TintColor; + varying vec2 v_TexCoord; // This will be passed into the fragment shader. uniform sampler2D u_AlbedoTex; void main() diff --git a/share/snis/shader/wireframe-transparent-sphere-clip.frag b/share/snis/shader/wireframe-transparent-sphere-clip.frag index e3374f8e..0697ecd2 100644 --- a/share/snis/shader/wireframe-transparent-sphere-clip.frag +++ b/share/snis/shader/wireframe-transparent-sphere-clip.frag @@ -3,9 +3,9 @@ uniform vec3 u_Color; // Per-object color information we will pass in. uniform vec4 u_ClipSphere; // clipping sphere, w=radius squared uniform float u_ClipSphereRadiusFade; // percent fade to black distance past clip radius -in vec2 v_FragRadius; // this fragments distance to sphere center -in float v_EyeDot; -in float v_ClipSphereDot; +varying vec2 v_FragRadius; // this fragments distance to sphere center +varying float v_EyeDot; +varying float v_ClipSphereDot; #define CULL_BACKFACE_CLIP_AND_CAMERA 0 diff --git a/share/snis/shader/wireframe-transparent-sphere-clip.vert b/share/snis/shader/wireframe-transparent-sphere-clip.vert index 86d51913..918455a1 100644 --- a/share/snis/shader/wireframe-transparent-sphere-clip.vert +++ b/share/snis/shader/wireframe-transparent-sphere-clip.vert @@ -5,12 +5,12 @@ uniform mat3 u_NormalMatrix; uniform vec3 u_Color; // Per-object color information we will pass in. uniform vec4 u_ClipSphere; // clipping sphere, x,y,z=center in eye space -in vec4 a_Position; // Per-vertex position information we will pass in. -in vec3 a_Normal; // Per-vertex normal information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec3 a_Normal; // Per-vertex normal information we will pass in. -out vec2 v_FragRadius; // fragment distance to sphere center -out float v_EyeDot; -out float v_ClipSphereDot; +varying vec2 v_FragRadius; // fragment distance to sphere center +varying float v_EyeDot; +varying float v_ClipSphereDot; void main() { diff --git a/share/snis/shader/wireframe_filled.frag b/share/snis/shader/wireframe_filled.frag index cdf1c384..fad95bbe 100644 --- a/share/snis/shader/wireframe_filled.frag +++ b/share/snis/shader/wireframe_filled.frag @@ -20,7 +20,7 @@ * Alexandros Frantzis (glmark2) */ -in vec4 dist; +varying vec4 dist; uniform vec3 line_color; uniform vec3 triangle_color; diff --git a/share/snis/shader/wireframe_filled.vert b/share/snis/shader/wireframe_filled.vert index 57bddadc..4cf8446f 100644 --- a/share/snis/shader/wireframe_filled.vert +++ b/share/snis/shader/wireframe_filled.vert @@ -29,17 +29,17 @@ // We are not using geometry shaders, though, as they are not // available in GLES 2.0. -in vec3 position; +attribute vec3 position; // Coordinates of the triangle vertices this vertex belongs to -in vec3 tvertex0; -in vec3 tvertex1; -in vec3 tvertex2; -in vec3 edge_mask; +attribute vec3 tvertex0; +attribute vec3 tvertex1; +attribute vec3 tvertex2; +attribute vec3 edge_mask; uniform vec2 Viewport; uniform mat4 ModelViewProjectionMatrix; -out vec4 dist; +varying vec4 dist; void main(void) { diff --git a/share/snis/shader/wireframe_transparent.frag b/share/snis/shader/wireframe_transparent.frag index abe8228f..90aa8bbd 100644 --- a/share/snis/shader/wireframe_transparent.frag +++ b/share/snis/shader/wireframe_transparent.frag @@ -1,7 +1,7 @@ uniform vec3 u_Color; // Per-object color information we will pass in. -in float v_EyeDot; +varying float v_EyeDot; void main() { diff --git a/share/snis/shader/wireframe_transparent.vert b/share/snis/shader/wireframe_transparent.vert index 59d2faa4..bc324376 100644 --- a/share/snis/shader/wireframe_transparent.vert +++ b/share/snis/shader/wireframe_transparent.vert @@ -4,10 +4,10 @@ uniform mat4 u_MVMatrix; // A constant representing the combined model/view ma uniform mat3 u_NormalMatrix; uniform vec3 u_Color; // Per-object color information we will pass in. -in vec4 a_Position; // Per-vertex position information we will pass in. -in vec3 a_Normal; // Per-vertex normal information we will pass in. +attribute vec4 a_Position; // Per-vertex position information we will pass in. +attribute vec3 a_Normal; // Per-vertex normal information we will pass in. -out float v_EyeDot; // This will be passed into the fragment shader. +varying float v_EyeDot; // This will be passed into the fragment shader. void main() {