jogl
  1. jogl
  2. JOGL-356

TextRenderer causes a GLException on pre-OpenGL 1.5 version

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: jogl
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      356

      Description

      On JOGL 1.1.1 release candidate 5, the JVM crashes completely and produces a log
      file. The other release candidates (rc6, rc7 and rc8) and the stable current
      version produces the following trace:

      Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: array
      vertex_buffer_object must be disabled to call this method
      at com.sun.opengl.impl.GLImpl.checkBufferObject(GLImpl.java:30667)
      at com.sun.opengl.impl.GLImpl.checkArrayVBODisabled(GLImpl.java:30715)
      at com.sun.opengl.impl.GLImpl.glVertexPointer(GLImpl.java:27936)
      at
      com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.drawVertexArrays(TextRenderer.java:1771)
      at
      com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.draw(TextRenderer.java:1745)
      at
      com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.access$000(TextRenderer.java:1687)
      at
      com.sun.opengl.util.j2d.TextRenderer.flushGlyphPipeline(TextRenderer.java:809)
      at com.sun.opengl.util.j2d.TextRenderer.endRendering(TextRenderer.java:705)
      at com.sun.opengl.util.j2d.TextRenderer.endRendering(TextRenderer.java:541)
      at HelloWorldDemo.display(HelloWorldDemo.java:82)
      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.maybeDoSingleThreadedWorkaround(GLCanvas.java:412)
      at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
      at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277)
      at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
      at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:56)
      at sun.awt.RepaintArea.paint(RepaintArea.java:224)
      at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:683)
      at java.awt.Component.dispatchEventImpl(Component.java:4489)
      at java.awt.Component.dispatchEvent(Component.java:4243)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
      at
      java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
      at
      java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
      at
      java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      Exception in thread "Thread-1" javax.media.opengl.GLException:
      javax.media.opengl.GLException: array vertex_buffer_object must be disabled to
      call this method
      at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
      at
      javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:410)
      at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
      at com.sun.opengl.util.Animator.display(Animator.java:144)
      at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.media.opengl.GLException: array vertex_buffer_object must be
      disabled to call this method
      at com.sun.opengl.impl.GLImpl.checkBufferObject(GLImpl.java:30667)
      at com.sun.opengl.impl.GLImpl.checkArrayVBODisabled(GLImpl.java:30715)
      at com.sun.opengl.impl.GLImpl.glVertexPointer(GLImpl.java:27936)
      at
      com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.drawVertexArrays(TextRenderer.java:1771)
      at
      com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.draw(TextRenderer.java:1745)
      at
      com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.access$000(TextRenderer.java:1687)
      at
      com.sun.opengl.util.j2d.TextRenderer.flushGlyphPipeline(TextRenderer.java:809)
      at com.sun.opengl.util.j2d.TextRenderer.endRendering(TextRenderer.java:705)
      at com.sun.opengl.util.j2d.TextRenderer.endRendering(TextRenderer.java:541)
      at HelloWorldDemo.display(HelloWorldDemo.java:82)
      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(InvocationEvent.java:199)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
      at
      java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
      at
      java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
      at
      java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

      The problem is reproducible only with graphics cards that are not at least
      compatible with OpenGL 1.5. When I use both VBOs and a TextRenderer, I get the
      exception trace above with the following source code:

      import java.awt.*;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;
      import java.nio.FloatBuffer;

      import com.sun.opengl.util.Animator;
      import com.sun.opengl.util.BufferUtil;
      import com.sun.opengl.util.j2d.TextRenderer;
      import javax.media.opengl.GL;
      import javax.media.opengl.GLCanvas;
      import javax.media.opengl.GLCapabilities;
      import javax.media.opengl.GLAutoDrawable;
      import javax.media.opengl.GLEventListener;

      public class HelloWorldDemo extends Frame implements GLEventListener{

      private static final long serialVersionUID = 1L;
      private TextRenderer textRenderer;
      private int[] id=new int[1];
      private FloatBuffer buffer=BufferUtil.newFloatBuffer(0);

      public HelloWorldDemo(){
      super("JOGL 1.1.1");
      setLayout(new BorderLayout());
      setSize(400, 400);
      setLocation(40, 40);
      setVisible(true);
      GLCapabilities caps = new GLCapabilities();
      caps.setDoubleBuffered(true);
      caps.setHardwareAccelerated(true);
      GLCanvas canvas = new GLCanvas(caps);
      canvas.addGLEventListener(this);
      add(canvas, BorderLayout.CENTER);
      Animator anim = new Animator(canvas);
      anim.start();
      addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent e)

      { System.exit(0); }

      });
      buffer.put(new float[]{});
      buffer.position(0);
      }

      public void init(GLAutoDrawable drawable)

      { GL gl = drawable.getGL(); gl.glClearColor(0, 0, 0, 0); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0, 1, 0, 1, -1, 1); textRenderer=new TextRenderer(new Font("SansSerif",Font.PLAIN,12)); gl.glGenBuffers(1,id,0); gl.glBindBuffer(GL.GL_ARRAY_BUFFER,id[0]); gl.glBufferData(GL.GL_ARRAY_BUFFER,BufferUtil.SIZEOF_FLOAT*buffer.capacity(),buffer,GL.GL_STATIC_DRAW_ARB); this.buffer.position(0); }

      public void reshape(GLAutoDrawable drawable,
      int x,
      int y,
      int width,
      int height){
      }

      public void displayChanged(GLAutoDrawable drawable,
      boolean modeChanged,
      boolean deviceChanged){
      }

      public void display(GLAutoDrawable drawable)

      { GL gl = drawable.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glEnableClientState(GL.GL_VERTEX_ARRAY); gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY); gl.glBindBuffer(GL.GL_ARRAY_BUFFER,id[0]); gl.glDrawArrays(GL.GL_QUADS,0,0); gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY); gl.glDisableClientState(GL.GL_VERTEX_ARRAY); textRenderer.beginRendering(100,100); textRenderer.draw("JOGL 1.1.1",0,0); textRenderer.endRendering(); gl.glFlush(); }

      public static void main(String[] args)

      { HelloWorldDemo demo = new HelloWorldDemo(); demo.setVisible(true); }

      }

      1. HelloWorldDemo.java
        3 kB
        javalution
      2. hs_err_pid10635.txt
        18 kB
        javalution
      3. TextRenderer.java
        78 kB
        javalution
      4. TextRenderer.java
        77 kB
        javalution
      5. TextRenderer.java
        78 kB
        javalution
      6. TextRenderer.java
        79 kB
        javalution
      7. TextRenderer.java
        77 kB
        javalution
      8. TextRenderer.java
        77 kB
        javalution

        Activity

        Hide
        javalution added a comment -

        Created an attachment (id=132)
        Final cleanest fix, tested under OpenGL 1.3

        Show
        javalution added a comment - Created an attachment (id=132) Final cleanest fix, tested under OpenGL 1.3
        Hide
        javalution added a comment -

        The latest bug fix works good. The impact on the performance is not really
        noticeable if and only if you use VBOs whose element count is less than
        GL_MAX_ELEMENTS_VERTICES.

        I tried other approaches some weeks but the JVM crashed several times. This fix
        is the only reliable and performant solution I have found. Please include it in
        the nightly build as soon as possible.

        Show
        javalution added a comment - The latest bug fix works good. The impact on the performance is not really noticeable if and only if you use VBOs whose element count is less than GL_MAX_ELEMENTS_VERTICES. I tried other approaches some weeks but the JVM crashed several times. This fix is the only reliable and performant solution I have found. Please include it in the nightly build as soon as possible.
        Hide
        javalution added a comment -

        Created an attachment (id=133)
        Fix handling the crash with Intel chips and working with OpenGL 1.4 too

        Show
        javalution added a comment - Created an attachment (id=133) Fix handling the crash with Intel chips and working with OpenGL 1.4 too
        Hide
        javalution added a comment -

        Please test the latest fix with an Intel on-board graphics and under OpenGL 1.4
        as I don't have such things at home. I had forgotten some try/catch. Now, it
        should be fine.

        Show
        javalution added a comment - Please test the latest fix with an Intel on-board graphics and under OpenGL 1.4 as I don't have such things at home. I had forgotten some try/catch. Now, it should be fine.
        Hide
        javalution added a comment -

        Sorry. The fix doesn't work fine on some versions of Mesa, TUER crashes after 99
        seconds, the JVM writes a log file. I have had to use the older implementation
        to fix the bug. glBindBufferARB seems to be very unstable when used to unbind a
        buffer.

        Show
        javalution added a comment - Sorry. The fix doesn't work fine on some versions of Mesa, TUER crashes after 99 seconds, the JVM writes a log file. I have had to use the older implementation to fix the bug. glBindBufferARB seems to be very unstable when used to unbind a buffer.

          People

          • Assignee:
            jogl-issues
            Reporter:
            javalution
          • Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: