javac with jogl

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

javac with jogl

JavaFan
Hello. I want to start to use JOGL in Java, so I downloaded jogamp-all-platforms.7z from this site : http://jogamp.org/deployment/jogamp-current/archive/.

According to a tutorial, I put in a directory "project/lib" gluegen-rt.jar, jogl-all.jar, and the contents of jogl-natives-windows-amd64.jar.

I put in the directory "project" the file Opengl.java (which was in the tutorial), to test JOGL. It contains :

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.Animator;

public class Opengl implements GLEventListener{
        public static void main(String[] args) {
                Frame frame = new Frame("Article1");
                GLCanvas canvas = new GLCanvas();
                canvas.addGLEventListener(new Opengl());
                frame.add(canvas);
               
                final Animator animator = new Animator(canvas);
               
                frame.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent e) {
                                new Thread(new Runnable() {
                                        public void run() {
                                                animator.stop();
                                                System.exit(0);
                                        }
                                }).start();
                        }
                });
               
                frame.setSize(300, 300);
                frame.setVisible(true);
                animator.start();
        }

        public void dispose(GLAutoDrawable drawable) {
                GL gl = drawable.getGL();
                gl.setSwapInterval(1);
        }
        public void init(GLAutoDrawable drawable) {
                GL gl = drawable.getGL();
                gl.setSwapInterval(1);
        }

        public void reshape(GLAutoDrawable drawable, int x, int y, int width,
                        int height) {
                GL gl = drawable.getGL();
        }

        public void display(GLAutoDrawable drawable) {
                GL gl = drawable.getGL();
        }
       
        public void displayChanged(GLAutoDrawable drawable, boolean modeChanged,
                        boolean deviceChanged) {
        }

}



So, I tried to compile this file with "javac Opengl.java", but it failed (it don't recognize the import). Do I have to change the import at the beginning, or to add an option to javac ?
Reply | Threaded
Open this post in threaded view
|

Re: javac with jogl

gouessej
Administrator
Hi

Look at my example mentioned in the wiki and on Wikipedia:
https://gist.github.com/gouessej/3420e2b6f632efdddf98

Don't you see anything obvious? Your imports are wrong, those classes have been moved:
https://jogamp.org/bugzilla/show_bug.cgi?id=682

You should have looked at our Java documentation:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/

Good luck with JOGL. I don't advise you to use any unofficial tutorials as some webmasters are more worried about earning money with ads than with updating their code to work with the latest version of JOGL.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: javac with jogl

gouessej
Administrator
In reply to this post by JavaFan
I advise you to read this section of our wiki:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Compile_and_run_your_project_from_the_command_line

Moreover, you can use jogamp-fat.jar if you need an easier solution:
javac -classpath jogamp-fat.jar Opengl.java

Where have you found the faulty tutorial?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: javac with jogl

jmaasing
Also, if you happen to be using maven as build tool for your project there is nothing special to get jogl running. Just the usual maven dependecies and pom.xml files.