sigh....
I've been banging my head over this a good portion last night. I've tried scouring through the support section. I've seen some information but they don't seem to work. I'm missing something obvious I'm sure. I've reduced my work to use Pauls jPCTGears demo as the basics. Can anyone point out whats wrong.
this program runs through applet loader and is in hardware.
import java.applet.*;
import javax.swing.JApplet;
import java.awt.*;
import com.threed.jpct.*;
public class Editor extends Applet implements Runnable{
private boolean exit = false;
private World world;
private FrameBuffer buffer;
private Camera camera = null;
private int width = 640;
private int height = 480;
private boolean loop=true;
Canvas canvas;
private EditorInput input;
public void init(){
world = new World();
World.setDefaultThread( Thread.currentThread() );
world.setAmbientLight(50, 250, 50);
world.getLights().setOverbrightLighting (Lights.OVERBRIGHT_LIGHTING_DISABLED );
world.getLights().setRGBScale( Lights.RGB_SCALE_2X );
world.setAmbientLight( 150, 150, 150 ); // just trying to get anything besides black screen
// Create a main light-source:
world.addLight( new SimpleVector( 50, -50, 300 ), 20, 20, 20 );
// prepare buffer
buffer = new FrameBuffer( width, height, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY );
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
// prepare canvas
canvas = buffer.enableGLCanvasRenderer();
add( canvas, BorderLayout.CENTER);
canvas.setVisible( true );
//canvas.addMouseListener( input );
//canvas.addMouseMotionListener( input );
TextureManager.getInstance().addTexture("box", new Texture("box.jpg"));
//test object
Object3D box = Primitives.getBox(3f, 2f);
box.setTexture("box");
box.setEnvmapped(Object3D.ENVMAP_ENABLED);
box.build();
world.addObject(box);
world.buildAllObjects();
Camera camera = world.getCamera();
camera.setPosition(10f,10f,10f);
camera.lookAt(new SimpleVector(0,0,0)); // look at center of world. assuming box defaults to 0.0.0
new Thread(this).start();
}
public void run() {
while (loop) {
this.repaint();
try {
Thread.sleep(10);
} catch(Exception e) {
//Don't care...
}
}
}
public void paint(Graphics g){
buffer.clear(); // erase the previous frame
world.renderScene( buffer );
world.draw( buffer );
buffer.update();
buffer.displayGLOnly();
canvas.repaint(); // Paint the canvas onto the applet (hardware mode)
}
@Override
public void destroy()
{
loop=false;
}
}
yeah this code doesn't work. The TaskManager also doesn't report much activity from Firefox or Java. Which leaves me to believe
that no real repainting is being done.