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 - manumoi

Pages: [1]
Support / merging objects and keeping translation
« on: September 17, 2007, 03:56:30 pm »
Hello everybody, got a little problem

I m doing more or less a tile based level editor. Each tile is refering to an Object3D... For some kind of tile I will need to do the combination of two Objects. I will naturally merge them. But it seems that mergeObjects doesn t keep a previous translation aimed at positioning the first object depending on the second.
For instance I have two objects : a square and a tree, and i want to obtain one final object (the tree in the middle of the square). Even if i use different combinations of setOrigin setCenter or translate, after merging, the tree remains at one corner of my square.

Unfortunately i have to have only one Object3D as a result so i can t use a child-parent relation between 2 Object3D.
So my questions are :
Do i correctly understand that merge object will not keep previous translation ?  (which i can understand)
- If yes, is there a way to do something similar and to obtain only one final object,  ???
- if no, what is the exact process behind merge object in order that I understand where my problem is.  ???


Support / texture problem when having 2 worlds running
« on: July 24, 2007, 01:18:17 am »

Got a strange thing. and i don t know if it is a bug of the TextureManager or not

I have an app with 2 different world objects (rendered using the same loop in two different canvas using AWTGLRenderer). One is supposed to show the selected object while the other one is displaying the whole map.

I don t know why but i am unable to have the same texture (registered in the TextureManager displayed in both world).

When texture are different there is no problem at all... I have spent hours checking my code and it seems to be correct, the good texture indice is called in order to paint a polygon...
In fact the first world where a texture will be called to be displayed will not be a problem. The problem will occur in the second one (i tested the order and the problem can be inversed)

So 3 questions.

Did anyone already do something similar that worked?

Do you have any idea what may cause this problem?

Here is a screenshot

here is the code i use to register texture in the texture manager

