Main Menu
Menu

Show posts

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 Menu

Messages - Redstop

#1
Support / JPCT Hello World
June 11, 2006, 10:21:15 PM
Thanks for your reply.

For testing I'm just using a JFrame and putting everything in paint for simplicity (except for the TextureManager because I guess there's no point adding the same texture repeatedly).

I don't need any animation at this point, just a single rendered image which later will be generated on a server with no video card (hence the need for a software renderer).

I've added the w.buildAllObjects(); as you suggest, but I'm still not getting anything.

I'll take a look at your maze example and see if I can extract the essentials.

Regards, Redstop.
#2
Support / JPCT Hello World
June 11, 2006, 01:12:16 PM
JPCT looks like just what I need, but I'm having trouble putting together a minimal sample to explore. The two sample programs go far beyond what I need and I'd rather start from a "Hello World" sample and build up. Can anyone point me to a simple example that shows just a primitive (eg. a box) using the software renderer?

Here's my code, which doesn't work:


// this is done once, just in case shapes must have a texture
// must they?
TextureManager tm = TextureManager.getInstance();
tm.addTexture("default", tm.getDummyTexture()); // should be white

// here's the paint:
public void paint(Graphics g)
{
 Dimension sz = getSize();
 World w = new World();

 // just copied from the sample
 w.getLights().setOverbrightLighting(
     Lights.OVERBRIGHT_LIGHTING_DISABLED);
 w.getLights().setRGBScale(Lights.RGB_SCALE_2X);
 w.setAmbientLight(25, 30, 30);

 // these just copied from the car example
 // no idea if ambient light is sufficient
 w.addLight(new SimpleVector(0, -150, 0), 25, 22, 19);
 w.addLight(new SimpleVector(-1000, -150, 1000), 22, 5, 4);
 w.addLight(new SimpleVector(1000, -150, -1000), 4, 2, 22);

 Object3D box = Primitives.getBox(100, 100);
 box.setOrigin(new SimpleVector(200,200,200));
 box.setVisibility(true); // is this the default?
 box.setTexture("default"); // will it take dummy texture otherwise?
 w.addObject(box);
 w.getCamera().lookAt(box.getOrigin());

 FrameBuffer buffer=new FrameBuffer(sz.width, sz.height,  
     FrameBuffer.SAMPLINGMODE_NORMAL);
 buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);
   
 buffer.setBoundingBoxMode(FrameBuffer.BOUNDINGBOX_NOT_USED);
 // I found staring at an empty black screen
 // after each attempt at getting this to work too depressing
 buffer.clear(Color.yellow);
 w.renderScene(buffer);
 buffer.update();
 buffer.display(g);
}


All I get is a blank (yellow) screen.
What I want to see is a white box on a yellow background.

Any help appreciated. Thanks, Redstop.