summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2013-05-17 08:44:40 +0200
committerSven Gothel <sgothel@jausoft.com>2013-05-17 08:44:40 +0200
commit1cc44101bd4f44407929c686d3c6e00d36793495 (patch)
treee7b11d9c58a316bcff8c882f029927fda1510b9f /src/jogl/classes
parentaef87b5db07d6b3f556d72ac7492fa0fba0d2de0 (diff)
JOGL GLSL ShaderProgram/State: Release of an unlinked ShaderProgram shall not throw an exception -> avoid calling useProgram(.., false).
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
index 9cade1e90..1337a7e2b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
@@ -85,7 +85,9 @@ public class ShaderProgram {
* If <code>destroyShaderCode</code> is true it destroys the shader codes as well.
*/
public synchronized void release(GL2ES2 gl, boolean destroyShaderCode) {
- useProgram(gl, false);
+ if( programLinked ) {
+ useProgram(gl, false);
+ }
for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
ShaderCode shaderCode = iter.next();
if(attachedShaderCode.remove(shaderCode)) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
index a221cd51e..968391976 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
@@ -231,7 +231,7 @@ public class ShaderState {
* @see ShaderProgram#release(GL2ES2, boolean)
*/
public synchronized void release(GL2ES2 gl, boolean destroyBoundAttributes, boolean destroyShaderProgram, boolean destroyShaderCode) {
- if(null!=shaderProgram) {
+ if(null!=shaderProgram && shaderProgram.linked() ) {
shaderProgram.useProgram(gl, false);
}
if(destroyBoundAttributes) {