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

Pages: 1 2 [3] 4 5 ... 49
31
Support / Re: Performance problems
« on: March 30, 2009, 04:11:59 pm »
Hi, I tested it on my laptop using firefox and IE and jre1.6.0_12. I runned it from another 2 machines and the GLCanvas doesnt appeared. Thats strange..... I put an IPaintListener on the FrameBuffer and put some outputs, on the machines that the glcanvas is visible the outputis being printed but ont eh other machines where the GLCanvas is not visible the output is not being printed. Something have to be buggy with it. Now I am using the software renderer which is more stable but is not as fast as I wish it were.

32
Support / Re: Performance problems
« on: March 29, 2009, 12:13:19 am »
Hi, some news on the topic....

I made a copy of my applet and changed the exteds JApplet for JFrame and it runs great.... and it also ran well when chenged to sw rendering. I have not changed the Rendering Thread/EventManagmentThread just changed the JApplet for JFrame.

Should this be reported as a bug???? Only happens on Applets with GLCanvas.

33
Support / Re: Performance problems
« on: March 28, 2009, 11:55:54 pm »
I changed it to render in software instead of inside a GLCanvas (minor change) and the delay does not appear. COuld this be some issue the the new lwjgl with glCanvas????

34
Support / Re: Performance problems
« on: March 28, 2009, 09:58:28 pm »
Paul, the problem is not abouth that beucasse I was happening before adding that piece of code of the listener. Egon or Paul....Do you have a machine with Tomcat and mysql to send a test case??

35
Support / Re: Performance problems
« on: March 28, 2009, 08:59:44 pm »
The outputs are also being stopped for that period of time.

36
Support / Performance problems
« on: March 28, 2009, 03:57:55 pm »
Hi, ai am having problems with performance, from time to time (almost each 10 seconds) the CPU usage goes to 100% on the applet and then it stops responfing for 5 or 6 seconds, and then continues on the same way. Any ideas????

I am using a Centrino 1.6, 1Gb RAM, ATIX600, and I am running a GL Canvas inside an applet.


The code is quite simple, The class that does all the Rendering is:

Code: [Select]

/*
 * RenderThread.java
 *
 * Created on 1 de noviembre de 2005, 22:32
 */

package visor;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.DataInputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.StringTokenizer;

import javax.swing.ImageIcon;

import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.IRenderer;
import com.threed.jpct.Interact2D;
import com.threed.jpct.Loader;
import com.threed.jpct.Matrix;
import com.threed.jpct.Object3D;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureInfo;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
import com.threed.jpct.util.KeyMapper;
import com.threed.jpct.util.KeyState;
/**
 *
 * @author  Gold Oozaru
 * @version
 */
public class RenderThread extends Thread implements MouseListener{
    static boolean OGL;

    World mundo;
    FrameBuffer buffer;
    KeyMapper mapaTeclas;
    KeyState estadoTeclas;
    TextureManager manejadorTexturas;
    Texture texturaActual;
   
    boolean izquierda;
    boolean derecha;
    boolean adelante;
    boolean atras;
    boolean luces;
    boolean salir;
   
    ArrayList paredes;
    ArrayList techos;
    ArrayList pisos;
   
    Object3D vidrios;
    Object3D otros;
    Object3D inicio;
   
    Canvas canvas;
   
    URL docBase;
   
    public Graphics g;
   
    String url="";
    String mapa="";
   
    Object3D seleccionado=null;
   
    /** Creates new RenderThread */
    public RenderThread(World am, FrameBuffer ab, KeyMapper ak, Canvas ac, String nombreMapa, String aurl) {
    //---------------------Hacer el renderThread
   
        OGL=false;
       
        mundo=am;
        buffer=ab;
        mapaTeclas=ak;
        canvas=ac;
        url=aurl;
        mapa=nombreMapa;
       
        texturas ();
        //texturasList ();
       
        pisos=new ArrayList ();
        techos=new ArrayList ();
        paredes=new ArrayList ();
       
        vidrios=new Object3D (0);
        otros=new Object3D (0);
        inicio=new Object3D (0);
       
        cargar ("mapa.3DS", 0.3f);
       
        mundo.addObject (otros);
        mundo.addObject (vidrios);
       
        addObjects (pisos, mundo);
        addObjects (techos, mundo);
        addObjects (paredes, mundo);
       
        vidrios.setTransparency(1);
       
        mundo.addObject(inicio);
       
        mundo.buildAllObjects ();
       
        mundo.getCamera().setPosition(inicio.getCenter());
        //System.out.println ("getposition ()"+mundo.getCamera().getPosition ());
        mundo.removeObject(inicio);
       
        ac.addMouseListener(this);
    }
   
