Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (307)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JOGL and applets  (Read 847 times)
0 Members and 1 Guest are viewing this topic.
Offline alain21

Junior Newbie





« Posted 2011-08-22 06:29:52 »

I working on in-browser jogl game ... and weird thing I got it working great until yesterday where I change something and everything start crashing ...

looking back in the Java trace I see :

Exception in thread "AWT-EventQueue-2" java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to com.sun.opengl.impl.x11.JAWT_X11DrawingSurfaceInfo
   at com.sun.opengl.impl.x11.X11OnscreenGLDrawable.lockSurface(X11OnscreenGLDrawable.java:152)
   at com.sun.opengl.impl.x11.X11OnscreenGLContext.makeCurrentImpl(X11OnscreenGLContext.java:61)
   at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)

When running as Application, everything works great. However, the problem is in applet mode. For info .... I am using JOGL 1, Linux and Chrome. I am running the following the Following Code for my GLListerner

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
public class AppJavaTestWebStart implements GLEventListener {

    //When running as an application

    public static void main(String[] args){
   AppJavaTestWebStart objApp= new AppJavaTestWebStart();
        Frame frame = new Frame("Simple JOGL Application");
        GLCanvas canvas = new GLCanvas();

        canvas.addGLEventListener(this);
        frame.add(canvas);
        frame.setSize(640, 480);
        frame.addWindowListener(new WindowAdapter() {

            @Override
            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() {

               @Override
                    public void run() {
                        System.exit(0);
                    }
                }).start();
            }
        });
        // Center frame
       frame.setLocationRelativeTo(null);
        frame.setVisible(true);

      while(true)
         canvas.display();
   }
   @Override
    public void init(GLAutoDrawable drawable) {
        [...]
   }

   @Override
    public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
        [...]
    }

   @Override
    public void display(GLAutoDrawable drawable) {
        [...]
    }
    public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
    }


And this code for my applet

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
public class AppletJavaTestWebStart extends Applet{
   private Animator m_objAnimator;
   private GLCanvas m_objcanvas;


   @Override
   public void init(){
      setLayout(new BorderLayout());
      m_objcanvas= new GLCanvas();

      m_objcanvas.addGLEventListener(new AppJavaTestWebStart());
      m_objcanvas.setSize(getSize());
      add(m_objcanvas, BorderLayout.CENTER);

      m_objAnimator= new Animator(m_objcanvas);  
   }

   @Override
   public void start(){
      m_objAnimator.start();
   }

   @Override
   public void stop(){
      m_objAnimator.stop();
   }



The following HTML:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
          <applet code="org.bianisoft.tests.javatestwebstart.AppletJavaTestWebStart"
             width=640
            height=480
            <param name="codebase_lookup" value="true">
            <param name="subapplet.displayname" value="JOGL Gears Applet">
            <param name="noddraw.check" value="true">
            <param name="progressbar" value="true">
            <param name="java_arguments" value="-Dsun.java2d.noddraw=true">
            <param name="jnlp_href" value="JavaTestWebStart_local.jnlp">
         </applet>



The following JNLP:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="./" href="JavaTestWebStart_local.jnlp">

   <information>
      <title>JavaTestWebStart Demo</title>
      <vendor>Alain Petit</vendor>
      <homepage href="http://www.alainpetit.me/"/>
      <description> JavaTest Web Start Demo</description>
      <description kind="short">The simplest possible JOGL Java Web Start demo - draws one triangle.</description>
      <offline-allowed/>
   </information>
   <update check="background" policy="always"/>

   <security>
      <all-permissions/>
   </security>

   <resources>
      <j2se href="http://java.sun.com/products/autodl/j2se" version="1.6+"/>
      <property name="sun.java2d.noddraw" value="true"/>
      <extension name="JOGL" href="JOGL_local.jnlp" />
      <jar href="JavaTestWebStart.jar" main="true"/>
      <jar href="JavaTestWebStart_res.jar"/>
   </resources>

   <applet-desc
         name="JavaTestWebStart Demo Applet"
         main-class="org.bianisoft.tests.javatestwebstart.AppletJavaTestWebStart"
         width="640"
         height="480">
    </applet-desc>

   <!-- application-desc
      main-class="org.bianisoft.tests.javatestwebstart.JavaTestWebStart">
   </application-desc -->
</jnlp>


It's got to be something trivial ....
Offline gouessej

JGO Ninja


Medals: 35
Projects: 1


TUER


« Reply #1 - Posted 2011-08-22 14:41:21 »

Hi

JOGL 1.1.1a is obsolete, please switch to JOGL 2. This bug is not reproducible with JOGL 2 but take care not mixing the both, clean your environment before switching.

Offline alain21

Junior Newbie





« Reply #2 - Posted 2011-08-22 16:59:46 »

Rgr,

Tks I'll try that
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
mrbenebob (16 views)
2013-06-19 14:55:23

BrassApparatus (24 views)
2013-06-19 08:52:37

NegativeZero (27 views)
2013-06-19 03:31:52

NegativeZero (30 views)
2013-06-19 03:24:09

Jesse_Attard (34 views)
2013-06-18 22:03:02

HeroesGraveDev (70 views)
2013-06-15 23:35:23

Vermeer (69 views)
2013-06-14 20:08:06

davedes (71 views)
2013-06-14 16:03:55

alaslipknot (63 views)
2013-06-13 07:56:31

Roquen (88 views)
2013-06-12 04:12:32
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!