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.


Messages - Jamison

Pages: [1]
1
News / Applets and OpenGL
« on: September 29, 2006, 05:05:28 pm »
Why not just bundle the jPCT library in the JAR along with the Applet?

2
Support / Paradroidz question...
« on: August 31, 2006, 06:09:53 pm »
Okay, I'll play around with the settings. I appreciate the help. Hopefully I can get my desired effect.

3
Support / Paradroidz question...
« on: August 31, 2006, 08:24:12 am »
But what about the dynamic lights? Such as the red light surrounding the player droid (and the blue light surrounding it when pressing RMB). And also the alert lights.

4
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.

5
Feedback / What motivates you to move on~?
« on: August 26, 2006, 05:06:01 pm »
If game development is in you, you'll continue to learn new things, study game dev, read books on game programming, graphics, AI, and/or whatever else. My oppinion is, you can't really force yourself to program games - well maybe if you do, it won't last long enough.

What motivates me? The fact that I love game programming and 3D graphics modelling, and one day, I want to become a professional game developer; it's my dream. So, look out for my name as the newest member of EA Games' developers team! Hehe, just kidding.

6
Support / Hardware Renderer Error
« on: August 23, 2006, 12:55:20 am »
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).

Here's the code:
Code: [Select]
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();
}
}

(I moved the camera forward by 5 meters just because the model was too far back - it made no rendering differance except -5m is closer.)

EDIT:
Note that I was playing around with the lights and remember Config.setAmbientLight() and it looks better with ambient light color 200, 200, 200.

7
Support / Hardware Renderer Error
« on: August 23, 2006, 12:47:02 am »
Okay, I added a white light (10, 10, 10) at position 0, 0, -3, and also tried it at 0, 0, -10. Still nothing... I'm stumped. :cry:

EDIT: Apparently the light colors needed to be higher values than software mode, because I changed the light color to 100, 100, 100 and it works now!!!

8
Support / Hardware Renderer Error
« on: August 23, 2006, 12:40:47 am »
1. Yes, the view is far enough back (since it renders at that same distance in software mode, and the model's size is 2m).

2. I didn't think lights were required. In software mode it renders without lights, or is OpenGL differant?

9
Support / Hardware Renderer Error
« on: August 23, 2006, 12:35:00 am »
Thank you guys for the reply. After I found your Paradroidz source and scanned it for about 2 hours, I figured out that my Thread was causing the problem (like you both said), but now I have another... nothing is being rendered onto the screen. Here's my new and updated code:
Code: [Select]
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();
}
}

Now what am I doing wrong?

Sorry if it seems like I'm an idiot with jPCT, but it's quite hard without any tutorials. :(

10
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.

11
Support / CollisionListener - it won't work.
« on: August 21, 2006, 01:11:56 am »
Oh... I didn't realize I had to call checkCollisionXXXX(). Thanks, I'll try that.

Btw, you should write a tutorial or something for jPCT - I can't find any and it'd be nice to have. ;)

12
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]