Text corruption with TextRenderer

Hi,

I’m seeing corrupted text when using the TextRenderer to draw 3D text. This occurs when I have 2 GLCanvas in a JTabbedPane. More specifically,

  1. One GLCanvas in a JPanel – text is fine
  2. Add a second GLCanvas and put both into a JTabbedPane – text on added GLCanvas is fine
  3. Switch (tab-click) to the first GLCanvas – text is fine
  4. Switch back to the second GLCanvas – text is corrupted in that GLCanvas.

Running with -Djogl.debug.TextRenderer produces:

javax.media.opengl.GLException: glGetError() returned the following error codes after a call to glBufferSubData(): GL_INVALID_VALUE
at javax.media.opengl.DebugGL.checkGLGetError(DebugGL.java:12715)
at javax.media.opengl.DebugGL.glBufferSubData(DebugGL.java:429)
at com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.drawVertexArrays(TextRenderer.java:1766)
at com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.draw(TextRenderer.java:1745)
at com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.access$000(TextRenderer.java:1687)
at com.sun.opengl.util.j2d.TextRenderer.flushGlyphPipeline(TextRenderer.java:809)
at com.sun.opengl.util.j2d.TextRenderer.endRendering(TextRenderer.java:705)
at com.sun.opengl.util.j2d.TextRenderer.end3DRendering(TextRenderer.java:551)
at anl.mifs.viz3d.VLabel.doDraw(VLabel.java:57)

I’ve tried textRenderer.setUseVertexArrays(false) and I don’t get the exception but I do get corrupted text although rotation or zoom on that scene restores the text.

Moving the GLCanvas into and out of tabs does call GLEventListener.init and reshape, and I recreate the TextRenderer when that happens using:

public void glInit() {
if (textRenderer != null) textRenderer.dispose();
textRenderer = new TextRenderer(new Font(“Helvetica”, Font.BOLD, 14), true);
textRenderer.setUseVertexArrays(useVertArrays);
}

The TextRenderer is shared among GLCanvas. Perhaps I should create per-canvas instances?

This is on OSX 1.5.7 with an NVIDIA GeForce 7300GT and the latest release version of jogl.

thanks,

Nick

yes this might solve the problem. If you don’t like to create two instances of Textrenderer you could try to share the gl context between both canvases- this might work too.