From abc833631e0ab30a06c7aff47a39a551544fd735 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Wed, 2 Apr 2014 19:25:16 +0200
Subject: Bug 801: Reduce temp. object creation, i.e. GC load

---
 .../classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java')

diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
index 1f402f48b..e9fb91086 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
@@ -69,6 +69,8 @@ public class GLSLArrayHandler extends GLVBOArrayHandler {
     }
   }
 
+  private final int[] tempI = new int[1];
+
   private final void enableShaderState(GL2ES2 glsl, boolean enable, ShaderState st) {
     if(enable) {
         /*
@@ -99,9 +101,8 @@ public class GLSLArrayHandler extends GLVBOArrayHandler {
             } else if(st.getAttribLocation(glsl, ad) >= 0) {
                 // didn't experience a performance hit on this query ..
                 // (using ShaderState's location query above to validate the location)
-                final int[] qi = new int[1];
-                glsl.glGetVertexAttribiv(ad.getLocation(), GL2ES2.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, qi, 0);
-                if(ad.getVBOName() != qi[0]) {
+                glsl.glGetVertexAttribiv(ad.getLocation(), GL2ES2.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, tempI, 0);
+                if(ad.getVBOName() != tempI[0]) {
                     glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName());
                     st.vertexAttribPointer(glsl, ad);
                     glsl.glBindBuffer(ad.getVBOTarget(), 0);
@@ -151,9 +152,8 @@ public class GLSLArrayHandler extends GLVBOArrayHandler {
             } else {
                 // didn't experience a performance hit on this query ..
                 // (using ShaderState's location query above to validate the location)
-                final int[] qi = new int[1];
-                glsl.glGetVertexAttribiv(location, GL2ES2.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, qi, 0);
-                if(ad.getVBOName() != qi[0]) {
+                glsl.glGetVertexAttribiv(location, GL2ES2.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, tempI, 0);
+                if(ad.getVBOName() != tempI[0]) {
                     glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName());
                     glsl.glVertexAttribPointer(ad);
                     glsl.glBindBuffer(ad.getVBOTarget(), 0);
-- 
cgit v1.2.3