From c01a4ad712cfa2d1f8746daf161d9052c8acfccd Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 15 Mar 2023 03:26:30 +0100 Subject: Fix ShaderProgram ownership bug, introduced in commit 67a723477ecd818fbc5859fe20ee536a3b4efae5 (reverting and clarifying) All Graph ShaderPrograms used are owned by RegionRenderer, not RenderState nor [GL]Region*, hence [GL]Region* shall only nullify the resources but not destroy the shader currently in use. One RegionRenderer maybe used for multuple Regions. --- src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java') diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java index a86060fab..c8e9a0113 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java @@ -179,7 +179,6 @@ public abstract class GLRegion extends Region { */ protected abstract void updateImpl(final GL2ES2 gl); - protected abstract void clearShaderImpl(final GL2ES2 gl); protected abstract void destroyImpl(final GL2ES2 gl); protected abstract void clearImpl(final GL2ES2 gl); @@ -212,16 +211,14 @@ public abstract class GLRegion extends Region { return this; } - /** Deletes all {@link ShaderProgram}s and nullifies its references. */ - public final void clearShader(final GL2ES2 gl) { - clearShaderImpl(gl); - } - /** * Delete and clear the associated OGL objects. + *

+ * The {@link ShaderProgram}s references are nullified but not {@link ShaderProgram#destroy(GL2ES2) destroyed} + * as they are owned by {@link RegionRenderer}. + *

*/ public final void destroy(final GL2ES2 gl) { - clearShaderImpl(gl); clear(gl); destroyImpl(gl); } -- cgit v1.2.3