I'm new to OpenGL in Java, and Java in general. I am following a textbook and trying to create my first window. However, when I run my code, I get the error that "package com.jogamp.opengl does not exist". I have added the .JAR files to my project's reference libraries as shown:
My code reads:
import javax.swing.*;
import static com.jogamp.opengl.GL4.*;
import com.jogamp.opengl.*;
import com.jogamp.opengl.awt.GLCanvas;
public class Code extends JFrame implements GLEventListener {
private GLCanvas myCanvas;
public Code() {
setTitle("Chapter 2 - program 1");
setSize(600, 400);
setLocation(200, 200);
myCanvas = new GLCanvas();
myCanvas.addGLEventListener(this);
this.add(myCanvas);
this.setVisible(true);
}
public void display(GLAutoDrawable drawable) {
GL4 gl = (GL4) GLContext.getCurrentGL();
gl.glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
gl.glClear(GL_COLOR_BUFFER_BIT);
}
public static void main(String[] args) {
new Code();
}
public void init(GLAutoDrawable drawable) {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
}
public void dispose(GLAutoDrawable drawable) {
}
}
Any advice would be great - I'm guessing it is some simple step I've missed, but I've gone over the section in the book a couple of times now so I'm nto sure what I'm missing.