diff options
author | Sven Gothel <[email protected]> | 2011-04-26 07:53:27 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-04-26 07:53:27 +0200 |
commit | 360b86f4b5d0e440863c1749fe990e39fbabc51c (patch) | |
tree | 6be44962f9cf59740597e1dd745bd2204b150ac1 /src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java | |
parent | f47230cb4649df13260ac56c5dae6c01dad7c1e7 (diff) |
ShaderState: Add 'ownUniform()/ownAttribute()'; rename glFunction -> function; switch program enh. ; Graph lifecycle
Add 'ownUniform()/ownAttribute()' allowing to reset all bound uniforms/attributes,
not just active ones plus handling the lifecycle of the owned attributes (destroy).
This simplifies the lifecycle of all shader attributes.
Rename glFunction -> function .. well, the GL attribute marks them GL related already
Switch program enhancement. If switching to new program (unlinked), issue glBindAttributeLocation ..
Graph lifecycle cleanup using the above ..
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 1b295de16..7956e5137 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -62,15 +62,15 @@ public class VBORegionSPES2 implements Region { final int initialSize = 256; final ShaderState st = rs.getShaderState(); - indices = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialSize, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indices = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialSize, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); verticeAttr = GLArrayDataServer.createGLSL(st, AttributeNames.VERTEX_ATTR_NAME, 3, - GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW); - st.bindAttribute(verticeAttr); + GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW); + st.ownAttribute(verticeAttr, true); texCoordAttr = GLArrayDataServer.createGLSL(st, AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW); - st.bindAttribute(texCoordAttr); + st.ownAttribute(texCoordAttr, true); if(DEBUG_INSTANCE) { System.err.println("VBORegionSPES2 Create: " + this); @@ -187,15 +187,18 @@ public class VBORegionSPES2 implements Region { return dirty; } - public final void destroy(GL2ES2 gl) { + public final void destroy(GL2ES2 gl, RenderState rs) { if(DEBUG_INSTANCE) { System.err.println("VBORegionSPES2 Destroy: " + this); } + final ShaderState st = rs.getShaderState(); if(null != verticeAttr) { + st.ownAttribute(verticeAttr, false); verticeAttr.destroy(gl); verticeAttr = null; } if(null != texCoordAttr) { + st.ownAttribute(texCoordAttr, false); texCoordAttr.destroy(gl); texCoordAttr = null; } |