From 76698d1923ccd9c7f22fe8500c6c4531c2d0c3ae Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 13 Aug 2023 02:47:14 +0200 Subject: Texture ctor w/ external textureID: Pass `ownsTextureID` where true hands over ownership and allows destroy() to delete it, otherwise not. Fixes GraphUI's GLButton. GraphUI's GLButton uses the offscreen's FBO texture and hence can't pass over ownership of the texture. Hence the Texture instance is created w/o handing over ownership! GLMediaPlayerImpl does hand over ownership of the generated and passed texture to the Texture ctor. --- .../classes/com/jogamp/graph/ui/shapes/GLButton.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/graphui/classes/com/jogamp') diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java index 57af3587c..a8d7c4295 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/GLButton.java @@ -138,9 +138,11 @@ public class GLButton extends TexSeqButton { fboGLAD.display(); // 1st init! final FBObject.TextureAttachment texA01 = fboGLAD.getColorbuffer(GL.GL_FRONT).getTextureAttachment(); - final Texture tex = new Texture(texA01.getName(), imgSeq.getTextureTarget(), - fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), - false /* mustFlipVertically */); + final Texture tex = new Texture(texA01.getName(), false /* ownsTextureID */, + imgSeq.getTextureTarget(), + fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), + fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), + false /* mustFlipVertically */); imgSeq.addFrame(gl, tex); markStateDirty(); } else if( 0 != fboWidth*fboHeight ) { @@ -157,9 +159,11 @@ public class GLButton extends TexSeqButton { imgSeq.destroy(gl); final FBObject.TextureAttachment texA01 = fboGLAD.getColorbuffer(GL.GL_FRONT).getTextureAttachment(); - final Texture tex = new Texture(texA01.getName(), imgSeq.getTextureTarget(), - fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), - false /* mustFlipVertically */); + final Texture tex = new Texture(texA01.getName(), false /* ownsTextureID */, + imgSeq.getTextureTarget(), + fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), + fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), + false /* mustFlipVertically */); imgSeq.addFrame(gl, tex); fboWidth = 0; fboHeight = 0; -- cgit v1.2.3