user4357505
user4357505

Reputation: 145

JOGL errors in eclipse

 import java.awt.Button;
 import java.awt.Frame;
 import java.awt.Menu;
 import java.awt.MenuBar;
 import java.awt.MenuItem;
 import java.awt.Panel;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;

 import javax.media.opengl.GL;
 import javax.media.opengl.GL2;
 import javax.media.opengl.GLAutoDrawable;
 import javax.media.opengl.GLCanvas;
 import javax.media.opengl.GLCapabilities;
 import javax.media.opengl.GLEventListener;
 import javax.media.opengl.GLProfile;
 import com.jogamp.opengl.util.FPSAnimator;


 public void init (GLAutoDrawable drawable) {
   GL2 gl = drawable.getGL().getGL2();
   gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //black
   gl.glEnable(GL.GL_DEPTH_TEST);
   gl.glEnable(GL.GL_CULL_FACE);
   gl.glFrontFace(GL.GL_CCW);
   gl.glCullFace(GL.GL_BACK);
   gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2.GL_LINE);
   scene = new A1E5Scene();
 }

/* Called to indicate the drawing surface has been moved and/or resized  */
public void reshape (GLAutoDrawable drawable, int x, int y, int width, int height) {
GL2 gl = drawable.getGL().getGL2();

float fAspect=(float) width/height;
float fovy=60.0f;

gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();

float top=(float) Math.tan(Math.toRadians(fovy*0.5))*NEAR_CLIP;
float bottom=-top;
float left=fAspect*bottom;
float right=fAspect*top;

gl.glFrustum(left, right, bottom, top, NEAR_CLIP, FAR_CLIP);
gl.glMatrixMode(GL2.GL_MODELVIEW);
}

/* draw */
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
scene.update();
scene.render(gl);
}

public void dispose(GLAutoDrawable drawable) {
}

I am currently trying to get JOGL running on eclipse but it is finding issue with this part of the code. The errors it is throwing up are in relation to getGL2(), it seems that there could be a library missing but I am unsure as to which one.

These are the libaries I have used:

/usr/share/java/jogl.jar

/usr/share/java/jogl2.jar

/usr/share/java/gluegen-rt.jar

/usr/share/java/gluegen2-rt.jar

/usr/share/java/jogl-1.1.1+dak1.jar

/usr/share/java/jogl-all.jar

Any help would be appreciated.

Upvotes: 0

Views: 284

Answers (1)

gouessej
gouessej

Reputation: 4075

You mix JOGL 1.1.1 with JOGL 2, it's completely wrong. Please look at our wiki to pick the right JARs: http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE

Upvotes: 1

Related Questions