I'm trying to make hardware jpct-lwjgl applets that use the joystick and 3D hardware. All three of the first ones have failed to render anything to the screen (except for when on the third one I was using jpct's software renderer). Check out the code of this incredibly simple applet and remember it worked on software rendering (without the canvas). As it is, I get a black screen (nothing renders). By the way, although I'm only using ambient light on this one, the other two had other lights positioned around the world.
import java.applet.*;
import java.awt.*;
import com.threed.jpct.*;
import com.threed.jpct.util.Light;
import org.lwjgl.opengl.*;
import org.lwjgl.input.*; //JOYSTICK AND OPENGL-MODE KEYBOARD
public class SimpleApplet3D extends Applet implements Runnable {
private Object3D object;
private World theWorld;
private FrameBuffer buffer;
private Camera theCamera;
private boolean keepGoing;
private Controller joystick;
private Canvas theCanvas;
public void init() {
object = Loader.load3DS("c:/MyPrograms/3D/SimpleApplet/Girl.3DS", 1f)[0];
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
Config.maxPolysVisible *= 3;
theWorld = new World();
theCamera = theWorld.getCamera();
this.add(theCanvas = buffer.enableGLCanvasRenderer());
Controllers controllers = new Controllers();
try {
controllers.create();
if (controllers.getControllerCount() > 0) {
joystick = controllers.getController(0);
System.out.println("Got the joystick. Its name: "+joystick.getName());
}
}
catch (org.lwjgl.LWJGLException e) {}
theWorld.addObject(object);
theWorld.setAmbientLight(65, 65, 65);
keepGoing = true;
}
public void start() {
Thread appletLoop = new Thread(this);
appletLoop.start();
}
private void draw() {
buffer.clear(Color.black);
theWorld.renderScene(buffer);
theWorld.draw(buffer);
buffer.display(theCanvas.getGraphics());
// buffer.displayGLOnly();
}
public void run() {
while (keepGoing) {
if (joystick != null) {
theCamera.moveCamera(Camera.CAMERA_MOVEIN, joystick.getYAxisValue());
}
draw();
try {
Thread.sleep(50);
}
catch (InterruptedException e) {}
}
}
public void stop() {
keepGoing = false;
}
public void destroy() {}
}