As usual, thanks a whole lot, Egon. I appreciate all your work, and your engine really rocks.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menuimport 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() {}
}
Page created in 0.023 seconds with 9 queries.