From 1f0d7d4b416521ef56fdc81b28d128c7f3279188 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 20 Aug 2019 18:51:29 +0200 Subject: Bug 1101: Add missing disposal of Pipelined_QuadRenderer's VBOs Original author is 'Tof' --- .../com/jogamp/opengl/util/awt/TextRenderer.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/util') 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; } -- cgit v1.2.3