aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/util
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-10-10 21:47:18 +0000
committerKenneth Russel <[email protected]>2007-10-10 21:47:18 +0000
commitc30181422e8f0b28c33fd268ae26bcbf82611998 (patch)
tree6dd18d4ba18380e7ebe197a1d481b0e23eb4f681 /src/classes/com/sun/opengl/util
parent03dc7e96544b5f04ca704590bf29a0ef66e1d853 (diff)
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
Diffstat (limited to 'src/classes/com/sun/opengl/util')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/j2d/TextRenderer.java19
1 files changed, 19 insertions, 0 deletions
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. <P>
+ <b>Note</b> 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. <P>
+
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);