diff --git a/core/src/processing/opengl/ColorFrag.glsl b/core/src/processing/opengl/ColorFrag.glsl index d5d23ae22..5ab649aec 100644 --- a/core/src/processing/opengl/ColorFrag.glsl +++ b/core/src/processing/opengl/ColorFrag.glsl @@ -23,8 +23,8 @@ precision mediump float; precision mediump int; #endif -varying vec4 vertColor; +varying vec4 varColor; void main() { - gl_FragColor = vertColor; + gl_FragColor = varColor; } \ No newline at end of file diff --git a/core/src/processing/opengl/ColorVert.glsl b/core/src/processing/opengl/ColorVert.glsl index 5a03b41a0..d43d40549 100644 --- a/core/src/processing/opengl/ColorVert.glsl +++ b/core/src/processing/opengl/ColorVert.glsl @@ -20,15 +20,15 @@ #define PROCESSING_COLOR_SHADER -uniform mat4 transform; +uniform mat4 transformMatrix; -attribute vec4 vertex; +attribute vec4 position; attribute vec4 color; -varying vec4 vertColor; +varying vec4 varColor; void main() { - gl_Position = transform * vertex; + gl_Position = transformMatrix * position; - vertColor = color; + varColor = color; } \ No newline at end of file diff --git a/core/src/processing/opengl/LightVert.glsl b/core/src/processing/opengl/LightVert.glsl index 6e5829fe2..cfdcc44e0 100644 --- a/core/src/processing/opengl/LightVert.glsl +++ b/core/src/processing/opengl/LightVert.glsl @@ -20,8 +20,8 @@ #define PROCESSING_LIGHT_SHADER -uniform mat4 modelview; -uniform mat4 transform; +uniform mat4 modelviewMatrix; +uniform mat4 transformMatrix; uniform mat3 normalMatrix; uniform int lightCount; @@ -33,7 +33,7 @@ uniform vec3 lightSpecular[8]; uniform vec3 lightFalloff[8]; uniform vec2 lightSpot[8]; -attribute vec4 vertex; +attribute vec4 position; attribute vec4 color; attribute vec3 normal; @@ -42,7 +42,7 @@ attribute vec4 specular; attribute vec4 emissive; attribute float shininess; -varying vec4 vertColor; +varying vec4 varColor; const float zero_float = 0.0; const float one_float = 1.0; @@ -75,10 +75,10 @@ float blinnPhongFactor(vec3 lightDir, vec3 vertPos, vec3 vecNormal, float shine) void main() { // Vertex in clip coordinates - gl_Position = transform * vertex; + gl_Position = transformMatrix * position; // Vertex in eye coordinates - vec3 ecVertex = vec3(modelview * vertex); + vec3 ecVertex = vec3(modelviewMatrix * position); // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * normal); @@ -134,8 +134,8 @@ void main() { // Calculating final color as result of all lights (plus emissive term). // Transparency is determined exclusively by the diffuse component. - vertColor = vec4(totalAmbient, 0) * ambient + - vec4(totalDiffuse, 1) * color + - vec4(totalSpecular, 0) * specular + - vec4(emissive.rgb, 0); + varColor = vec4(totalAmbient, 0) * ambient + + vec4(totalDiffuse, 1) * color + + vec4(totalSpecular, 0) * specular + + vec4(emissive.rgb, 0); } \ No newline at end of file diff --git a/core/src/processing/opengl/LineFrag.glsl b/core/src/processing/opengl/LineFrag.glsl index dc08a3fa2..8ce920e33 100644 --- a/core/src/processing/opengl/LineFrag.glsl +++ b/core/src/processing/opengl/LineFrag.glsl @@ -23,8 +23,8 @@ precision mediump float; precision mediump int; #endif -varying vec4 vertColor; +varying vec4 varColor; void main() { - gl_FragColor = vertColor; + gl_FragColor = varColor; } \ No newline at end of file diff --git a/core/src/processing/opengl/LineVert.glsl b/core/src/processing/opengl/LineVert.glsl index 52f334b28..37687845a 100644 --- a/core/src/processing/opengl/LineVert.glsl +++ b/core/src/processing/opengl/LineVert.glsl @@ -20,18 +20,18 @@ #define PROCESSING_LINE_SHADER -uniform mat4 modelview; -uniform mat4 projection; +uniform mat4 modelviewMatrix; +uniform mat4 projectionMatrix; uniform vec4 viewport; uniform int perspective; uniform vec3 scale; -attribute vec4 vertex; +attribute vec4 position; attribute vec4 color; attribute vec4 direction; -varying vec4 vertColor; +varying vec4 varColor; vec3 clipToWindow(vec4 clip, vec4 viewport) { vec3 post_div = clip.xyz / clip.w; @@ -45,20 +45,20 @@ vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) { } void main() { - vec4 posp = modelview * vertex; + vec4 posp = modelviewMatrix * position; // Moving vertices slightly toward the camera // to avoid depth-fighting with the fill triangles. // Discussed here: // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848 posp.xyz = posp.xyz * scale; - vec4 clipp = projection * posp; + vec4 clipp = projectionMatrix * posp; float thickness = direction.w; if (thickness != 0.0) { - vec4 posq = posp + modelview * vec4(direction.xyz, 0); + vec4 posq = posp + modelviewMatrix * vec4(direction.xyz, 0); posq.xyz = posq.xyz * scale; - vec4 clipq = projection * posq; + vec4 clipq = projectionMatrix * posq; vec3 window_p = clipToWindow(clipp, viewport); vec3 window_q = clipToWindow(clipq, viewport); @@ -81,5 +81,5 @@ void main() { gl_Position = clipp; } - vertColor = color; + varColor = color; } diff --git a/core/src/processing/opengl/MaskFrag.glsl b/core/src/processing/opengl/MaskFrag.glsl index 508a39649..4b517e3a0 100644 --- a/core/src/processing/opengl/MaskFrag.glsl +++ b/core/src/processing/opengl/MaskFrag.glsl @@ -28,11 +28,11 @@ precision mediump int; uniform sampler2D texture; uniform sampler2D mask; -varying vec4 vertTexCoord; +varying vec4 varTexCoord; void main() { - vec3 texColor = texture2D(texture, vertTexCoord.st).rgb; - vec3 maskColor = texture2D(mask, vertTexCoord.st).rgb; + vec3 texColor = texture2D(texture, varTexCoord.st).rgb; + vec3 maskColor = texture2D(mask, varTexCoord.st).rgb; float luminance = dot(maskColor, vec3(0.2126, 0.7152, 0.0722)); gl_FragColor = vec4(texColor, luminance); } \ No newline at end of file diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index ccaa95534..0623ba3c8 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -7180,6 +7180,8 @@ public class PGraphicsOpenGL extends PGraphics { @Override public void loadAttributes() { vertexLoc = getAttributeLoc("vertex"); + if (vertexLoc == -1) vertexLoc = getAttributeLoc("position"); + colorLoc = getAttributeLoc("color"); texCoordLoc = getAttributeLoc("texCoord"); normalLoc = getAttributeLoc("normal"); @@ -7401,6 +7403,8 @@ public class PGraphicsOpenGL extends PGraphics { @Override public void loadAttributes() { vertexLoc = getAttributeLoc("vertex"); + if (vertexLoc == -1) vertexLoc = getAttributeLoc("position"); + colorLoc = getAttributeLoc("color"); directionLoc = getAttributeLoc("direction"); } @@ -7499,6 +7503,8 @@ public class PGraphicsOpenGL extends PGraphics { @Override public void loadAttributes() { vertexLoc = getAttributeLoc("vertex"); + if (vertexLoc == -1) vertexLoc = getAttributeLoc("position"); + colorLoc = getAttributeLoc("color"); offsetLoc = getAttributeLoc("offset"); } diff --git a/core/src/processing/opengl/PointFrag.glsl b/core/src/processing/opengl/PointFrag.glsl index d5d23ae22..5ab649aec 100644 --- a/core/src/processing/opengl/PointFrag.glsl +++ b/core/src/processing/opengl/PointFrag.glsl @@ -23,8 +23,8 @@ precision mediump float; precision mediump int; #endif -varying vec4 vertColor; +varying vec4 varColor; void main() { - gl_FragColor = vertColor; + gl_FragColor = varColor; } \ No newline at end of file diff --git a/core/src/processing/opengl/PointVert.glsl b/core/src/processing/opengl/PointVert.glsl index 7523e3326..542efaa67 100644 --- a/core/src/processing/opengl/PointVert.glsl +++ b/core/src/processing/opengl/PointVert.glsl @@ -20,17 +20,17 @@ #define PROCESSING_POINT_SHADER -uniform mat4 projection; -uniform mat4 modelview; +uniform mat4 projectionMatrix; +uniform mat4 modelviewMatrix; uniform vec4 viewport; uniform int perspective; -attribute vec4 vertex; +attribute vec4 position; attribute vec4 color; attribute vec2 offset; -varying vec4 vertColor; +varying vec4 varColor; vec4 windowToClipVector(vec2 window, vec4 viewport, float clipw) { vec2 xypos = (window / viewport.zw) * 2.0; @@ -38,18 +38,18 @@ vec4 windowToClipVector(vec2 window, vec4 viewport, float clipw) { } void main() { - vec4 pos = modelview * vertex; - vec4 clip = projection * pos; + vec4 pos = modelviewMatrix * position; + vec4 clip = projectionMatrix * pos; if (0 < perspective) { // Perspective correction (points will look thiner as they move away // from the view position). - gl_Position = clip + projection * vec4(offset.xy, 0, 0); + gl_Position = clip + projectionMatrix * vec4(offset.xy, 0, 0); } else { // No perspective correction. vec4 offset = windowToClipVector(offset.xy, viewport, clip.w); gl_Position = clip + offset; } - vertColor = color; + varColor = color; } \ No newline at end of file diff --git a/core/src/processing/opengl/TexlightVert.glsl b/core/src/processing/opengl/TexlightVert.glsl index ff981c59c..620d50c70 100644 --- a/core/src/processing/opengl/TexlightVert.glsl +++ b/core/src/processing/opengl/TexlightVert.glsl @@ -20,8 +20,8 @@ #define PROCESSING_TEXLIGHT_SHADER -uniform mat4 modelview; -uniform mat4 transform; +uniform mat4 modelviewMatrix; +uniform mat4 transformMatrix; uniform mat3 normalMatrix; uniform mat4 texMatrix; @@ -34,7 +34,7 @@ uniform vec3 lightSpecular[8]; uniform vec3 lightFalloff[8]; uniform vec2 lightSpot[8]; -attribute vec4 vertex; +attribute vec4 position; attribute vec4 color; attribute vec3 normal; attribute vec2 texCoord; @@ -44,8 +44,8 @@ attribute vec4 specular; attribute vec4 emissive; attribute float shininess; -varying vec4 vertColor; -varying vec4 vertTexCoord; +varying vec4 varColor; +varying vec4 varTexCoord; const float zero_float = 0.0; const float one_float = 1.0; @@ -78,10 +78,10 @@ float blinnPhongFactor(vec3 lightDir, vec3 vertPos, vec3 vecNormal, float shine) void main() { // Vertex in clip coordinates - gl_Position = transform * vertex; + gl_Position = transformMatrix * position; // Vertex in eye coordinates - vec3 ecVertex = vec3(modelview * vertex); + vec3 ecVertex = vec3(modelviewMatrix * position); // Normal vector in eye coordinates vec3 ecNormal = normalize(normalMatrix * normal); @@ -137,11 +137,11 @@ void main() { // Calculating final color as result of all lights (plus emissive term). // Transparency is determined exclusively by the diffuse component. - vertColor = vec4(totalAmbient, 0) * ambient + - vec4(totalDiffuse, 1) * color + - vec4(totalSpecular, 0) * specular + - vec4(emissive.rgb, 0); + varColor = vec4(totalAmbient, 0) * ambient + + vec4(totalDiffuse, 1) * color + + vec4(totalSpecular, 0) * specular + + vec4(emissive.rgb, 0); // Calculating texture coordinates, with r and q set both to one - vertTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0); + varTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0); } diff --git a/core/src/processing/opengl/TextureFrag.glsl b/core/src/processing/opengl/TextureFrag.glsl index f041e61d1..dc3bcbe7e 100644 --- a/core/src/processing/opengl/TextureFrag.glsl +++ b/core/src/processing/opengl/TextureFrag.glsl @@ -27,9 +27,9 @@ uniform sampler2D texture; uniform vec2 texOffset; -varying vec4 vertColor; -varying vec4 vertTexCoord; +varying vec4 varColor; +varying vec4 varTexCoord; void main() { - gl_FragColor = texture2D(texture, vertTexCoord.st) * vertColor; + gl_FragColor = texture2D(texture, varTexCoord.st) * varColor; } \ No newline at end of file diff --git a/core/src/processing/opengl/TextureVert.glsl b/core/src/processing/opengl/TextureVert.glsl index 5260321fb..e52789316 100644 --- a/core/src/processing/opengl/TextureVert.glsl +++ b/core/src/processing/opengl/TextureVert.glsl @@ -20,19 +20,19 @@ #define PROCESSING_TEXTURE_SHADER -uniform mat4 transform; +uniform mat4 transformMatrix; uniform mat4 texMatrix; -attribute vec4 vertex; +attribute vec4 position; attribute vec4 color; attribute vec2 texCoord; -varying vec4 vertColor; -varying vec4 vertTexCoord; +varying vec4 varColor; +varying vec4 varTexCoord; void main() { - gl_Position = transform * vertex; + gl_Position = transformMatrix * position; - vertColor = color; - vertTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0); + varColor = color; + varTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0); } \ No newline at end of file