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. --- src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/jogamp/opengl/util') diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 4133a50fd..94b666b7b 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -843,6 +843,14 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { protected abstract TextureFrame createTexImage(GL gl, int texName); + /** + * Creating a {@link Texture} instance by taking ownership of the given {@code texName} texture object. + * @param gl current GL object + * @param texName generated texture object to be used and taken ownership of + * @param tWidth + * @param tHeight + * @return + */ protected final Texture createTexImageImpl(final GL gl, final int texName, final int tWidth, final int tHeight) { if( 0 > texName ) { throw new RuntimeException("TextureName "+toHexString(texName)+" invalid."); @@ -886,7 +894,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, texWrapST[0]); gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, texWrapST[1]); - return new Texture(texName, textureTarget, + return new Texture(texName, true /* ownsTextureID */, + textureTarget, tWidth, tHeight, width, height, !isInGLOrientation); } -- cgit v1.2.3