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

Pages: [1] 2 3 ... 8
1
Support / 2d animations on Android
« on: January 05, 2017, 05:30:41 pm »
Hi, is there anyway to load a 2d animation gif, video o whatever in a moving Texture?? I have read other questions but I am not clear about this........

2
Support / Can the framebuffer decide where to display the image
« on: January 05, 2017, 06:23:54 am »
Hi, its been a log time away from here. I am trying to do a VR test. I have 2 cameras and want to render the first one in the left and the second one in the right.

Using the Config X offset wont work becausse the will draw different things on each side. What I want is to do something like this....

setContentView(R.layout.main);
      LinearLayout canvas=(LinearLayout)findViewById(R.id.mainLayout);
      canvas.addView(mGLView1);
      canvas.addView(mGLView2);

render camera 1 and
fb.display (mGLView1);

render camera 2 and
fb.display (mGLView2);

Or should I use a Texture artifact and then blit it into the front of the screen.... wouldnt this make it lose the 3d depth=????

3
Support / fractals
« on: September 05, 2014, 12:23:58 am »
Have anybody used JPCT for rendering dinamic fractals??? maybe 3d fractals!

4
Support / Cant load 3DS.. not JPCT problem, but adt one
« on: February 12, 2014, 08:28:53 am »
Hi Guys, I am trying to load a 3ds model, I put the 3ds models on the res folder and under other folder, but eclipse always says that there is an error within the project and marks those 3ds models in red. Which is the correct place to put the models and textures for using them in android???


5
Support / Advices about possible project
« on: February 05, 2014, 11:42:27 pm »
Hi Guys, I have been out of JPCT for years, now I was asked to do a software (Maybe for android but could be done in java too) that requires image processing, so Immediately I came here to ask.

One of the app requirements are:

 - Take a pic with an android device, then you could select the floor or even a wall and change it texture, all this from an android device, any image post processing  could be done on a server if necessary.

How do you think this could be achieved? ANy advices will be very appreciated. Becausse I must give an answer soon.

6
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);
}
   
}


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

8
Feedback / Barcode generation for J2me
« on: November 11, 2008, 09:33:23 pm »
Hi, This is a not jpct related question, but feeback says: ANYTHING THAT WONT FIT IN THE OTHER FORUMS.   :o


Does anybody know an API to generate barcode images from a given 13 digits number in j2me.

I have been reading with no luck.

9
Support / Problem with shooting
« on: November 10, 2008, 04:06:18 pm »
Hi again yesterday I coded a bit again on my project and I am having problems with this again. My problem is this one:


I create the bullets, set the collision mode and add a COlisionListener to them, on the client side, I move them until reaching an obstacle and then I drop the bullet from the world. My problem is, that as the bullet is shot from the craft position then it collides with their owner craft and are never shot.

I thouht about saving some information on the Bullet class to determine with craft shot it and avoid that collision to stop the bullet, but I cant determine this.

The bullet class has a String with the craft name, but when the collision is done I cant determine which object was the target of the collision generated by the bullet, so I cant know if it was the own craft or another object3d.

Would be very usefull to add a getTarget method on the CollisionListener / CollisionEvent becausse there are things that cant be done with the getSource. The getTarget should return an array with all the targets. and basicly the problem is that crafts and bullets move on the client. So, sometimes the source can be the bullet and in some other cases the source can be the craft, But I must check on somehow who was hit by a bullet. Any ideas about how to sove this?????

10
Support / Camera getZAxis vs getDirection
« on: October 20, 2008, 03:45:42 am »
Hi, Should be the same the getDirection and the getZAxis methods? as the Z axis of the camera should be looking to the front of it. The same of getDirection.....??  ???

or getZAxis gets the projected vector of the get direction over a World plan or something? In my game I was trying to use the getZAxis for seting the direction of my shots by I had strange results like shotting the right and the bullet moving the left. shooting up and the bullet moving to down. Anyway I tested the getDirection method and worked perfectly.

