ATI graphic card + Linux + GLJPanel + TextRenderer don't work ?

Hello,

I’m using GLJPanel to draw the graphics of my software (Scilab) with or without Java2d OpenGL pipeline enable.
In our team most of us have nvidia cards and text rendering works perfectly. However some of us have laptops with ATI cards and they are unable to draw a single text. Exception are raised and sometime the software crashes.

We tried this piece of code on the following computer (this is the demo TextCube simplified):


  public class TestSimone implements GLEventListener {
  private GLU glu = new GLU();
  
  private TextRenderer renderer;
  
  public static void main(String[] args) {
    Frame frame = new Frame("Text Cube");
    frame.setLayout(new BorderLayout());

    GLJPanel canvas = new GLJPanel();
    final TestSimone demo = new TestSimone();

    canvas.addGLEventListener(demo);
    frame.add(canvas, BorderLayout.CENTER);

    frame.setSize(512, 512);
    final Animator animator = new Animator(canvas);
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          // Run this on another thread than the AWT event queue to
          // make sure the call to Animator.stop() completes before
          // exiting
          new Thread(new Runnable() {
              public void run() {
                animator.stop();
                System.exit(0);
              }
            }).start();
        }
      });
    frame.show();
    animator.start();
  }

  public void init(GLAutoDrawable drawable) {
    renderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 12));
  }

  public void display(GLAutoDrawable drawable) {
    GL gl = drawable.getGL();
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

    gl.glMatrixMode(GL.GL_MODELVIEW);
    gl.glLoadIdentity();
    glu.gluLookAt(0, 0, 10,
                  0, 0, 0,
                  0, 1, 0);
    gl.glColor3d(1.0,1.0,1.0);
    renderer.setColor(1.0f, 1.0f, 1.0f, 1.0f);
    renderer.begin3DRendering();
        
    renderer.draw3D("Hello JOGL !!!",
                    0.0f,0.0f, 0.0f, 0.01f);
                    
    renderer.end3DRendering();

  }

  public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
    GL gl = drawable.getGL();
    gl.glMatrixMode(GL.GL_PROJECTION);
    gl.glLoadIdentity();
    glu.gluPerspective(15, (float) width / (float) height, 5, 15);
  }

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

}



Linux distribution : Fedora 7

- kernel version ("uname -a"):
Linux tank 2.6.23.14-64.fc7 #1 SMP Sun Jan 20 23:54:08 EST 2008 i686
i686 i386 GNU/Linux

- graphics card ("/sbin/lspci")
01:00.0 VGA compatible controller: ATI Technologies Inc M56P [Radeon
Mobility X1600]

- graphics driver installed
ATI 8.45.4 (use the Catalyst Control center to recover the information)


- OpenGL support ("glxinfo")
[simone@tank ~]$ glxinfo 
name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.2
server glx extensions:
    GLX_ARB_multisample, GLX_EXT_import_context,
GLX_EXT_texture_from_pixmap, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_OML_swap_method, 
    GLX_SGIS_multisample, GLX_SGIX_fbconfig,
GLX_SGIX_visual_select_group
client glx vendor string: SGI
client glx version string: 1.4
client glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample,
GLX_EXT_import_context, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating,
GLX_MESA_allocate_memory, 
    GLX_MESA_copy_sub_buffer, GLX_MESA_swap_control, 
    GLX_MESA_swap_frame_usage, GLX_OML_swap_method,
GLX_OML_sync_control, 
    GLX_SGI_make_current_read, GLX_SGI_swap_control,
GLX_SGI_video_sync, 
    GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, 
    GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap
GLX version: 1.2
GLX extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample,
GLX_EXT_import_context, 
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_OML_swap_method, 
    GLX_SGIS_multisample, GLX_SGIX_fbconfig,
GLX_SGIX_visual_select_group
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Mobility Radeon X1600
OpenGL version string: 2.1.7276 Release
OpenGL extensions:
    GL_AMD_performance_monitor, GL_ARB_depth_texture,
GL_ARB_draw_buffers, 
    GL_ARB_fragment_program, GL_ARB_fragment_shader,
GL_ARB_multisample, 
    GL_ARB_multitexture, GL_ARB_occlusion_query,
