Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 1185 times)
0 Members and 1 Guest are viewing this topic.
Offline alain21

Junior Newbie





« Posted 2011-08-22 04: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
« Reply #1 - Posted 2011-08-22 12: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 14:59:46 »

Rgr,

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

 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (32 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (50 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (57 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!