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 / Best/Fastest way to make objects visible/invisible
« on: April 01, 2018, 06:29:23 am »
Hi friends, I am soing an app in which I must show or hide objects from my world depending on the user input..... Actually I am doing:

1: Clean (Remove all the objects3D that chould be hidden, some of them are not even in the world)
2: Adding to the world all the objects from (1:) that have to been shown
3: build the objects
4: render the world


I am constantly receving error messages that the object didnt exists on the world when trying to remove them.....

Will this way affect performance ans estability??

Which should be the best way to show or hide objects from my world. Maybe moving them to a far position out of the camera scope instead of removing them and moving them again instead of rebuilding them??? wich other aproach should I use??

2
Support / Need advice in my Project.
« on: April 01, 2018, 06:22:27 am »
Hi all friends, I am in a project and need advice.

Actually I am building a custom instrument cluster for my car, I am doing this:

I have a class MyRenderer implements GLSurfaceView.Renderer

that loops rendering the world and applying the changes on it, my arduino board reads the events on the original cluster conenctor and sends to the android app via tcp. Most of changes on the world are showing/hiding indicators (low beams, high beams, parking brake, low fuel, etc), they appear and dissapear when expected, but..... when moving the RPM and SPEED needles the move slow and its not continous.

I am sending the actual speed or rpm value from the arduino to the render thread. lets say 1000 rpms ans if the next read its 1200 rpms for a fast engine movementthe needle will JUMP from 1000 rpms to 1200 rpms but it wont move smootly, it will jump..... How can I achieve a more natural movement????

I have tested moving increasing 100 rpms on wach arduino loop, even with that small movements the jpct app wont show smooth movement, in fact I see delays between each loop.

ANy ideas???

3
Projects / Instrument Cluster for a Muscle Car
« on: March 30, 2018, 02:56:59 pm »
Hi friends, I am in a project building a custom cluster for the classic car I am restoring.

The idea is to do a digital instrument cluster using an android device with a jpct app and Arduino to link the Electronic with the app. Hope I can receive help for my project as I always have had.

Geetings from Ecuador.

4
Support / My Object3D just dont want to rotate.
« on: February 23, 2018, 12:12:15 am »
Hi guys, I am building a car instrument cluster with jpct, I am trying to move the rpm and speedometer needles but they just dont rotate.

I have a small object where the needle pivot  should be. I am doing this:

speed_neddle.setRotationPivot(speed_pivot.getROtationPivot());
speed_neddle.rotateZ(any value);

but it just wont move.


Any ideas?

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

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

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

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


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

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


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

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

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

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

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

Pages: [1] 2 3 ... 8