JSR-231 1.1.1a Released

here is a screenshot of the artifact i was talking about:


http://img252.imageshack.us/img252/5820/trrc5zy4.jpg

Can you please provide a small self-contained test case?

ok, here is a testcase, that produces the artifacts with RC5:

it seems though, as this only happens with a certain font
new java.awt.Font(“Verdana”, java.awt.Font.PLAIN, 10);

import java.awt.Frame;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.glu.GLU;

import com.sun.opengl.util.Animator;
import com.sun.opengl.util.j2d.TextRenderer;


public class TextTest extends Frame implements GLEventListener {

	private static final long serialVersionUID = 1L;
	
	int width, height;

	public static void main(String[] args) {
		new TextTest();		
	}
	
	GLCanvas canvas;
	TextRenderer tr ;
	String whitespacestring = "emzic";//"h e l l o w o r l d . t h i s i s a s t r i n g w i t h l o t s o f s p a c e s";
	Animator animator;
	
	public TextTest() {
		super("TextTest");
		this.setSize(800, 200);
		canvas = new GLCanvas();
		canvas.addGLEventListener(this);
		add(canvas);
		
		
		animator = new Animator(canvas);
		animator.setRunAsFastAsPossible(false);
		animator.setPrintExceptions(true);
		animator.start();
		
		
		setVisible(true);
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
	}

	public void display(GLAutoDrawable drawable) {
		GL gl = drawable.getGL();
		gl.glClearColor(1,1,1,1);
		gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT);
		
	    
		gl.glMatrixMode(GL.GL_PROJECTION);
		gl.glLoadIdentity();		
		new GLU().gluPerspective(45f, (float)width/(float)height, 0.1f, 1000f);		
		gl.glMatrixMode(GL.GL_MODELVIEW);
		gl.glLoadIdentity();
		
		gl.glTranslatef(-10,-3,-10);
		
		gl.glRotatef(1,0,0,1);
		
		gl.glScalef(0.1f,0.1f,0.1f);
		
		tr.begin3DRendering();
		tr.draw("some text", 0, 0);
		tr.draw("bla blo blu", 0, 14);
		tr.draw(whitespacestring, 0, 28);
		tr.end3DRendering();
		
	}

	public void init(GLAutoDrawable arg0) {
		tr = new TextRenderer(new java.awt.Font("Verdana", java.awt.Font.PLAIN, 10), true, false, null, false);
		tr.setColor(0,0,0,1);
	}

	public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) {
		width = arg3;
		height = arg4;
		GL gl = arg0.getGL();
		gl.glViewport(0, 0, width, height);
		gl.glMatrixMode(GL.GL_PROJECTION);
		gl.glLoadIdentity();
		gl.glOrtho(0.0, 800, 0.0, 200, -100.0, 100.0);
		gl.glMatrixMode(GL.GL_MODELVIEW);
		gl.glLoadIdentity();
	}
	public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) {}


	
}

Thanks. Filed and fixed Issue 324. Fix will be present in tomorrow’s 1.1.1-rc6 build.

yes, it is fixed in RC6. thank you very much!

edit: could the DefaultRenderDelegate class in the TextRender class be made static and public so that we can also use it with mipmapping?
thanks!

edit2: i just tried out mipmapping and after a while the text instantly changed to a very blurry and unreadable version. i couldnt reproduce it yet, but if i can i will post a testcase.
here is a screenshot:

http://img521.imageshack.us/img521/9343/trmipmapha2.png

Done. It was not possible to promote 1.1.1-rc6 today, so tomorrow’s build will be 1.1.1-rc6 and will contain this change too.

No ideas, but please post or file a bug if you can come up with a test case.

I just tried moving from jogl 1.1.0 to 1.1.1 under linux. Unfortunately my system (SuSE 10.0 64bit) at work is using glib-2.3.5. Hence does not work. Are there builds agaist other glib versions?

Sorry, not for 64-bit. You can use the 32-bit binaries, which are built against glibc-2.3, with a 32-bit JVM on your system.

i still couldnt reproduce the above artefacts, but it has happened a couple more times since then. all i can say is that it always happened after i have rendered A LOT of text.

JSR-231 1.1.1 release candidate 6 has been released. This release fixes VBO-related issues related to the new TextRenderer, and adds a non-VBO code path for older machines. It also includes an excellent patch from krisher on java.net for longstanding multi-screen issues on X11 platforms. The JNLP extension has been updated:

http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp

and a stable JNLP extension file for this release has been posted:

http://download.java.net/media/jogl/builds/archive/jsr-231-1.1.1-rc6/webstart/jogl.jnlp

Please try the new release and post if you see any problems.

Please file a bug if you can come up with a consistently reproducible test case.

II got this error message with latest release:

