oh, i'm sorry my grammar isn't very good
what i'm trying to do is render an md2 model in a java applet on my website. now after reading all of your excellent tutorials and examples, i have managed to do the following:
load an md2 model via java application
load a 3d box via java applet (your example)
what i want is to be able to get my program i found that loads a md2 model in a java application turned into loading a md2 model via java applet.
basically, i want to know how to transform the code below so it will work as a java applet instead of an application. because when i try to tinker it, it gives me a ton of different errors i don't understand how to fix. :-(
import com.threed.jpct.*;
import javax.swing.*;
public class lawltest {
private String[] textures = {"body"};
private String thingName = "body";
private int thingScale = 1;
private World world;
private FrameBuffer buffer;
private Object3D thing;
private TextureManager tm = TextureManager.getInstance();
public static void main(String[] args) throws Exception {
new lawltest().loop();
}
public lawltest() throws Exception {
world = new World();
world.setAmbientLight(150, 150, 150);
for (int i = 0; i < textures.length; ++i) {
tm.addTexture(textures[i] + ".png", new Texture("res/" + textures[i] + ".png"));
}
TextureInfo ti=new TextureInfo(tm.getTextureID(textures[0] + ".png"));
thing = loadModel("res/" + thingName + ".md2", thingScale);
thing.setTexture(ti);
world.addObject(thing);
world.getCamera().moveCamera(Camera.CAMERA_MOVEOUT,100);
world.getCamera().lookAt(thing.getTransformedCenter());
}
private void loop() throws Exception {
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_GL_AA_2X);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
while (!org.lwjgl.opengl.Display.isCloseRequested()) {
buffer.clear(java.awt.Color.BLUE);
world.renderScene( buffer );
world.draw( buffer );
buffer.update();
buffer.displayGLOnly();
thing.rotateY(0.02f);
thing.rotateX(0.01f);
Thread.sleep(10);
}
buffer.dispose();
System.exit(0);
}
private Object3D loadModel(String filename, float scale) {
Object3D temp = Loader.loadMD2(filename, scale);
temp.build();
return temp;
}
}