    public void addObjects (ArrayList objetos, World mundo) {
    for (int i=0;i<objetos.size();i++) {
    Object3D temp=(Object3D) objetos.get(i);
    temp.setTransparency(-1);
    mundo.addObject (temp);
    }
    }
   
   
    public void cargar (String fileName, float escala) {
try {
URL link=new URL (url+"/mapas/");
System.out.println ("url: "+link.getFile());
        Object3D partes []=Loader.load3DS (link, mapa, escala);
       
        for (int i=0;i<partes.length;i++) {
            Object3D part=partes [i];
         
            part.setCenter(SimpleVector.ORIGIN);
            part.rotateX((float)-Math.PI/2);
            part.rotateMesh();
            part.setRotationMatrix(new Matrix());
            if ((i&1)==1) part.setTransparency(0);
           
            String p1="";
            String p2="";
            String p3="";
           
            StringTokenizer separador=new StringTokenizer (part.getName(), "_");
           
            try {
            p1=separador.nextToken();
            p2=separador.nextToken();
            p3=separador.nextToken();
            } catch (Exception E) {
            E.printStackTrace();
            }
           
            if (part.getName ().startsWith ("vidrio") || part.getName ().startsWith ("vidrio") || part.getName ().startsWith ("parabrisa")) {
                vidrios=Object3D.mergeObjects (vidrios, part);
            } else if (p2.startsWith ("P")) {
            Object3D temp=new Object3D (0);
            part=Object3D.mergeObjects (part, temp);
            pisos.add(part);
            } else if (p2.startsWith ("T")) {
            techos.add(part);
            } else if (p2.startsWith ("W")) {
            Object3D temp=new Object3D (0);
            part=Object3D.mergeObjects (part, temp);
            paredes.add(part);
            System.out.println ("pared agregada: "+part.getName());
            } else if (part.getName ().startsWith ("inicio")) {
            inicio=Object3D.mergeObjects (inicio, part);
            } else {
                otros=Object3D.mergeObjects (otros, part);
            }
        }
} catch (Exception E) {
E.printStackTrace();
}
    }
   
    public void run () {
       
        while (!salir) {

            if (OGL){

            buffer.clear ();
            buffer.update ();
            mundo.renderScene (buffer);
            mundo.draw (buffer);
            buffer.displayGLOnly ();

            canvas.repaint ();
            }
           
            try {
                this.sleep(40);
            } catch (Exception E) {
                this.stop ();
            }
           
            estadoTeclas=null;
           
            do {
                estadoTeclas=mapaTeclas.poll();
                if (estadoTeclas!=KeyState.NONE) {
                    obtenerEventos (estadoTeclas);
                }
            } while (estadoTeclas!=KeyState.NONE);
           
            hacerMovimientos ();
        }
       
        buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
        this.stop ();
    }
   
    public void hacerMovimientos () {
        if (izquierda) {
            moverIzquierda ();
        }
       
        if (derecha) {
            moverDerecha ();
        }
       
        if (atras) {
            Camera c=mundo.getCamera ();
            c.moveCamera (Camera.CAMERA_MOVEOUT, 6f);
        }
       
        if (adelante) {
            Camera c=mundo.getCamera ();
            c.moveCamera (Camera.CAMERA_MOVEIN, 6f);
        }
    }
   
    public void obtenerEventos (KeyState evento) {
        boolean estado=evento.getState ();
   
        if (estadoTeclas.getKeyCode ()==KeyEvent.VK_UP)
            adelante=estado;
       
        if (estadoTeclas.getKeyCode ()==KeyEvent.VK_DOWN)
            atras=estado;
       
        if (estadoTeclas.getKeyCode ()==KeyEvent.VK_LEFT)
            izquierda=estado;
       
        if (estadoTeclas.getKeyCode ()==KeyEvent.VK_RIGHT)
            derecha=estado;
       
        if (estadoTeclas.getKeyCode ()==KeyEvent.VK_ESCAPE)
            salir=estado;
       
        if (estadoTeclas.getKeyCode ()==KeyEvent.VK_SPACE)
            luces=estado;
    }

    public String getPath () {
        System.out.println (this.getClass ().getResource (""));
        return (this.getClass ().getResource ("./").getFile().replace ("%20", " "));
    }
   
    public String getURLPath (String filename) {
        return (this.getClass ().getResource (filename).getFile());   
    }
   
    public void texturas () {
    manejadorTexturas=TextureManager.getInstance ();
   
    ArrayList materiales=texturasList ();
   
    URL link=null;
try {
link = new URL (url+"/images/Texturas/");
} catch (Exception e) {
e.printStackTrace();
}
    for (int i=0;i<materiales.size();i++) {
    manejadorTexturas.addTexture (((String)materiales.get(i))+".JPG", new Texture (link, ((String)materiales.get(i))+".JPG"));
    }
    }
   
