From b3fe96b2916eb0359412aa8e57a9b1a9577f247d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 15 Mar 2023 03:34:01 +0100 Subject: ShaderProgram field programLinked: Set to false @ release()/destroy(), On useProgram() only throw exception if 'on==true' is requested (disabling after delettion is OK) --- src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes') 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 82486a213..fcc1cadd0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java @@ -103,6 +103,7 @@ public final class ShaderProgram { gl.glDeleteProgram(shaderProgram); shaderProgram=0; } + programLinked=false; } // @@ -308,7 +309,10 @@ public final class ShaderProgram { } public synchronized void useProgram(final GL2ES2 gl, boolean on) { - if(!programLinked) { throw new GLException("Program is not linked"); } + if(on && !programLinked) { + System.err.println("Error: ShaderProgram.useProgram(on "+on+") not linked: "+this); + throw new GLException("Program is not linked"); + } if(programInUse==on) { return; } if( 0 == shaderProgram ) { on = false; -- cgit v1.2.3