GL_ARB_pixel_buffer_object, 
    GL_ARB_point_parameters, GL_ARB_point_sprite,
GL_ARB_shader_objects, 
    GL_ARB_shading_language_100, GL_ARB_shadow, GL_ARB_shadow_ambient, 
    GL_ARB_texture_border_clamp, GL_ARB_texture_compression, 
    GL_ARB_texture_cube_map, GL_ARB_texture_env_add, 
    GL_ARB_texture_env_combine, GL_ARB_texture_env_crossbar, 
    GL_ARB_texture_env_dot3, GL_ARB_texture_float, 
    GL_ARB_texture_mirrored_repeat, GL_ARB_texture_rectangle, 
    GL_ARB_transpose_matrix, GL_ARB_vertex_buffer_object, 
    GL_ARB_vertex_program, GL_ARB_vertex_shader, GL_ARB_window_pos, 
    GL_ATI_draw_buffers, GL_ATI_envmap_bumpmap, GL_ATI_fragment_shader, 
    GL_ATI_meminfo, GL_ATI_separate_stencil,
GL_ATI_texture_compression_3dc, 
    GL_ATI_texture_env_combine3, GL_ATI_texture_float, GL_EXT_bgra, 
    GL_EXT_blend_color, GL_EXT_blend_func_separate,
GL_EXT_blend_minmax, 
    GL_EXT_blend_subtract, GL_EXT_compiled_vertex_array,
GL_EXT_copy_texture, 
    GL_EXT_draw_range_elements, GL_EXT_fog_coord,
GL_EXT_framebuffer_object, 
    GL_EXT_gpu_program_parameters, GL_EXT_multi_draw_arrays, 
    GL_EXT_packed_depth_stencil, GL_EXT_packed_pixels, 
    GL_EXT_point_parameters, GL_EXT_rescale_normal,
GL_EXT_secondary_color, 
    GL_EXT_separate_specular_color, GL_EXT_shadow_funcs,
GL_EXT_stencil_wrap, 
    GL_EXT_subtexture, GL_EXT_texgen_reflection, GL_EXT_texture3D, 
    GL_EXT_texture_compression_s3tc, GL_EXT_texture_cube_map, 
    GL_EXT_texture_edge_clamp, GL_EXT_texture_env_add, 
    GL_EXT_texture_env_combine, GL_EXT_texture_env_dot3, 
    GL_EXT_texture_filter_anisotropic, GL_EXT_texture_lod_bias, 
    GL_EXT_texture_mirror_clamp, GL_EXT_texture_object, 
    GL_EXT_texture_rectangle, GL_EXT_texture_sRGB, GL_EXT_vertex_array, 
    GL_KTX_buffer_region, GL_NV_blend_square, GL_NV_texgen_reflection, 
    GL_SGIS_generate_mipmap, GL_SGIS_texture_edge_clamp,
GL_SGIS_texture_lod, 
    GL_WIN_swap_hint, WGL_EXT_swap_control

With the GLJPanel we got the excpetion:
Exception in thread “AWT-EventQueue-0” javax.media.opengl.GLException: Error making context current
at com.sun.opengl.impl.x11.X11GLContext.makeCurrentImpl(X11GLContext.java:141)
at com.sun.opengl.impl.x11.X11OffscreenGLContext.makeCurrentImpl(X11OffscreenGLContext.java:74)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
at javax.media.opengl.GLJPanel.paintComponent(GLJPanel.java:661)
at javax.swing.JComponent.paint(JComponent.java:1027)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)
at javax.swing.JComponent.paintChildren(JComponent.java:864)
at javax.swing.JComponent.paint(JComponent.java:1036)

However, the same code using GLCanvas works perfectly well.

May it come from the ATI drivers?

Thanks for any help,
Jean-Baptiste

I’ve tried on an other computer with a Radeon x700, jogl nightly build from today and latest ATI-drivers.

There are still errors, but now the exception changed in:


