Question

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 ();

Était-ce utile?

La solution

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.

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top