Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2016 14:19:23 +0100 (BST)
From:      Anton Shterenlikht <mexas@bris.ac.uk>
To:        freebsd-java@freebsd.org
Subject:   help fix JOGL errors/warnings
Message-ID:  <201605161319.u4GDJNkM019165@mech-as222.men.bris.ac.uk>

next in thread | raw e-mail | index | archive | help
Hi

I'm trying to follow this JOGL tutorial:
https://sites.google.com/site/justinscsstuff/jogl-tutorial-2

I can successfully create an empty window with AWT,
although I get a warning:

$ echo $CLASSPATH
/usr/local/share/java/classes/jogl2.jar:/usr/local/share/java/classes/gluegen2.jar:/usr/local/share/java/classes/gluegen2-rt.jar:.
$ cat SimpleScene.java

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;

public class SimpleScene {
    public static void main(String[] args) {
        GLProfile glp = GLProfile.getDefault();
        GLCapabilities caps = new GLCapabilities(glp);
        GLCanvas canvas = new GLCanvas(caps);

        Frame frame = new Frame("AWT Window Test");
        frame.setSize(300, 300);
        frame.add(canvas);
        frame.setVisible(true);
        
        // by default, an AWT Frame doesn't do anything when you click
        // the close button; this bit of code will terminate the program when
        // the window is asked to close
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }
}

$ 

$ javac SimpleScene.java 
warning: Supported source version 'RELEASE_6' from annotation processor 'com.jogamp.gluegen.structgen.CStructAnnotationProcessor' less than -source '1.8'
1 warning
$ 

What is this warning about?
Is the example not conforming with my JOGL version?

$ pkg info -xo jogl
jogamp-jogl-2.2.4              graphics/jogamp-jogl

Anyway, when I then run

$ java SimpleScene

I get an empty window.

However, when I try to create a window with NEWT:
(lower down on the same page:
https://sites.google.com/site/justinscsstuff/jogl-tutorial-2 )

I get:

$ cat SimpleScene.java 

import javax.media.opengl.*;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;

public class SimpleScene {
    public static void main(String[] args) {
        GLProfile glp = GLProfile.getDefault();
        GLCapabilities caps = new GLCapabilities(glp);

        GLWindow window = GLWindow.create(caps);
        window.setSize(300, 300);
        window.setVisible(true);
        window.setTitle("NEWT Window Test");

        window.addWindowListener(new WindowAdapter() {
            public void windowDestroyNotify(WindowEvent arg0) {
                System.exit(0);
            };
        });
    }
}

$ javac SimpleScene.java 
warning: Supported source version 'RELEASE_6' from annotation processor 'com.jogamp.gluegen.structgen.CStructAnnotationProcessor' less than -source '1.8'
1 warning
$ java SimpleScene
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable (open, marked uncloseable): 0, pending (open in creation order): 2)
X11Util: Open X11 Display Connections: 2
X11Util: Open[0]: NamedX11Display[:0.0, 0x8d6e22000, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0.0, 0x8d6e23400, refCount 1, unCloseable false]
$ 

The window opens momentarity and then shuts down automatically.
Is this an expected behaviour?

I then try to run a moving triangle example,
bottom of this page:
https://sites.google.com/site/justinscsstuff/jogl-tutorial-3

I get this error:

SimpleScene.java:34: error: incompatible types: FPSAnimator cannot be converted to Animator
        Animator animator = new FPSAnimator(canvas, 60);
                            ^
1 error

Again, perhaps the example is out of date,
or the other way round - the JOGL version installed
is out of date?

Thanks

Anton



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605161319.u4GDJNkM019165>