Why not just bundle the jPCT library in the JAR along with the Applet?
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 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();
}
.....
Quote from: "Melssj5"well 10,10,10 is not white, is almost black, anyway you should see something, let me check the code.Well, whenever I was rendering in software mode, 10, 10, 10 was perfect (sometimes even too bright).
import java.awt.*;
import java.awt.event.*;
import com.threed.jpct.*;
import com.threed.jpct.util.*;
public class Hardware3D {
int fps = 60;
int gameW = 640;
int gameH = 480;
boolean running = true;
World world;
Camera camera;
FrameBuffer buffer;
KeyMapper keyMapper;
TextureManager texMan;
Object3D object;
public Hardware3D() {
texMan = TextureManager.getInstance();
Config.glWindowName = "Hardware 3D";
Config.glSetDesiredVideoMode(32, 16, 60, false);
buffer = new FrameBuffer(gameW, gameH, buffer.SAMPLINGMODE_NORMAL);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
world = new World();
camera = world.getCamera();
world.addLight(new SimpleVector(0, 0, -10), new Color(100, 100, 100));
texMan.addTexture("block", new Texture("Block.png"));
object = Loader.load3DS("Block.3ds", 1f)[0];
object.setTexture("block");
world.addObject(object);
world.buildAllObjects();
camera.setPosition(new SimpleVector(0, 0, -5));
keyMapper = new KeyMapper();
Render();
}
public void ExitNow() {
System.exit(-1);
}
public void Render() {
while(running) {
buffer.clear();
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
Controls();
GameLoop();
try {
Thread.currentThread().sleep(1000/fps);
} catch(InterruptedException e){}
}
ExitNow();
}
public void Controls() {
int k = keyMapper.poll().getKeyCode();
if (k == KeyEvent.VK_ESCAPE) running = false;
}
public void GameLoop() {
}
public static void main(String args[]) {
new Hardware3D();
}
}
import java.awt.*;
import java.awt.event.*;
import com.threed.jpct.*;
import com.threed.jpct.util.*;
public class Hardware3D {
int fps = 60;
int gameW = 640;
int gameH = 480;
boolean running = true;
World world;
Camera camera;
FrameBuffer buffer;
KeyMapper keyMapper;
TextureManager texMan;
Object3D object;
public Hardware3D() {
texMan = TextureManager.getInstance();
Config.glWindowName = "Hardware 3D";
Config.glSetDesiredVideoMode(32, 16, 60, false);
buffer = new FrameBuffer(gameW, gameH, buffer.SAMPLINGMODE_NORMAL);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
world = new World();
camera = world.getCamera();
texMan.addTexture("block", new Texture("Block.png"));
object = Loader.load3DS("Block.3ds", 1f)[0];
object.setTexture("block");
world.addObject(object);
world.buildAllObjects();
camera.setPosition(new SimpleVector(0, 0, -10));
keyMapper = new KeyMapper();
Render();
}
public void ExitNow() {
System.exit(-1);
}
public void Render() {
while(running) {
buffer.clear();
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
Controls();
GameLoop();
try {
Thread.currentThread().sleep(1000/fps);
} catch(InterruptedException e){}
}
ExitNow();
}
public void Controls() {
int k = keyMapper.poll().getKeyCode();
if (k == KeyEvent.VK_ESCAPE) running = false;
}
public void GameLoop() {
}
public static void main(String args[]) {
new Hardware3D();
}
}
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)
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();
}
}
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);
public void collision(CollisionEvent e) {
System.out.println("HIT!");
}
public boolean requiresPolygonIDs() {
return false;
}
Page created in 0.031 seconds with 12 queries.