Code: [Select]
protected void addTexture(String textureName, String textureFile){
if (!TextureManager.getInstance().containsTexture(textureName)){
    Texture tmpTexture = new Texture(Constants.TEXTURE_PATH+textureFile);
    TextureManager.getInstance().addTexture(textureName, tmpTexture);

    protected void addTexture(String textureFile){

Here is my general loop:
Code: [Select]
public void startLoop(){
while (true){
            myPanel3D.updateLoop();   // panel with the first JPCT world
    menuTabbedPanel.getMyPreviewPanel().updateLoop(); // panel with the second JPCT world
            // both these panels have a JPCTPanel super class that implements the updateLoop method
    catch (InterruptedException ie){

and here is the update loop method

Code: [Select]
    public void updateLoop(){

So any idea????


Support / two small questions about textures
« on: July 11, 2007, 07:42:15 pm »

When using multi texturing, supposing that i have one base texture and an upper texture with transparent parts (a square that i could use for showing the borders of a tile), is it possible to replace only the visible parts of the upper texture? I didn t find any mode for this.

Also, looks dummy to me but is it possible to access texture names or IDs from an Object3D?



Support / Too much Triangle in an object?
« on: November 29, 2006, 10:17:07 pm »
Hello Folks

I dont remember. Is there a way to expand the number of Triangle per object? something in Config???

java.lang.ArrayIndexOutOfBoundsException: 20800
        at com.threed.jpct.Object3D.addTriangle(Unknown Source)
        at com.threed.jpct.Object3D.addTriangle(Unknown Source)
        at com.threed.jpct.Object3D.addTriangle(Unknown Source)
        at com.threed.jpct.Object3D.addTriangle(Unknown Source)


Feedback / Yop yop...
« on: July 03, 2006, 03:41:57 pm »
Hey Egon, what about a Germany-France in final of the Worldcup ? Could be pretty cool  :P  8)

Projects / Idea
« on: May 03, 2006, 07:41:51 pm »

while surfing the net, i found a website where a guy finally decoded the md4 format, a file for skeletal animation. He implemented a loader in C++ for this kind of file.

I think it would be very interesting to have access to skeletal animations. However i m not an expert in 3D stuff, i didn t recently used C++ and i have other projects and important deadlines.  So I don t think I will be able to learn and do all this stuff alone in a decent timeline.

My idea is why not using all the good willing people of the JPCT community, working as a virtual team and implementing a function for md4 models in the JPCT Loader class ....  The more we will be the easier. A good way to learn from others also.

Here is the website


Projects / My project
« on: May 03, 2006, 01:22:29 am »
I guess it s also time for me to talk a little bit about my own project.

Well I m trying to create what is called an Intelligent Tutoring System (i.e. a system that is supposed to teach you something but that has the ability to adapt its teaching depending on a dynamically created profile of the user).

I am interested in creating a RPG- like learning environment because some theories make me suspect that it could have a very high value in term of user motivation

Currently I am using JPCT for 3D rendering, JADE a multi agent platform is used for dealing with the supposed-intelligent part of the system (collaborative work of agents --> the goal is to interact, according to pedagogical strategies, with a learner when this one needs information)
I m also beginning to use JESS (a rule based engine) to help agents behave in a more intelligent way.... (but i can t tell more or i will have to kill you).
Finally, this is a client server architecture based on the NIO package (inter agents communication inside jade use RMI but it s too slow to deal with world logic using this technic).
The system is not far from its first usable version...

Here are some screenshots

A general view from the client interface

Some part of a map

again some part of the map from a different point of view

A test to make agents discuss with users

PS:  if someone has low polygon models (md2, 3ds) more or less related to the greek mythology, i would be very interested by it.

For those who are interested in :

JADE : (LGPL license)
JESS : (a license is requested but it s free one if it is for academic purpose)

Support / How to get a 2D position related to an Object3D
« on: April 10, 2006, 08:51:29 pm »
Dummy question i suppose :shock: . I would like to know how you do to have the 2D position (in the canvas) of a 3D object as it is done in Karga or technopolis to find a position in order to display words said by avatars. I can pick objects (i.e. having coordinates and finding object) but i didn t find the way to do the inversed process

And another small question, do you have a sample of a code used to do transparent dialog panels (in the GL rendering way)?

Thanks all,


Support / Questions concerning transparent panels / particle systems
« on: February 20, 2006, 09:08:26 pm »
Hello everybody :P,

I would like to know what is the correct way people use to do transparent option/text panels (with or without AWTGLRENDERER). Do you use awt panels with an opaque color? Do you blit everything? Is it performance killing?
(if you have some code to show, that would be appreciated).

And another question for Egon, I ve seen that you did a particle system with JPCT and you put it in demos. I m not familiar with that concept but I may be interested in using such a thing. Is it possible to see the code if it isn t lost? If not, do you have good resources on how to design it with java? Concerning the particle, do each of them are Object3D? and again, have you made some test concerning performance?

Thanks for all,


Support / small collision detection problem
« on: December 13, 2005, 10:48:45 pm »
Hello, long time i haven t post anything... I m back on my jpct project and try to fix some small bugs.

I have this one:
When i want to have some gravity effects, I use this lines (more or less taken from one of JPCT demos
Code: [Select]

public void placeModel(){
SimpleVector dropDown = this.getYAxis();
Matrix rotMat = this.getRotationMatrix();
distanceToGround = terrain.calcMinDistance(this.getTransformedCenter(), new SimpleVector(0,1,0), 4*30);
if (distanceToGround!= Object3D.COLLISION_NONE){

It makes me the model fit perfectly with the ground but  it also affects my movements (i.e. whether i push forward or backward,  i always go in the same direction)

Here are my forward and backward functions :

Code: [Select]

private void moveForward(){
SimpleVector a = this.getZAxis();
a = this.checkForCollisionEllipsoid(a,ELLIPSOID_RADIUS, 5);

    private void moveBackward(){
SimpleVector a = this.getZAxis();
a = this.checkForCollisionEllipsoid(a,ELLIPSOID_RADIUS, 5);
animating = true;

When i suppress the following lines from my placeModel function, i have no problem with my movements, but (of course) no gravity. Do you see where my mistake is?

Code: [Select]

terrain.calcMinDistance(this.getTransformedCenter(), new SimpleVector(0,1,0), 4*30);
if (distanceToGround!= Object3D.COLLISION_NONE){

Support / about md2 and texture generation
« on: November 11, 2005, 11:26:03 pm »
Does anyone know a good md2 modeler and, more important, a freeware to redesign the texture of a specific md2 model?
I heard about milkshape...


Support / error loading in Linux
« on: November 10, 2005, 10:14:09 pm »
hello, I just tried to load my jpct application on a linux computer (for the first time at my university and i got the following exception. This application works just fine on a windows computer.

Code: [Select]

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: org.lwjgl.LWJGLException: Could not create a direct GLX context
        at org.lwjgl.opengl.AWTGLCanvas.paint(
        at org.lwjgl.opengl.AWTGLCanvas.update(
        at sun.awt.RepaintArea.updateComponent(
        at sun.awt.X11.XRepaintArea.updateComponent(
        at sun.awt.RepaintArea.paint(
        at sun.awt.X11.XComponentPeer.handleEvent(
        at java.awt.Component.dispatchEventImpl(
        at java.awt.Component.dispatchEvent(
        at java.awt.EventQueue.dispatchEvent(
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(
        at java.awt.EventDispatchThread.pumpEvents(
        at java.awt.EventDispatchThread.pumpEvents(
Caused by: org.lwjgl.LWJGLException: Could not create a direct GLX context
        at org.lwjgl.opengl.LinuxContextImplementation.nCreate(Native Method)
        at org.lwjgl.opengl.LinuxContextImplementation.create(
        at org.lwjgl.opengl.Context.<init>(
        at org.lwjgl.opengl.AWTGLCanvas.paint(
        ... 13 more

I know this is a LWJGL error but do you have any idea?

Support / help on an LWJGL exception
« on: July 27, 2005, 12:53:19 am »
hello my question is not a full jpct question but maybe...

I have a JPCT application with a panel showing a AWTGLCanvas and next to it a JEditorPane...

When clicking on some object in my JPCT panel, i ask  the JEditorPane to load different HTML Page at different url... It works fine 1 time, 2 times... and then i have this exception. I tried to look at LWJGL doc but i m not familiar. I don t fully undertand every processes acting when i do such operation... So, if anybody has an idea on how to deal with it, i would greatly appreciate....

here is the exception
Code: [Select]

Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: From thread Thread[AWT-EventQueue-0,6,main]: Thread[AWT-EventQueue-0,6,] already has the
 context current
        at org.lwjgl.opengl.Context.checkAccess(
        at org.lwjgl.opengl.Context.makeCurrent(
        at org.lwjgl.opengl.AWTGLCanvas.paint(
        at org.lwjgl.opengl.AWTGLCanvas.update(
        at sun.awt.RepaintArea.updateComponent(Unknown Source)
        at sun.awt.RepaintArea.paint(Unknown Source)
        at Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at Source)

and here is the code of my picking method
Code: [Select]

  public void pickingObject(int mouseX, int mouseY){
SimpleVector ray=Interact2D.reproject2D3D(camera, buffer, mouseX, mouseY);
  int[] res=Interact2D.pickPolygon(theWorld.getVisibilityList(), ray);
if (res!=null) {
   Object3D pickedObj=theWorld.getObject(Interact2D.getObjectID(res));

loadURL method is a call to the setPage(String s) method of JEditorPane



Support / launching problem
« on: July 20, 2005, 10:56:14 pm »
Hello folks,

I have a problem that i can t fix....

My app run correctly when i launch it with all necessary arguments (i.e. name, name of the server, port of the server, position at the beginning)  in the command line.
Here are some screenshots

What appears just after launching the app

a upper view of the same map

The code of my main function in my Test class is the following:

  public static void main(String [] args){
   Test t =new Test(args);   
and an example of command line would be

java  -Xmx128m Bob pamela 9000 520 520

I decided to add a form in a graphic menu (inside a JFrame) to make it easier for a client to enter new values... When I click on a button, the Test class will be launched.

The code is very basic

   public void actionPerformed(ActionEvent e){
          String [] args = new String [5];
          args[0] = loginText.getText(); // JTextField containing the login
          args[1] = serverIDText.getText(); // JTextField containing the server name
          args[2] = serverPortText.getText(); // // JTextField containing the lserver port
          args[3] = ""+520;
          args[4] = ""+520;
          myMocas.closeMocas(); // i tried to close my frame either with calling dispose() or with using setVisible(false)
          Test t = new Test(args);

When I launch my app using this JFrame, there are many problems.  Only the panel containing the JPCT view is started (the black one on the left and the white one on the down aren't... The keymapper seems not to be loaded so i have no control on my avatar... And my system is slow down drastically.
I put some "System.out..." in my code to see where the application had problems... But the code seems to be read correctly... the client is correctly connected to the server and my game loop is running.
I checked if the args value that were passed to the Test class were corrects... and they are...

I tried with software or hardware rendering. Here are some config information for the buffer of my jpct Panel

//   buffer = new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY);
buffer = new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);

I tried 2 different configs by inverting red and green lines. blue lines remained in both configs. I don t know if it can be related to that but in fact, there was no runtime difference.

So I m lost. Is there a problem launching a JPCT app from another JFrame? If so, is there a way to bypass it?

Thanks you,


Support / collision detection
« on: July 04, 2005, 11:49:13 pm »
Hello, i m having a problem with collision detection...
I create a terrain object with many triangles.

then i call this function

 public void setupTerrainOctreeAndCollision(){
   OcTree oc = new OcTree(terrain, 100, OcTree.MODE_OPTIMIZED);
   Config.collideOffset = 250;

After that i create an avatar with an md2 file

public void loadModel(){
   model=Loader.loadMD2(modelPath+"tris.md2", 0.5f);

In this configuration, collisions occur and my avatar can t go through walls... But the problem is it can go through others avatars... When i try to put:


there is no more collision and i don t understand why

Do you have an idea ???

PS :

my forward method is :

// ELLIPSOID_RADIUS is defined as in the FPS example
 private void moveForward(){
   SimpleVector a = model.getZAxis();
   a = model.checkForCollisionEllipsoid(a,ELLIPSOID_RADIUS, 5);

Tell me if you need something else to understand my code

Pages: [1]