[quote]Exception in thread “main” java.lang.IllegalArgumentException: GLDrawableFactory.chooseGraphicsConfiguration() was not used when creating this Component
at com.sun.opengl.impl.x11.X11GLDrawableFactory.getGLDrawable(X11GLDrawableFactory.java:233)
at javax.media.opengl.GLCanvas.(GLCanvas.java:117)
at javax.media.opengl.GLCanvas.(GLCanvas.java:82)
at javax.media.opengl.GLCanvas.(GLCanvas.java:75)
at Line.(Line.java:24)
at Line.main(Line.java:107)
[/quote]
Here is my little code (somewhere copied from this forum):

import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import javax.swing.*;

/**
 * @author quix0r
 *
 */
public class Line extends JFrame implements GLEventListener {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1445174150957788549L;
	/**
	 * 
	 */
	public Line()
	{
		// the name of the window
		super("My First JOGL Application"); //$NON-NLS-1$

		// create the canvas we will be drawing on
		final GLCanvas canvas = new GLCanvas();

		// as this class implements the GLEventListener interface
		// it is what tells the canvas what to do.
		canvas.addGLEventListener( this ); // VERY IMPORTANT LINE

		// set the size of the canvas
		canvas.setSize(500, 300);

		// add the canvas to the window
		this.getContentPane().add(canvas);
	}
	/**
	 *  This is the initialisation method. It is used to set up several of the
	 *  state variables that are constant for the programs duration
	 */
	public void init(final GLAutoDrawable drawable)
	{
		// the GL object is used to set the state variables
		final GL gl = drawable.getGL();

		// the GLU object can do alot of complex things
		// but there it is used to simply set up the coordinates
		// for the drawing area.
		final GLU glu = new GLU();

		// this sets the background colour to black
		// the first three numbers are the specification
		// of black in RGB, and the last is an alpha component.
		gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

		// sets the size of the viewable drawing area on the screen
		gl.glViewport(-500, -300, 500, 300);

		// dont worry too much about these
		gl.glMatrixMode(GL.GL_PROJECTION);
		gl.glLoadIdentity();

		// set the coordinate system. Its is set so that (0,0) is the centre of the canvas.
		// (-500, -300) is the bottom left corner.
		glu.gluOrtho2D(-500, 500.0, -300, 300.0);
	}
	/**
	 * This method draws the red line that was mentioned in the tutorial
	 * @param drawable 
	 */
	public void display(final GLAutoDrawable drawable)
	{
		// again we need the object representing the state of oplenGL
		final GL gl = drawable.getGL();

		// we earlier set the background colour, now we paint that
		// colour onto our canvas.
		gl.glClear(GL.GL_COLOR_BUFFER_BIT);

		// these are used to represent the RGB values for a colour
		// it isnt really necessary to use them in a program as simple as
		// this, but it is good practice.
		final float red = 1.0f;
		final float green = 0.0f;
		final float blue = 0.0f;

		// set the drawing colour to red.
		gl.glColor3f(red, green, blue);

		// set the width a line
		gl.glLineWidth(5.0f);

		// tell open gl to draw a line
		gl.glBegin(GL.GL_LINES);
			// from (-200, -200) to (200, 200)
			gl.glVertex2i(-200, -200);
			gl.glVertex2i(200, 200);
		gl.glEnd();
	}
	
	/*************************************************************
	 * This has nothing to do with jogl, it is simply setting up the 
	 * window that the canvas will be inside.
	 * @param argv 
	 */
	public static void main(final String[] argv)
	{
		final Line m = new Line();
		SwingUtilities.invokeLater 
		(
			new Runnable() 
			{
				public void run() 
				{
					m.pack();
					m.setVisible(true);
				}
			}
		);
	}
	/* (non-Javadoc)
	 * @see javax.media.opengl.GLEventListener#displayChanged(javax.media.opengl.GLAutoDrawable, boolean, boolean)
	 */
	public void displayChanged(final GLAutoDrawable arg0, final boolean arg1, final boolean arg2) {
		// TODO Auto-generated method stub
		
	}
	/* (non-Javadoc)
	 * @see javax.media.opengl.GLEventListener#reshape(javax.media.opengl.GLAutoDrawable, int, int, int, int)
	 */
	public void reshape(final GLAutoDrawable arg0, final int arg1, final int arg2, final int arg3, final int arg4) {
		// TODO Auto-generated method stub
		
	}
}

Any idea?

Roland

