diff options
author | Sven Gothel <[email protected]> | 2023-08-13 02:47:14 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-13 02:47:14 +0200 |
commit | 76698d1923ccd9c7f22fe8500c6c4531c2d0c3ae (patch) | |
tree | f528d9387738c938505602cf76b98e466b834ad6 /src/jogl/classes/jogamp/opengl/util | |
parent | 2aa80761ace63492c859632317a47cdcc8cfae5f (diff) |
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.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java | 11 |
1 files changed, 10 insertions, 1 deletions
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); } |