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.


Topics - Jamison

Pages: [1]
1
Support / Paradroidz question...
« on: August 31, 2006, 06:33:45 am »
How did you achieve such perfect lighting in Paradroidz? I looked through your level code, and your placing walls by referancing a text file and placing them accordingly - so your levels are not in one 3DS object file. Okay anyway, so I tried loading my walls and floors the same way, individually placing them (I already wanted to do it this way before I even found the Paradroidz source) accordingly. But my lighting is all messy. Take a look: http://www.jamisongames.info/Screenshot.jpg

Here's some of my code:
Code: [Select]
String map[] = {
"    ********",
"    *......*",
"  ***......*",
"  *........***",
"********.....*",
"*......*.....******",
"*......D..........*",
"*......*..........*",
"********..........*",
"   *..............*",
"   ****************"
};

.....

public void Init() {
ObjectHolder.init();
world.setAmbientLight(200, 200, 200);
camera.rotateCameraX((float)Math.toRadians(32));
camera.setPosition(new SimpleVector(10, -10, -5));

world.addLight(new SimpleVector(10, -0.5, 10), 255, 0, 0);
world.setLightDiscardDistance(0, 5);

BuildLevel();
}

public void BuildLevel() {
int mapH = map.length;
for (int i=0; i<mapH; i++) {
int mapW = map[i].length();
for (int j=0; j<mapW; j++) {
char c = map[i].charAt(j);
if (c == '*') {
Object3D wall = new Object3D(ObjectHolder.getObject(0));
float bBox[] = wall.getMesh().getBoundingBox();
wall.translate(bBox[1]*j, 0, bBox[5]*i);
world.addObject(wall);
}
if (c == '.') {
Object3D floor = new Object3D(ObjectHolder.getObject(1));
float bBox[] = floor.getMesh().getBoundingBox();
floor.translate(bBox[1]*j, 0, bBox[5]*i);
world.addObject(floor);
}
}
}
world.buildAllObjects();
}

.....

The "....." represents code that's not necessary to be shown.

2
Support / Hardware Renderer Error
« on: August 22, 2006, 07:50:18 pm »
Hello all,

I'm trying to render in OpenGL Hardware mode, however, the following is thrown as soon as buffer.clear() is called.
Code: [Select]
java.lang.NullPointerException
        at org.lwjgl.opengl.GL11.glClearColor(GL11.java:562)
        at com.threed.jpct.GLRenderer.execute(Unknown Source)
        at com.threed.jpct.FrameBuffer.clearHardware(Unknown Source)
        at com.threed.jpct.FrameBuffer.clear(Unknown Source)
        at com.threed.jpct.FrameBuffer.clear(Unknown Source)
        at Hardware3D.Render(Hardware3D.java:35)
        at Hardware3D.run(Hardware3D.java:27)
        at java.lang.Thread.run(Thread.java:536)


Here is my code:
Code: [Select]
import java.awt.*;
import com.threed.jpct.*;

public class Hardware3D implements Runnable {
int fps = 60;
int gameW = 640;
int gameH = 480;

World world;
Camera camera;
FrameBuffer buffer;

public Hardware3D() {
buffer = new FrameBuffer(gameW, gameH, buffer.SAMPLINGMODE_NORMAL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);

world = new World();
camera = world.getCamera();

(new Thread(this)).start();
}

public void run() {
while(true) {
try {
Render();
GameLoop();
Thread.currentThread().sleep(1000/fps);
} catch(InterruptedException e){}
}
}

public void Render() {
buffer.clear();
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
}

public void GameLoop() {
}

public static void main(String args[]) {
new Hardware3D();
}
}


I could not find any tutorial or any kind of information on how to render in OpenGL Hardware mode, so I looked through the documentation. I'm assuming I did something wrong here. I'd appreciate any help you can give me.

3
Support / CollisionListener - it won't work.
« on: August 20, 2006, 05:36:02 am »
Hello all. I'm having trouble getting collision detection with the CollisionListener to work. Here's some code for two objects - the second one being the object that collides with the first object.
Code: [Select]
block = Loader.load3DS("Block.3ds", 1f)[0];
block.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
block.translate(0, 3, 0);
block.setTexture("block");
world.addObject(block);

block2 = Loader.load3DS("Block.3ds", 1f)[0];
block2.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
block2.addCollisionListener(this);
block2.translate(0, -3, 0);
block2.setTexture("block");
world.addObject(block2);

this is a JPanel which implements CollisionListener, and here's the methods for it.
Code: [Select]
public void collision(CollisionEvent e) {
System.out.println("HIT!");
}

public boolean requiresPolygonIDs() {
return false;
}

But whenever the second object (obviously) collides with the first object, it does not print out "HIT!" as it should. What's wrong here? Please help me.

Thank you,
Jamison

Pages: [1]