    public ArrayList texturasList () {
    try {
URL link=new URL (url+"/images/Texturas/props.txt");
URLConnection uc=link.openConnection();
DataInputStream dis=new DataInputStream (uc.getInputStream());

    System.out.println ("TEXTURAS: ");
    String texturas=dis.readLine();
   
StringTokenizer separadorMaterial=new StringTokenizer (texturas, "|");

ArrayList materiales=new ArrayList ();

while (separadorMaterial.hasMoreTokens()) {
String material=separadorMaterial.nextToken();
StringTokenizer separadorTextura=new StringTokenizer (material, ":");
materiales.add(separadorTextura.nextToken());
}
return materiales;

} catch (Exception e) {
e.printStackTrace();
return null;
}
   
    }
   
    public void cambiarTextura (String parte) {
       
       
    }
   
    public void moverIzquierda () {
        Camera temp=mundo.getCamera ();
        temp.rotateY (0.02f);
    }
   
    public void moverDerecha () {
    Camera temp=mundo.getCamera ();
         temp.rotateY (-0.02f);
    }
   
    public void renderAWT (Graphics g) {

        buffer.clear ();
        buffer.update ();
        mundo.renderScene (buffer);
        mundo.draw (buffer);
        buffer.display(g);
       
        try {
            this.sleep(60);
        } catch (Exception E) {
            this.stop ();
        }
    }

   
    public void enviarComentario (String mensaje, ImageIcon imagen) {
   
    }

public void mouseClicked(MouseEvent e) {
}

public void mouseEntered(MouseEvent e) {
}

public void mouseExited(MouseEvent e) {
}

public void mousePressed(MouseEvent e) {
}

public void mouseReleased(MouseEvent evt) {

if (seleccionado!=null)seleccionado.setAdditionalColor(Color.black);

int x=evt.getX();
    int y=evt.getY();
   
    SimpleVector ray=Interact2D.reproject2D3D(mundo.getCamera(), buffer, x, y);
    int poli[]=Interact2D.pickPolygon(mundo.getVisibilityList(), ray);
    Object3D temp=mundo.getObject(Interact2D.getObjectID(poli));
    seleccionado=temp;
    temp.setAdditionalColor(Color.RED);
}
   
}


37
Projects / Re: SS3D
« on: March 25, 2009, 03:41:12 pm »
Hi, I am back again after several months...  ;D Anyway the web part is finished and now I am implementing the 3d part with jpct. I will post some pics sooner.

38
Support / CHanging the memory usage by default?
« on: February 19, 2009, 05:36:26 pm »
Hi, I am having problems with running an app in java. I know I could use the -Xmx and -Xms params when calling to java.exe.

But I need to do something different, I need to chance the default memory usage rules for java. That means, that all the java apps will run with that memory specifications without needing to specify it for every program.

Is there any way to do it?

39
Projects / Re: Flier Match
« on: February 02, 2009, 04:44:28 pm »
mm well, the project is dead actually. I dont eve remember the state of the project, I have not seen it in more than 4 months. Maybe I could retake it later.

40
Bugs / Re: VM crash on exiting the examples
« on: December 11, 2008, 03:18:05 pm »
Once I noticed a behavior on that and I managed to avoid that but I dont remember how nor which was the problem  :-[ :-[ :-[ :-[. I will try to remember and post something if I find anything usefull.

41
News / Re: Version 1.17 has been released!
« on: November 26, 2008, 11:43:20 pm »
Its becausse I am using DataIntegrator for ETL tasks too and we adopted a writting way in capital letters.

42
News / Re: Version 1.17 has been released!
« on: November 26, 2008, 11:37:25 pm »
I AM SCREAMING  >:( JAJAJAJAJAJAJA

i AM WORKING WITH DATABASES AT WORK SO i AM USING ONLY CAPITAL LETTERS!

43
News / Re: Version 1.17 has been released!
« on: November 26, 2008, 11:13:03 pm »
MMM IT SEEMS THAT YES, IT IS, BUT DOES THAT METHOD ADDS THE COLORS FROM A SECOND ONE TO THE FIRST ONE? ISNT THERE A WAY IN WHICH COLOR ARE REPLACED AND NOT ADDED? wHAT DOES THE WEIGTH ARGUMENT MEANS?

44
News / Re: Version 1.17 has been released!
« on: November 26, 2008, 11:04:38 pm »
btw: ITS THERE A WAY TO JOIN TWO TEXTURES (ONE ABOVE ANOTHER) INTO ONE USING THE BLACK COLOR AS THE TRANSPARENT OR SOMETHING, i REMEMBER THAT SOME TIME AGO I ASKED FOR THAT, AND YOU TOLD ME THAT YOU WILL ADD IT.

IT WAS ABOUT THE 1.14 RELEASE! i GUESS.

45
News / Re: Version 1.17 has been released!
« on: November 26, 2008, 10:53:21 pm »
What about the getTargets method in the CollisionListener?

Pages: 1 2 [3] 4 5 ... 49