JOGL TextRenderer and JVM Crash

Hello,

I’m using a project which draws text on the OpenGL by means of the TextRenderer class. Now, with an older PC (ATI Radeon 9800) everything worked perfect, with a new PC (ATI Radeon HD4870) the JVM crashes as soon as OpenGL gets drawn. The drivers I’ve tried are 8.12, 9.1 and 9.2 of ATI. I’ve also tried the DNA 8.12 drivers with OpenGL of an earlier version the ATI drivers.

The system itself runs on a 64-bit JVM on Windows XP x64 using JOGL 1.1.1 x64. I’ve also tried on a 32-bit JVM with JOGL 1.1.1 x86.

All without luck, it seems impossible for me to get rid of the JVM crash.

I’ve looked around and found a topic about ATI Drivers and the glTexImage2D function (http://www.geeks3d.com/?p=3246) crashes in some cases. Unfortunately, I’ve tried the workarounds described there (disabling the Catalyst AI), but again without luck.

Anyone an idea what could cause the crash? Or more specifically how to resolve it?

Thanks,
Kenny

This is the information about the crash I can find out in the logfile.


Stack: [0x000000006edb0000,0x000000006eeb0000],  sp=0x000000006eeaeb18,  free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [atio6axx.dll+0xafe640]

[error occurred during error reporting (printing native stack), id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.sun.opengl.impl.GLImpl.glTexImage2D0(IIIIIIIILjava/lang/Object;I)V+0
j  com.sun.opengl.impl.GLImpl.glTexImage2D(IIIIIIIILjava/nio/Buffer;)V+55
j  com.sun.opengl.util.texture.Texture.updateImage(Lcom/sun/opengl/util/texture/TextureData;I)V+979
j  com.sun.opengl.util.texture.Texture.updateImage(Lcom/sun/opengl/util/texture/TextureData;)V+3
j  com.sun.opengl.util.texture.Texture.<init>(Lcom/sun/opengl/util/texture/TextureData;)V+18
j  com.sun.opengl.util.texture.TextureIO.newTexture(Lcom/sun/opengl/util/texture/TextureData;)Lcom/sun/opengl/util/texture/Texture;+19
j  com.sun.opengl.util.j2d.TextureRenderer.ensureTexture()Z+43
j  com.sun.opengl.util.j2d.TextureRenderer.getTexture()Lcom/sun/opengl/util/texture/Texture;+45
j  com.sun.opengl.util.j2d.TextureRenderer.beginRendering(ZIIZ)V+176
j  com.sun.opengl.util.j2d.TextureRenderer.begin3DRendering()V+5
j  com.sun.opengl.util.j2d.TextRenderer.beginRendering(ZIIZ)V+65
j  com.sun.opengl.util.j2d.TextRenderer.begin3DRendering()V+5
j  aero.ivao.softdev.common.glframework.GLText.render(Ljava/awt/Font;Ljava/lang/String;DDD)V+74
j  aero.ivao.softdev.ivac.drawing.mapengine.TextEngine.renderWithOffset(Laero/ivao/softdev/common/glframework/GLText;Ljava/lang/String;Ljava/lang/String;DDD)V+66
j  aero.ivao.softdev.ivac.drawing.mapengine.MapEngine.renderNavObject(Laero/ivao/softdev/ivac/drawing/mapengine/data/DrawableNavObject;Laero/ivao/softdev/common/glframework/GLDrawingContext;D)V+93
j  aero.ivao.softdev.ivac.drawing.mapengine.MapEngine.render(Laero/ivao/softdev/common/glframework/GLDrawingContext;D)V+117
j  aero.ivao.softdev.common.glframework.GLDrawableEngineInstance.render()V+15
j  aero.ivao.softdev.common.glframework.GLDrawingEngine.displayNotCached(Ljavax/media/opengl/GL;Laero/ivao/softdev/common/glframework/GLDrawableEngineInstance;)V+39
j  aero.ivao.softdev.common.glframework.GLDrawingEngine.display(Ljavax/media/opengl/GLAutoDrawable;)V+61
j  com.sun.opengl.impl.GLDrawableHelper.display(Ljavax/media/opengl/GLAutoDrawable;)V+29
j  javax.media.opengl.GLJPanel$Updater.display(Ljavax/media/opengl/GLAutoDrawable;)V+224
j  javax.media.opengl.GLJPanel$DisplayAction.run()V+11
j  com.sun.opengl.impl.GLDrawableHelper.invokeGL(Ljavax/media/opengl/GLDrawable;Ljavax/media/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V+418
j  javax.media.opengl.GLJPanel$2.run()V+1476
j  sun.java2d.opengl.OGLRenderQueue$QueueFlusher.run()V+95
v  ~StubRoutines::call_stub

System information (as printed by the log):



OS: Windows Server 2003 family Build 3790 Service Pack 2

CPU:total 8 (8 cores per cpu, 2 threads per core) family 6 model 10 stepping 4, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, ht

Memory: 4k page, physical 6282032k(4886024k free), swap 7964960k(6828976k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (11.2-b01) for windows-amd64 JRE (1.6.0_12-b04), built on Jan 17 2009 01:49:05 by "java_re" with MS VC++ 8.0

time: Fri Feb 20 19:05:10 2009
elapsed time: 9 seconds

The source code that calls to JOGL:


	public void render(Font font, String text, double x, double y)
	{
		// ... create the rendering engine if needed.
		TextRenderer renderEngine = renderEngines_.get(font);
		if(renderEngine == null)
		{
			renderEngine = new TextRenderer(font, false);
			renderEngine.setUseVertexArrays(false);
			renderEngine.setSmoothing(false);
			renderEngines_.put(font, renderEngine);			
		}
		
		// ... calculate positions, we use an offset.
		float baseX = (float)x;
		float baseY = (float)y;

		// ... render
		renderEngine.begin3DRendering();
		renderEngine.draw3D(text, baseX, baseY, 0.0f, 1.0f);
		renderEngine.end3DRendering();
	}

Honestly I have no idea what could cause this. Especially since you already tried all possible advices (32Bit, different drivers…) But it surprises me that this seems to be reproducible on a not so uncommon card from ati. It should have been reported more often and since it isn’t, maybe your card is broken? You wouldn’t be able to get your hands on another 9800 to test this?

Hello,

Just tried the demo applications on the https://jogl-demos.dev.java.net/ website containing text. They all seem to work with JNLP without crashing the application.

I don’t have time to investigate further right now, but I’m going to try if I compile those locally it gives the JVM crash or not.

Kind regards,

Hello,

The problem appears to be caused if I call the TextRenderer class from inside a glNewList/glEndList statement.
Is this the intended behaviour? I.e. is it (according to OpenGL) allowed to have the glTexImage2D call inside glNewList/glEndList?

Kind regards,

I had the same kind of crash when mixing ARB static VBO (created in my game by myself) and vertex arrays (created by the TextRenderer class). I think it is not a good idea to encapsulate calls to a TextRenderer in a display list, you should avoid it and in the best case, it does not improve the performance, the TextRenderer class uses dynamic VBO if available, vertex arrays or immediate rendering in the worst case.

Hello,

Yeah I found that out now also, unfortunately its a rather major impact on my design, as I create display lists for drawings at higher level as where I make the regular OpenGL calls.

A workaround which I’ve found now, don’t know if it is a good one though is this:

  1. Make the necessary OpenGL + TextRenderer, without creating display lists
  2. Make the necessary OpenGL + TextRenderer, but now create display lists
  3. Use the display lists

This seems to resolve the problem on my system. Would it be safe to use such an approach? Or would you recommend revisiting my design to allow the text to be drawn outside of the display lists?

Thanks,

Another workaround would be to use the previous version of the class TextRenderer that does not rely on VBO/vertex arrays/display lists.