Reason is found: I used the GNU Java Compiler and not Sun’s. >:(

In Eclipse you have to do something more:

  1. Create a new project (or use an existing
  2. Add two new paths: lib and native
  3. Download latest JOGL and extract it
  4. Copy the *.jar files to lib, *.so|dll to native
  5. Back in Eclipse hit the F5 key and expand the lib folder
  6. Add both JARs to the build path (right-click them)

And now comes the important two steps:

  1. Right-click your OpenGL project, choose Libraries and expand the JRE System Library part
  2. Click on Native library location, click Edit and chhose the native folder where you have copied the so/dlls to

Rebuild the project and you might be lucky… :wink: ;D

ok , i finally got a testcase for the bug i mentioned above. it took me basicall all of my weekend, cause it is really a weird bug. it seems to be connected to a certain character, namely the dash (ASCII 150). but not the character alone causes the problem, only when it is surrounded by other text and then all successive calls to the textrenderer produce scrambled text.

here is the testcase:

import java.awt.Frame;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.glu.GLU;

import com.sun.opengl.util.Animator;
import com.sun.opengl.util.j2d.TextRenderer;


public class TextTest extends Frame implements GLEventListener {

	private static final long serialVersionUID = 1L;
	
	int width, height;

	public static void main(String[] args) {
		new TextTest();		
	}
	
	GLCanvas canvas;
	TextRenderer tr ;
	Animator animator;
	
	public TextTest() {
		super("TextTest");
		this.setSize(800, 800);
		canvas = new GLCanvas();
		canvas.addGLEventListener(this);
		add(canvas);
		
		animator = new Animator(canvas);
		animator.setRunAsFastAsPossible(false);
		animator.setPrintExceptions(true);
		animator.start();
		
		setVisible(true);
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
	}

	public void display(GLAutoDrawable drawable) {
		GL gl = drawable.getGL();
		gl.glClearColor(1,1,1,1);
		gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT);
		
	    
		gl.glMatrixMode(GL.GL_PROJECTION);
		gl.glLoadIdentity();		
		//new GLU().gluPerspective(45f, (float)width/(float)height, 0.1f, 1000f);
		gl.glOrtho(0.0, 800, 0.0, 800, -100.0, 100.0);
		gl.glMatrixMode(GL.GL_MODELVIEW);
		gl.glLoadIdentity();
		
		tr.beginRendering(800,800);
		tr.draw( "die Marktwirtschaft. Da regelt sich – angeblich", 16, 32);
		tr.draw( "Hello World! This text is scrambled", 16, 16);
		tr.endRendering();
		
	}

	public void init(GLAutoDrawable arg0) {
		tr = new TextRenderer(new java.awt.Font("Verdana", java.awt.Font.PLAIN, 12), true, false, null, false);
		tr.setColor(0,0,0,1);
	}

	public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) {
		width = arg3;
		height = arg4;
		GL gl = arg0.getGL();
		gl.glViewport(0, 0, width, height);
		gl.glMatrixMode(GL.GL_PROJECTION);
		gl.glLoadIdentity();
		gl.glOrtho(0.0, 800, 0.0, 200, -100.0, 100.0);
		gl.glMatrixMode(GL.GL_MODELVIEW);
		gl.glLoadIdentity();
	}
	public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) {}


	
}

Thanks, filed as Issue 326. Note that your dash character is not an ASCII dash but some extended Unicode character, which is probably what is causing the problem (fallback to the full Unicode code path).

thanks Ken. So does the current Textrenderer officially support full Unicode? I would highly encourage this, since the game i am working on, is mainly a chat which relies on a lot of strange characters from different languages. :slight_smile:

Yes, it always has. If there are any (other) issues rendering the full Unicode character set they’re bugs and you should file them.

just to let you guys know, there is currently a problem with the nightlies since last weekend. rendering text results in this exception:


Caused by: java.lang.ArrayIndexOutOfBoundsException: 100
	at com.sun.opengl.util.j2d.TextRenderer$GlyphsUploadList.prepGlyphForUpload(TextRenderer.java:1414)
	at com.sun.opengl.util.j2d.TextRenderer$GlyphProducer.getGlyphs(TextRenderer.java:1626)
	at com.sun.opengl.util.j2d.TextRenderer.internal_draw3D(TextRenderer.java:824)
	at com.sun.opengl.util.j2d.TextRenderer.draw3D(TextRenderer.java:512)
	at com.sun.opengl.util.j2d.TextRenderer.draw(TextRenderer.java:487)
	at TextTest.display(TextTest.java:71)
	at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)
	at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:435)
	at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194)
	at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:452)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

the ascii-dash seems to be fixed however. thanks!

Thanks for the heads up. I fixed this and some other issues under Issue 326. The fixes will be in tomorrow’s nightly build.

That’s thanks to John Burkey.

thanks for the update.
unfortunately now it’s throwing a nullpointer:

	at com.sun.opengl.util.j2d.TextRenderer.normalize(TextRenderer.java:593)
	at com.sun.opengl.util.j2d.TextRenderer.access$2100(TextRenderer.java:125)
	at com.sun.opengl.util.j2d.TextRenderer$GlyphsUploadList.uploadAnyNewGlyphs(TextRenderer.java:1429)
	at com.sun.opengl.util.j2d.TextRenderer$GlyphProducer.getGlyphs(TextRenderer.java:1668)
	at com.sun.opengl.util.j2d.TextRenderer.internal_draw3D(TextRenderer.java:824)
	at com.sun.opengl.util.j2d.TextRenderer.draw3D(TextRenderer.java:512)
	at com.sun.opengl.util.j2d.TextRenderer.draw(TextRenderer.java:487)