Bug 354 - Inclusion of a GLCanvas in a JFrame causes exception
Summary: Inclusion of a GLCanvas in a JFrame causes exception
Status: VERIFIED WORKSFORME
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All windows
: P3 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2008-04-15 04:28 CEST by Sven Gothel
Modified: 2010-03-24 07:51 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments
The source file which shows the problem. (1.79 KB, text/plain)
2008-04-15 16:29 CEST, Sven Gothel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2010-03-24 07:51:26 CET


---- Reported by esalbert 2008-04-15 16:28:20 ----

When trying to compile a simple test program (just draws a triangle),

<pre>
package test;

import java.awt.BorderLayout;
import javax.media.opengl.*;
import javax.swing.*;

public class SimpleTest implements GLEventListener
{
  public SimpleTest() { super(); }

  public void init(GLAutoDrawable drw)
  {
    drw.setGL(new DebugGL(drw.getGL()));
    GL gl = drw.getGL();

    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    gl.glLoadIdentity();
  } // init

  public void display(GLAutoDrawable drw)
  {
    GL gl = drw.getGL();

    gl.glColor3f(1.0F, 0.4F, 0.0F);

    gl.glBegin(GL.GL_TRIANGLES);
      gl.glVertex3f(0.0F, 0.0F, 0.0F);
      gl.glVertex3f(1.0F, 0.0F, 0.0F);
      gl.glVertex3f(1.0F, 1.0F, 0.0F);
    gl.glEnd();
  } // display

  public void reshape(GLAutoDrawable drw, int x, int y, int wid, int hite)
  {
  } // reshape

  public void displayChanged(GLAutoDrawable drw, boolean modeCh, boolean devCh)
  {
  } // displayChanged

  public static void main(String[] argv)
  {
    GLCapabilities glCaps = new GLCapabilities();

    // This line fails with the current (1.1.1.1-rc8 - February 22) build,
    // but works if GLCanvas is changed to GLJPanel.  With the 1.1.0
    // release build, it works either way.  When it fails, the JFrame, when
    // first made visible, crashes with an IllegalArgumentException deep
    // inside the GL class heirarchy.
    GLCanvas canv = new GLCanvas(glCaps);

    final JFrame fram = new JFrame("TestFrame");
    fram.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    fram.setSize(640, 480);
    fram.getContentPane().add(canv, BorderLayout.CENTER);
    canv.addGLEventListener(new SimpleTest());
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        fram.setVisible(true);
      } // run
    });
  } // main
} // SimpleTest
</pre>

I get the following exception if I use a GLCanvas:

<pre>
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
java.lang.IllegalArgumentException: 

argument type mismatch
        at
com.sun.opengl.impl.JAWT_DrawingSurfaceInfo.newPlatformInfo(JAWT_DrawingSurfaceInfo.java:86)
        at
com.sun.opengl.impl.JAWT_DrawingSurfaceInfo.platformInfo(JAWT_DrawingSurfaceInfo.java:52)
        at 

com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:189)
        at 

com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        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.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
        at java.awt.Component.dispatchEventImpl(Component.java:4486)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        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)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
com.sun.opengl.impl.JAWT_DrawingSurfaceInfo.newPlatformInfo(JAWT_DrawingSurfaceInfo.java:83)
        ... 20 more
</pre>

If I change "GLCanvas" to "GLJPanel" on the indicated line, it runs correctly. 
Using the 1.1.0 release versions of the libraries, it worked either way.

Please let me know if I need to provide any more information.  The machine is a
Dell Precision PWS390 computer running Windows XP Professional with a Core 2 CPU
and 2 GB of RAM.  I did set the "-Dsun.java2d.noddraw=true" flag.

Thank you for considering this matter.

Eric Salberta



---- Additional Comments From esalbert 2008-04-15 16:29:47 ----

Created an attachment
The source file which shows the problem.




---- Additional Comments From kbr 2008-04-16 22:45:15 ----

Without having time to run this test I can tell you with 99.9% certainty that
you have a mismatched jogl.dll and jogl.jar. Please clean all such files off
your system and download a fresh copy of JOGL. Please reopen this bug if the
problem persists.




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:51 EDT  ---

This bug was previously known as _bug_ 354 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=354
Imported an attachment (id=125)

The original submitter of attachment 125 [details] is unknown.
   Reassigning to the person who moved it here: sgothel@jausoft.com.