javax.media.opengl.GLException: Error: no OpenGL buffer object appears to be bou
nd to target 0x8892
        at com.sun.opengl.impl.GLBufferSizeTracker.setBufferSize(GLBufferSizeTra
cker.java:118)
        at com.sun.opengl.impl.GLImpl.glBufferData(GLImpl.java:786)
        at com.sun.opengl.util.j2d.TextRenderer$Pipelined_QuadRenderer.<init>(Te
xtRenderer.java:1699)
        at com.sun.opengl.util.j2d.TextRenderer.drawGlyphs(TextRenderer.java:849
)
        at com.sun.opengl.util.j2d.TextRenderer.internal_draw3D(TextRenderer.jav
a:827)
        at com.sun.opengl.util.j2d.TextRenderer.draw3D(TextRenderer.java:512)
        at TestSimone.display(TestSimone.java:107)
        at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78
)

I also found that actually Java2D OpenGL pipeline was not enable with the Djogl.debug.Java2D and -Djogl.debug.GLJPanel options.

Moreover, I’m able to render any OpenGL primitive without any problem. It is also still working with GLCanvas.
I then tried the JRefract demo and when I choose the text demo, the window opens with the menus and background but there is not any text flying in it.

I don’t know where to look now. I hope it is just the drivers.
I’ve already experienced some drivers issues with an old compaq (2002) computer with an nvidia quadro.
The drivers provided by compaq with the computer were buggy and my application was constantly crashing after a few seconds.
Installing the lastest drivers solved the problem.

Any suggestion would be appreciated,
thank in advance,
Jean-Baptiste

Try to use VBOs. If it crashes again, it seems that it comes from your driver. I have always had problems with ATI Xpress 200M under Linux, my game crashes when I use a VBO. TextRenderer can use VBOs. Therefore, it might explain your problem.

You’re right, it is a problem with VBOs.

I tried a demo using VBOs and it does not work with GLJPanel.

In the demo, a test is made at first to check wether the VBOs functions are available with


final boolean VBOsupported = gl.isFunctionAvailable("glGenBuffersARB") &&
                gl.isFunctionAvailable("glBindBufferARB") &&
                gl.isFunctionAvailable("glBufferDataARB") &&
                gl.isFunctionAvailable("glDeleteBuffersARB");

I checked and none of them seems available, all the functions return false.
However, when using glxinfo, I got the extension GL_ARB_vertex_buffer_object.

With the GLCanvas, all the functions are available and the demo runs well.

May the VBO extension be not supported without Hardware acceleration?

Thank you for your suggestion,
Jean-Baptiste

Of course the VBO extension can’t work without hardware acceleration.

That is apparently not that obvious. On a computer with a Nvidia Quadro FX 550 and with Java2d OpenGL pipeline manually disabled, I am able to run the code above.

Apparenlty, I won’t be able to use Textrenderer with some graphic card/drivers configurations.
I wonder then if I may disable VBO’s for TextRenderer or if there is an alternative for it (personnaly I don’t really like glut strings).

Jean-Baptiste

Ok finally, I found I’m not the only one having issues with ATI cards and TextRenderer:
http://www.java-gaming.org/forums/index.php?topic=18080.0

I’m going to try the class provided by emzic.

Sorry guys for the post and thanks for your help.
Jean-Baptiste

Actually the error remains even with the patched version _.

JOGL tells me that GL_VERSION_1_5 is available, and also the functions glBindBuffer, glBufferData and glGenBuffers. I figure this with glIsExtensionAvailable and glIsFunctionAvailable
However the first call to glBufferData raises an excpection.

The other strange thing is that GL_ARB_vertex_buffer_object is not available when asked with glIsExtensionAvailable.

Jean-Baptiste.

The RC7 version of text renderer solved the error on our computers.
The hardware acceleration couldn’t still be enable, but we don’t get anymore exception.

Thank you very much for the fix,
Jean-Baptiste

I went into JOGL code and found that actually the Hardware acceleration couldn’t be enable because glXChooseFBConfig fails to create the pbuffer. It returns null.
I’ve checked the flags in the attrib_list and they all seems ok.
So is it a bug in ATI drivers or is it my cards which does not support pbuffers?

If it is a bug do you know how I can report this bug to ATI and do you think they will take it into consideration?

Thanks,
Jean-Baptiste

Hard to tell. What graphics chip is in these machines?

the latest tests were run a Radeon mobility x700 with the latest ATI drivers.

Jean-Baptiste

If you can commit to working with ATI to provide them a small test case, I will put you in touch with the leads of their Linux Beta program. Email me at kenneth dot russell at sun dot com.