diff options
author | Sven Gothel <[email protected]> | 2019-08-20 18:51:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-08-20 18:51:29 +0200 |
commit | 1f0d7d4b416521ef56fdc81b28d128c7f3279188 (patch) | |
tree | 0208e18b953f13495bf47f71a4231e86ec514b12 | |
parent | a17e86a07e53e47c778c6e36341c6c0e6874991e (diff) |
Bug 1101: Add missing disposal of Pipelined_QuadRenderer's VBOs
Original author is 'Tof'
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java index 38bac06cc..0fc36a249 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java @@ -42,7 +42,6 @@ package com.jogamp.opengl.util.awt; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.InterruptSource; import com.jogamp.common.util.PropertyAccess; -import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.packrect.*; import com.jogamp.opengl.util.texture.*; @@ -566,6 +565,9 @@ public class TextRenderer { @throws GLException If an OpenGL context is not current when this method is called */ public void dispose() throws GLException { + if( null != mPipelinedQuadRenderer ) { + mPipelinedQuadRenderer.dispose(); + } packer.dispose(); packer = null; cachedBackingStore = null; @@ -1862,7 +1864,7 @@ public class TextRenderer { gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, mTexCoords); } - gl.glDrawArrays(GL2GL3.GL_QUADS, 0, + gl.glDrawArrays(GL2ES3.GL_QUADS, 0, mOutstandingGlyphsVerticesPipeline); mVertCoords.rewind(); @@ -1877,7 +1879,7 @@ public class TextRenderer { renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious? final GL2 gl = GLContext.getCurrentGL().getGL2(); - gl.glBegin(GL2GL3.GL_QUADS); + gl.glBegin(GL2ES3.GL_QUADS); try { final int numberOfQuads = mOutstandingGlyphsVerticesPipeline / 4; @@ -1911,6 +1913,14 @@ public class TextRenderer { } } } + + public void dispose() { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + final int[] vbos = new int[2]; + vbos[0] = mVBO_For_ResuableTileVertices; + vbos[1] = mVBO_For_ResuableTileTexCoords; + gl.glDeleteBuffers(2, IntBuffer.wrap(vbos)); + } } class DebugListener implements GLEventListener { @@ -1950,6 +1960,8 @@ public class TextRenderer { @Override public void dispose(final GLAutoDrawable drawable) { + mPipelinedQuadRenderer.dispose(); + // n/a glu.destroy(); ?? glu=null; frame=null; } |