0

I'm trying to build a jogl app. I downloaded the jars and the native dll files. I have included them in my buildpath but when I run my code I get a the error from the title

Here is my vm file:

-server
-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-Djava.library.path="C:\Users\Vlad\Documents\dev\jogamp-all-platforms\lib\windows-amd64"

Here is that folder: enter image description here

Here are the jars that I have in my build path: enter image description here

And finally if there is any need for the actual code here it is:

    import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLCapabilities;
import javax.swing.*;

/**
 *  on 20/02/14.
 */
public class Demo extends JFrame {

    static Demo app = new Demo();
    public static void main(String[] args)
    {

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                app.setVisible(true);
            }
        });
    }

    public Demo(){
        super("This is my first jogl app");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        GLCapabilities caps = new GLCapabilities();
        GLCanvas canvas = new GLCanvas(caps);
        canvas.addGLEventListener(new MyGLListener());
        getContentPane().add(canvas);
    }
}

EDIT

I have changed the libraries to match the new ones:

enter image description here

As you can see I have the natives and the jogl-all.jar and even the gluegen-rt.jar library.

The error that I get now is a compiler error:

This is the piece of code that's causing it:

 GLCanvas canvas = new GLCanvas(new GLCapabilities());

It says that GLCapabilites (GLProfiles) in GLCapabilties cannot be applied to ();

Nathaniel Jones
  • 1,829
  • 3
  • 29
  • 27
Bula
  • 2,398
  • 5
  • 28
  • 54
  • There is no need to use the native libraries as you do. JOGL 2 is able to extract and load the correct native libraries from its JARs (those containing "-natives-" in their names). Just put the necessary JARs into the same directory, put gluegen-rt.jar and jogl-all.jar into the classpath (or the Build Path in Eclipse) and that's all. It's less error prone, especially when you use both a 32 bits JVM and a 64 bits JVM. Please update your code (especially the import clauses) to reflect the use of JOGL 2 and avoid confusions. – gouessej Feb 22 '14 at 17:11

2 Answers2

1

You may also need to include gluegen-rt.jar in your build path. You should be able to obtain this from the same place where you found jogl-all.jar (JOGL 2).

Regarding your edit, for simplicity, you can use:

GLCanvas canvas = new GLCanvas(new GLCapabilities(null));

This will allow you to use the default GLProfile.

Nathaniel Jones
  • 1,829
  • 3
  • 29
  • 27
  • jogl.jar has been replaced by jogl-all.jar in JOGL 2. – gouessej Feb 21 '14 at 08:27
  • @NathanielJones I have changed it to jogl-all.jar . Check updates – Bula Feb 21 '14 at 10:00
  • @Bula You should check the API documentation for JOGL 2 to see how the arguments have changed. I've shown a simple way to deal with the one you mention in the edit to my answer. – Nathaniel Jones Feb 21 '14 at 12:58
  • @NathanielJones thank you. Personally I don't consider this update so great at my really basic level but that doesn't matter. Thanks for helping me solve this problem – Bula Feb 21 '14 at 13:36
  • The maintenance of JOGL 1 was stopped several years ago whereas JOGL 2 is actively maintained and it isn't very difficult to look at its online documentation here: http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/ – gouessej Feb 22 '14 at 17:07
0

Your source code uses JOGL 1 whereas you try to use JOGL 2 JARs with it. Rather look at my simple example on Wikipedia. You can find the instructions to install JOGL in our Wiki here.

gouessej
  • 3,640
  • 3
  • 33
  • 67