diff --git a/libraries/gpu/src/gpu/DrawColoredTexture.slf b/libraries/gpu/src/gpu/DrawColoredTexture.slf index 5460cf56eb..2a7f6aae36 100755 --- a/libraries/gpu/src/gpu/DrawColoredTexture.slf +++ b/libraries/gpu/src/gpu/DrawColoredTexture.slf @@ -11,13 +11,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - + uniform sampler2D colorMap; uniform vec4 color; -in vec2 varTexcoord; +in vec2 varTexCoord0; out vec4 outFragColor; void main(void) { - outFragColor = texture(colorMap, varTexcoord) * color; + outFragColor = texture(colorMap, varTexCoord0) * color; } diff --git a/libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv b/libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv index e0ca81cb61..c9cc9e9dfa 100755 --- a/libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv +++ b/libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv @@ -13,27 +13,27 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include gpu/Transform.slh@> - +<@include gpu/Transform.slh@> + <$declareStandardTransform()$> uniform vec4 texcoordRect; -out vec2 varTexcoord; +out vec2 varTexCoord0; void main(void) { - const vec4 UNIT_QUAD[4] = vec4[4]( - vec4(-1.0, -1.0, 0.0, 1.0), - vec4(1.0, -1.0, 0.0, 1.0), - vec4(-1.0, 1.0, 0.0, 1.0), + const vec4 UNIT_QUAD[4] = vec4[4]( + vec4(-1.0, -1.0, 0.0, 1.0), + vec4(1.0, -1.0, 0.0, 1.0), + vec4(-1.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0) ); vec4 pos = UNIT_QUAD[gl_VertexID]; - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, pos, gl_Position)$> - - varTexcoord = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy; + + // standard transform + TransformCamera cam = getTransformCamera(); + TransformObject obj = getTransformObject(); + <$transformModelToClipPos(cam, obj, pos, gl_Position)$> + + varTexCoord0 = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy; } diff --git a/libraries/gpu/src/gpu/DrawTexture.slf b/libraries/gpu/src/gpu/DrawTexture.slf index cfa18abc27..64389f02b3 100755 --- a/libraries/gpu/src/gpu/DrawTexture.slf +++ b/libraries/gpu/src/gpu/DrawTexture.slf @@ -11,12 +11,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - + uniform sampler2D colorMap; -in vec2 varTexcoord; +in vec2 varTexCoord0; out vec4 outFragColor; void main(void) { - outFragColor = texture(colorMap, varTexcoord); + outFragColor = texture(colorMap, varTexCoord0); } diff --git a/libraries/gpu/src/gpu/DrawTextureOpaque.slf b/libraries/gpu/src/gpu/DrawTextureOpaque.slf index b6539e7de2..14d2072ff3 100755 --- a/libraries/gpu/src/gpu/DrawTextureOpaque.slf +++ b/libraries/gpu/src/gpu/DrawTextureOpaque.slf @@ -12,12 +12,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - + uniform sampler2D colorMap; -in vec2 varTexcoord; +in vec2 varTexCoord0; out vec4 outFragColor; void main(void) { - outFragColor = vec4(texture(colorMap, varTexcoord).xyz, 1.0); + outFragColor = vec4(texture(colorMap, varTexCoord0).xyz, 1.0); } diff --git a/libraries/gpu/src/gpu/DrawTransformUnitQuad.slv b/libraries/gpu/src/gpu/DrawTransformUnitQuad.slv index 24e0cc25f3..f55abf1089 100755 --- a/libraries/gpu/src/gpu/DrawTransformUnitQuad.slv +++ b/libraries/gpu/src/gpu/DrawTransformUnitQuad.slv @@ -12,25 +12,25 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include gpu/Transform.slh@> - +<@include gpu/Transform.slh@> + <$declareStandardTransform()$> -out vec2 varTexcoord; +out vec2 varTexCoord0; void main(void) { - const vec4 UNIT_QUAD[4] = vec4[4]( - vec4(-1.0, -1.0, 0.0, 1.0), - vec4(1.0, -1.0, 0.0, 1.0), - vec4(-1.0, 1.0, 0.0, 1.0), + const vec4 UNIT_QUAD[4] = vec4[4]( + vec4(-1.0, -1.0, 0.0, 1.0), + vec4(1.0, -1.0, 0.0, 1.0), + vec4(-1.0, 1.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0) ); vec4 pos = UNIT_QUAD[gl_VertexID]; - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - <$transformModelToClipPos(cam, obj, pos, gl_Position)$> - - varTexcoord = (pos.xy + 1) * 0.5; + + // standard transform + TransformCamera cam = getTransformCamera(); + TransformObject obj = getTransformObject(); + <$transformModelToClipPos(cam, obj, pos, gl_Position)$> + + varTexCoord0 = (pos.xy + 1) * 0.5; } diff --git a/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv b/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv index 81af3ffaf8..1f9bc13700 100755 --- a/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv +++ b/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv @@ -16,7 +16,7 @@ <$declareStandardTransform()$> -out vec2 varTexcoord; +out vec2 varTexCoord0; void main(void) { const vec4 UNIT_QUAD[4] = vec4[4]( @@ -34,5 +34,5 @@ void main(void) { <$transformModelToWorldPos(obj, tc, tc)$> gl_Position = pos; - varTexcoord = tc.xy; + varTexCoord0 = tc.xy; } diff --git a/libraries/gpu/src/gpu/GLBackendInput.cpp b/libraries/gpu/src/gpu/GLBackendInput.cpp index 9014024914..9a99a912a4 100755 --- a/libraries/gpu/src/gpu/GLBackendInput.cpp +++ b/libraries/gpu/src/gpu/GLBackendInput.cpp @@ -57,7 +57,10 @@ void GLBackend::do_setInputBuffer(Batch& batch, uint32 paramOffset) { } } -#define NOT_SUPPORT_VAO +#if (GPU_FEATURE_PROFILE == GPU_CORE) +#define SUPPORT_VAO +#endif + #if defined(SUPPORT_VAO) #else @@ -95,8 +98,10 @@ void GLBackend::killInput() { void GLBackend::syncInputStateCache() { #if defined(SUPPORT_VAO) - for (int i = 0; i < NUM_CLASSIC_ATTRIBS; i++) { - _input._attributeActivation[i] = glIsEnabled(attributeSlotToClassicAttribName[i]); + for (int i = 0; i < _input._attributeActivation.size(); i++) { + GLint active = 0; + glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &active); + _input._attributeActivation[i] = active; } //_input._defaultVAO glBindVertexArray(_input._defaultVAO); diff --git a/libraries/render-utils/src/simple_textured_emisive.slf b/libraries/render-utils/src/simple_textured_emisive.slf index dd0df6ba8b..96119e98f0 100644 --- a/libraries/render-utils/src/simple_textured_emisive.slf +++ b/libraries/render-utils/src/simple_textured_emisive.slf @@ -19,8 +19,8 @@ uniform sampler2D originalTexture; // the interpolated normal in vec3 _normal; -in vec4 _texCoord0; -in vec4 _color; +in vec3 _color; +in vec2 _texCoord0; void main(void) { vec4 texel = texture(originalTexture, _texCoord0.st); diff --git a/libraries/render-utils/src/standardDrawTexture.slf b/libraries/render-utils/src/standardDrawTexture.slf index f3492c2959..b79b560556 100644 --- a/libraries/render-utils/src/standardDrawTexture.slf +++ b/libraries/render-utils/src/standardDrawTexture.slf @@ -14,18 +14,18 @@ // the texture uniform sampler2D colorMap; -in vec3 _position; -in vec3 _normal; -in vec2 _texCoord0; -in vec4 _color; +in vec3 varPosition; +in vec3 varNormal; +in vec2 varTexCoord0; +in vec4 varColor; -out vec4 _fragColor; +out vec4 outFragColor; void main(void) { - vec4 color = texture(colorMap, _texCoord0); + vec4 color = texture(colorMap, varTexCoord0); // FIXME CORE this isn't working //_fragColor = color * _color; //_fragColor = vec4(color.rgb, color.a * _color.a); //_fragColor = vec4(color.rgb * _color.rgb, color.a); - _fragColor = color; + outFragColor = color; } diff --git a/libraries/render-utils/src/standardTransformPNTC.slv b/libraries/render-utils/src/standardTransformPNTC.slv index d3429a1603..340dfd9c8e 100644 --- a/libraries/render-utils/src/standardTransformPNTC.slv +++ b/libraries/render-utils/src/standardTransformPNTC.slv @@ -18,19 +18,19 @@ <$declareStandardTransform()$> -out vec3 _position; -out vec3 _normal; -out vec2 _texCoord0; -out vec4 _color; +out vec3 varPosition; +out vec3 varNormal; +out vec2 varTexCoord0; +out vec4 varColor; void main(void) { - _texCoord0 = inTexCoord0.st; - _color = inColor; + varTexCoord0 = inTexCoord0.st; + varColor = inColor; // standard transform TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToClipPos(cam, obj, inPosition, gl_Position)$> - <$transformModelToEyeDir(cam, obj, inNormal.xyz, _normal)$> - _position = inPosition.xyz; + <$transformModelToEyeDir(cam, obj, inNormal.xyz, varNormal)$> + varPosition = inPosition.xyz; } \ No newline at end of file