Interesting… Thanks for helping me through this!
GluGen…
it was built using java 1.6 (if that makes a difference?).
The application runs perfectly fine in IDE(not even a warning).
I copied the Applet code you made (using your host) into my host and it’s still just giving me the class not found error. This is screwing with my head. If I posted code do you think it’d help you understand what may be going on?
Applet Launch Class
//Imports up here
public class ArtLabAppletLaunch extends Applet implements ActionListener {
private static final long serialVersionUID = 1L;
protected GLCanvas canvas;
protected Animator animator;
//Listener's/Handlers for input
private KeyboardHandler keyboardHandler = new KeyboardHandler();
//GUI for Applet
private TextArea descriptionTxt = new TextArea();
private Button backToGalleryBtn = new Button();
//Load Canvas stuff?
private ArtLab artLabProcess = new ArtLab(this);
//GUI
private Panel movePnl = new Panel();
private Label[] controlLbl = new Label[5];
private Button scaleHeightPlusBtn = new Button();
private Button scaleHeightLessBtn = new Button();
private Button scaleWidthPlusBtn = new Button();
private Button scaleWidthLessBtn = new Button();
private Button zoomInBtn = new Button();
private Button zoomOutBtn = new Button();
private Button resetBtn = new Button();
public void addKeyListener(KeyboardListenerInterface listener){
keyboardHandler.addListener(listener);
}
public void changeText(String text){
descriptionTxt.setText(text);
}
public void setGalleryGUIVisibility(boolean visible){
backToGalleryBtn.setVisible(visible);
movePnl.setVisible(visible);
}
public void init() {
//setSize(512, 256 + 128 + 32 + 128); this is commented out
setLayout(new BorderLayout());
GLCapabilities glCapabilities = new GLCapabilities();
glCapabilities.setDoubleBuffered(true);
glCapabilities.setHardwareAccelerated(true);
canvas = new GLCanvas(glCapabilities);
setLayout(null);
animator = new Animator(canvas);
canvas.addGLEventListener(keyboardHandler);
canvas.addKeyListener(keyboardHandler);
canvas.addGLEventListener(artLabProcess);
canvas.setBounds(0, 0, 512, 256);
backToGalleryBtn.setBounds(0, 384, 512, 32);
backToGalleryBtn.setLabel("~ Go Back To The Art Gallery ~");
backToGalleryBtn.setVisible(false);
descriptionTxt.setBounds(0, 256, 512, 128);
//GUI PANEL for looking Directions
movePnl.setVisible(false);
movePnl.setBounds(0, 417, 512, 128);
movePnl.setLayout(null);
controlLbl[0] = new Label();
controlLbl[0].setBounds(0, 0, 64, 32);
controlLbl[0].setText("Height: ");
movePnl.add(controlLbl[0]);
scaleHeightPlusBtn.setBounds(64, 0, 32, 32);
scaleHeightPlusBtn.setLabel("+");
movePnl.add(scaleHeightPlusBtn);
scaleHeightLessBtn.setBounds(128, 0, 32, 32);
scaleHeightLessBtn.setLabel("-");
movePnl.add(scaleHeightLessBtn);
//More boring GUI adding code
//Add All GUI to Applet
add(canvas);
add(descriptionTxt);
//more GUI added here
//Add Event Listeners for all GUI
backToGalleryBtn.addActionListener(this);
//More of those
}
public void start() {
animator.setRunAsFastAsPossible(false);
animator.start();
}
public void stop() {
animator.stop();
}
public void actionPerformed(ActionEvent unknownEvent){
//Handles GUI actions
}
}
Actual Applet Code:
public class ArtLab implements GLEventListener{
private float LOOK_AT_DIST = 100.0f;
private final static float FOV = 45.0f;
private final static float DEFAULT_ART_SIZE = 10.0f;
private final static float CAMERA_MOVEMENT_INCREMENT = 0.2f;
private GL gl;
private GLU glu = new GLU();
//Camera Points
private Point3D CameraLook = new Point3D(0.0f, 1.0f, 0.0f);
private Point3D Camera = new Point3D(5.0f, 5.0f, 10.0f, 0,270,0);
private Point3D standAloneCamera = standAloneCameraReset;
//Gallery Objects
private LinkedList <Plane> walls = new LinkedList <Plane> ();
private Plane floor = null;
private Plane ceiling = null;
private LinkedList <Art> artThumbNails = new LinkedList <Art> ();
//Stand-alone art Object
private Art standAlone = null;
//Huds
private HeadsUpDisplay cursor = new HeadsUpDisplay(0.50f, 0.50f, 0.064f, 0.128f);
//Display Lists
private int room;
private int art;
//TOP
private ArtLabAppletLaunch artLabTOP;
//Application Variables
private int lastSelectedImage = -1, galleryImage = -1;
private boolean inGallery = true;
private boolean hasResetCamera = false;
public ArtLab(ArtLabAppletLaunch cg) {
cg.addKeyListener(new KeyboardListenerInterface() {
public void buttonPressed(int i){handleKeyboardInput(i);}
});
artLabTOP = cg;
}
public void init(GLAutoDrawable drawable) {
gl = drawable.getGL(); //Set Up GL
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);//Black GL clear color
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glClearDepth(1.0f);
gl.glDepthFunc(GL.GL_LEQUAL);
gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
//Initialize Camera
updateCamera();
//Create Room Environment
walls.add(new Plane(15f, 5.0f, 0f,
30.0f, 10.0f, 0.0f));
walls.add(new Plane(15f, 5.0f, 30f,
30.0f, 10.0f, 0.0f));
walls.add(new Plane(0f, 5.0f, 15f,
0.0f, 10.0f, 30.0f));
walls.add(new Plane(30f, 5.0f, 15f,
0.0f, 10.0f, 30.0f));
floor = new Plane(15f, 0.0f, 15f,
30.0f, 0.0f, 30.0f);
ceiling = new Plane(15f, 10.0f, 15f,
30.0f, 0.0f, 30.0f);
//Create Paintings
artThumbNails.add(new Art(15f, 5.0f, 0.2f,
5.0f, 4.5f, 0.0f));
//etc
//Create Stand-Alone Art
standAlone = new Art(0.0f, 5.0f, 0f,
5.0f, 5.0f, 0.0f);
//Load Images
//Load Textures From Images
//Create Display List's
room = gl.glGenLists(1);
art = gl.glGenLists(2);
//Populate Room Display List
gl.glNewList(room, GL.GL_COMPILE);
//Draw Walls
for(int index = 0; index < walls.size(); index++){
gl.glPushMatrix();
gl.glTranslatef(walls.get(index).X, walls.get(index).Y, walls.get(index).Z);
walls.get(index).draw(gl);
gl.glPopMatrix();
}
//Draw Floor
gl.glPushMatrix();
gl.glTranslatef(floor.X, floor.Y, floor.Z);
floor.draw(gl);
gl.glPopMatrix();
//Draw Ceiling
gl.glPushMatrix();
gl.glTranslatef(ceiling.X, ceiling.Y, ceiling.Z);
ceiling.draw(gl);
gl.glPopMatrix();
gl.glEndList();
//Populate Art Display List
gl.glNewList(art, GL.GL_COMPILE);
//Draw Art in Canvas's
for(int index = 0; index < artThumbNails.size(); index++){
gl.glPushMatrix();
gl.glTranslatef(artThumbNails.get(index).X, artThumbNails.get(index).Y,artThumbNails.get(index).Z);
artThumbNails.get(index).draw(gl);
gl.glPopMatrix();
}
gl.glEndList();
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL gl = drawable.getGL();
if (height == 0){height = 1;} //Avoid Division by Zero Error
gl.glViewport(x, y, width, height);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(FOV, (float)width/(float)height, 1, LOOK_AT_DIST);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
}
public void display(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
if(inGallery){
//Use In Gallery Camera
glu.gluLookAt(Camera.X, Camera.Y, Camera.Z,
CameraLook.X, CameraLook.Y, CameraLook.Z, 0,1,0);
//Environment
gl.glCallList(room);
gl.glCallList(art);
//Heads Up Displays
begin2D();
gl.glPushMatrix();
cursor.draw(gl);
gl.glPopMatrix();
end2D();
} else {
//Use Solo Art Viewing Camera
glu.gluLookAt(standAloneCamera.X, standAloneCamera.Y, standAloneCamera.Z,
CameraLook.X, CameraLook.Y, CameraLook.Z, 0,1,0);
//Environment for Viewing Single Art-work
gl.glPushMatrix();
gl.glTranslatef(standAlone.X, standAlone.Y, standAlone.Z);
standAlone.drawBigArt(gl);
gl.glPopMatrix();
}
gl.glFlush();
}
private void begin2D() {
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glDisable(GL.GL_LIGHTING);
}
private void end2D() {
gl.glEnable(GL.GL_LIGHTING);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopMatrix();
}
}
Do Display Lists work in Applets?