11
Feedback / Getting some sounds!
« on: October 13, 2008, 09:37:03 pm »
Hi, does anybody knows some source of sounds to use freely. A firend of mine said he could help me doing the sounds and the music for my game "undead FlierMatch", but now he says he has no time and I am looking for some free sounds to use.

12
Feedback / How to read a text file from a website?
« on: October 01, 2008, 03:17:39 am »
Hi all, I need to read a text file from a website, for example:

http://localhost:2020/project/file.txt

I must read that file from my desktop application. Any ideas? This is really urgent and I dont have any ideas, I never have done that but was trying to do it with Streams, Files, URI, URL, etc etc. But I am just gessing and coding. Please any help would be very appreciated.

13
Feedback / Google SketchUp 6
« on: September 30, 2008, 04:17:42 pm »
Hey, check this out. It seems to be quite easy to draw buildings for games and can export to 3ds and other formats in the payed version.

http://sketchup.google.com/

14
Support / Everything is 6.50 MB?
« on: September 30, 2008, 02:30:11 am »
Hi, I tried to save the whole world as a file to read it without having  to load everything again, and I noticed that the outputfile was 6.50 MB, as that is too expensive to download I better tried to save just a small Object3D to see if works. but I found that the new outputfile was 6.50 MB again. Then I tried to save a smaller Object3D and I notices that the file was again 6.50 MB???


Why does this happens?

15
Support / Problem when getting a char from the KeyMapper
« on: September 29, 2008, 06:49:05 am »
Hi, I have almost finished the whole chat stuff on my game. I have 2 problems:

1.- WHen I press BackSpace once it seems to register twice or something becausse my event is fired two times. this is the code:

Code: [Select]

public void appendChatChar () {
   
    //System.out.println ("Haciendo el appendChatChar: "+mensajeChat);
   
        boolean estado=false;
       
    do {
            estadoTeclas=mapaTeclas.poll();
            if (estadoTeclas!=KeyState.NONE) {
            estado=estadoTeclas.getState ();
            if (estadoTeclas.getKeyCode()==KeyEvent.VK_ENTER) {
            //System.out.println ("enviando el mensaje");
            mensajeSalida=mensajeChat;
            chateando=!chateando;
            render.setEnChat(false);
            } else if (estadoTeclas.getKeyCode()==KeyEvent.VK_ESCAPE) {
            //System.out.println ("dejando de chatear");
            mensajeChat="";
            chateando=!chateando;
            render.setEnChat(false);
           
            } else if (estadoTeclas.getKeyCode()==KeyEvent.VK_BACK_SPACE || estadoTeclas.getKeyCode()==KeyEvent.VK_DELETE) {
            System.out.println ("BORRANDO UN CARACTER DEL CHAT");
            if (mensajeChat.length()>=1)mensajeChat=mensajeChat.substring(0, mensajeChat.length()-1);
            render.setMensajeChat(mensajeChat);
            } else {
            char C=estadoTeclas.getChar();
            int h=C;
            if (h!=0)mensajeChat=mensajeChat+C;
            render.setMensajeChat(mensajeChat);
           
            }
               
            }
        } while (estadoTeclas!=KeyState.NONE);
   
    }


The estadoTeclas.getKeyCode()==KeyEvent.VK_BACK_SPACE is always being fired two times, always. Anyway to fix it?



2.- When I get get the events for my game everything goes well, but when doing the chat stuff, for each key typed and appended to a String I am receiving this: For example I write HELLO and get H(blank)E(blank)L(blank)L(blank)O(blank)

char C=estadoTeclas.getChar();
int h=C;//used this to control it
if (h!=0)mensajeChat=mensajeChat+C;
render.setMensajeChat(mensajeChat);

I guess Its a bug on the getChar method.

Pages: [1] 2 3 ... 8