Maybe I'm just retarded? Or just a retarded beginner, but why the hell doesn't this work then?
Error I receive:
Loading file body.md2
[ Sat Sep 03 20:55:00 PDT 2011 ] - ERROR: Couldn't read file body.md2
[ Sat Sep 03 20:55:00 PDT 2011 ] - ERROR: Not a valid MD2-file!
Magic number: -1
Version: -1
Skin width: -1
Skin height: -1
Frame size: -1
Number of skins: -1
Number of Vertices: -1
Number of Texture coordinates: -1
Number of triangles: -1
Number of GL-commands: -1
Number of Frames: -1
java.lang.NegativeArraySizeException
at com.threed.jpct.Loader.loadMD2(Unknown Source)
at com.threed.jpct.Loader.loadMD2(Unknown Source)
at applettest.init(applettest.java:27)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
The freakin model is there, so why is it having problems loading it? Thanks again for the help guys.
Code Select
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.IRenderer;
import com.threed.jpct.Loader;
import com.threed.jpct.Object3D;
import com.threed.jpct.World;
public class applettest extends JApplet implements Runnable
{
private static final long serialVersionUID = 1L;
private FrameBuffer buffer = null;
private World world = null;
private boolean loop = true;
private Object3D thing;
Canvas myCanvas;
public void init()
{
world = new World();
World.setDefaultThread( Thread.currentThread() );
thing = Loader.loadMD2("body.md2", 1);
thing.build();
world.addObject(thing);
buffer = new FrameBuffer( 600, 800, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY );
buffer.disableRenderer( IRenderer.RENDERER_SOFTWARE );
myCanvas = buffer.enableGLCanvasRenderer();
add( myCanvas, BorderLayout.CENTER);
myCanvas.setVisible( true );
new Thread(this).start();
}
@Override
public void paint( Graphics g )
{
buffer.clear(Color.black);
world.renderScene( buffer );
world.draw( buffer );
buffer.update();
buffer.displayGLOnly();
myCanvas.repaint();
}
@Override
public void run()
{
while (loop)
{
repaint();
try{
Thread.sleep(10);
}catch(Exception e){}
}
}
}
Error I receive:
Loading file body.md2
[ Sat Sep 03 20:55:00 PDT 2011 ] - ERROR: Couldn't read file body.md2
[ Sat Sep 03 20:55:00 PDT 2011 ] - ERROR: Not a valid MD2-file!
Magic number: -1
Version: -1
Skin width: -1
Skin height: -1
Frame size: -1
Number of skins: -1
Number of Vertices: -1
Number of Texture coordinates: -1
Number of triangles: -1
Number of GL-commands: -1
Number of Frames: -1
java.lang.NegativeArraySizeException
at com.threed.jpct.Loader.loadMD2(Unknown Source)
at com.threed.jpct.Loader.loadMD2(Unknown Source)
at applettest.init(applettest.java:27)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
The freakin model is there, so why is it having problems loading it? Thanks again for the help guys.