From c30181422e8f0b28c33fd268ae26bcbf82611998 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 10 Oct 2007 21:47:18 +0000 Subject: Fixed problems causing breakage of NASA's World Wind Java. Added need glPush/PopClientAttrib due to modification of vertex array enable states and vertex buffer object bindings. Fixed bug in setColor() where flushing was not occurring every time it needed to. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1393 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/com/sun/opengl/util/j2d/TextRenderer.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/classes/com/sun/opengl/util/j2d/TextRenderer.java b/src/classes/com/sun/opengl/util/j2d/TextRenderer.java index 4cb06c872..b20a6c2b1 100755 --- a/src/classes/com/sun/opengl/util/j2d/TextRenderer.java +++ b/src/classes/com/sun/opengl/util/j2d/TextRenderer.java @@ -98,6 +98,11 @@ import com.sun.opengl.util.texture.*; internally will be cleaned up automatically when the OpenGL context is destroyed.

+ Note that the TextRenderer may cause the vertex and texture + coordinate array buffer bindings to change, or to be unbound. This + is important to note if you are using Vertex Buffer Objects (VBOs) + in your application.

+ Internally, the renderer uses a rectangle packing algorithm to pack both glyphs and full Strings' rendering results (which are variable size) onto a larger OpenGL texture. The internal backing @@ -610,6 +615,7 @@ public class TextRenderer public void setColor(float r, float g, float b, float a) throws GLException { boolean noNeedForFlush = (haveCachedColor && + cachedColor == null && r == cachedR && g == cachedG && b == cachedB && @@ -809,6 +815,9 @@ public class TextRenderer } GL gl = GLU.getCurrentGL(); + // Push client attrib bits used by the pipelined quad renderer + gl.glPushClientAttrib((int) GL.GL_ALL_CLIENT_ATTRIB_BITS); + if (!haveMaxSize) { // Query OpenGL for the maximum texture size and set it in the // RectanglePacker to keep it from expanding too large @@ -841,6 +850,10 @@ public class TextRenderer flushGlyphPipeline (); inBeginEndPair = false; + + GL gl = GLU.getCurrentGL(); + // Pop client attrib bits used by the pipelined quad renderer + gl.glPopClientAttrib(); if (ortho) { getBackingStore().endOrthoRendering(); } else { @@ -998,6 +1011,9 @@ public class TextRenderer public void beginMovement(Object oldBackingStore, Object newBackingStore) { // Exit the begin / end pair if necessary if (inBeginEndPair) { + GL gl = GLU.getCurrentGL(); + // Pop client attrib bits used by the pipelined quad renderer + gl.glPopClientAttrib(); if (isOrthoMode) { ((TextureRenderer) oldBackingStore).endOrthoRendering(); } else { @@ -1047,6 +1063,9 @@ public class TextRenderer } else { ((TextureRenderer) newBackingStore).begin3DRendering(); } + // Push client attrib bits used by the pipelined quad renderer + GL gl = GLU.getCurrentGL(); + gl.glPushClientAttrib((int) GL.GL_ALL_CLIENT_ATTRIB_BITS); if (haveCachedColor) { if (cachedColor == null) { ((TextureRenderer) newBackingStore).setColor(cachedR, cachedG, cachedB, cachedA); -- cgit v1.2.3