From 6a8faca0eed0400acb3a6e5566f03c0325438a1a Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 31 Jul 2015 22:46:06 -0700 Subject: [PATCH] Install the GLCore way of doing input without all the legacy stuff --- .../gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv | 4 ++-- libraries/gpu/src/gpu/GLBackendInput.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv b/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv index e91b8a7644..e6fcdac7d6 100755 --- a/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv +++ b/libraries/gpu/src/gpu/DrawViewportQuadTransformTexcoord.slv @@ -16,7 +16,7 @@ <$declareStandardTransform()$> -varying vec2 varTexcoord; +out vec2 _texcoord; 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; + _texcoord = 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);