diff options
author | Kenneth Russel <[email protected]> | 2007-11-09 22:28:29 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2007-11-09 22:28:29 +0000 |
commit | 2d62cbeca1e965654627b84c03e2422f31fa7c40 (patch) | |
tree | 30df6f4f1247ee69d6f70a44799eaef33be2f44d /test/Issue326Test2.java | |
parent | f80269640ee83e4207e38a30d6c93f7a4d93cffa (diff) |
Fixed Issue 326: TextRenderer corruption with certain text
Fixed four issues:
- Regression in new segmenting and punting code causing
ArrayIndexOutOfBoundsException due to not resetting the glyph
uploader during punt.
- Issue in same code where length and total advance were not being
reset properly.
- Incorrect handling in glyph-by-glyph rendering when backing store
was using NPOT texture and GL_ARB_texture_rectangle.
- Failure to punt when glyph code was out of bounds.
Checked in two regression tests for these issues.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1434 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'test/Issue326Test2.java')
-rwxr-xr-x | test/Issue326Test2.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/Issue326Test2.java b/test/Issue326Test2.java new file mode 100755 index 000000000..f2258c858 --- /dev/null +++ b/test/Issue326Test2.java @@ -0,0 +1,66 @@ +import java.awt.Font; +import java.awt.Frame; +import java.awt.event.*; +import javax.media.opengl.*; +import com.sun.opengl.util.j2d.*; + +/** + * Another test case demonstrating corruption with older version of + * TextRenderer when glyphs were too big for backing store. Font and + * text courtesy of Patrick Murris. Adapted from Issue326Test1. + */ + +public class Issue326Test2 extends Frame implements GLEventListener { + + int width, height; + + public static void main(String[] args) { + new Issue326Test2(); + } + + GLCanvas canvas; + TextRenderer tr; + + public Issue326Test2() { + super(""); + this.setSize(800, 800); + canvas = new GLCanvas(); + canvas.addGLEventListener(this); + add(canvas); + + setVisible(true); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); + } + + public void display(GLAutoDrawable drawable) { + GL gl = drawable.getGL(); + gl.glClearColor(0, 0, 0, 0); + gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT); + + tr.beginRendering(drawable.getWidth(), drawable.getHeight()); + tr.draw("LA CLAPI\u00c8RE \nAlt: 1100-1700m \nGlissement de terrain majeur", 16, 80); + tr.draw("dans la haute Tin\u00e9e, sur un flanc du Parc du Mercantour.", 16, 16); + tr.endRendering(); + + } + + public void init(GLAutoDrawable arg0) { + tr = new TextRenderer(Font.decode("Arial-BOLD-64")); + tr.setColor(1, 1, 1 ,1); + } + + public void reshape(GLAutoDrawable arg0, int x, int y, int w, int h) { + GL gl = arg0.getGL(); + gl.glMatrixMode(GL.GL_PROJECTION); + gl.glLoadIdentity(); + gl.glOrtho(0.0, w, 0.0, h, -1, 1); + gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glLoadIdentity(); + } + public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) {} +} + |