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

Pages: 1 [2]
16
Support / 2D Layer?
« on: January 05, 2009, 08:37:22 am »
Ok things are going nicely. I guess :P

I'm having some other problems. So If you could bear with me.

1. What angle system does JPCT use? Right, Left? Is towards the user +Z? is in +Z +X to the right....

and more importantly

2. I am using JBox2d. I can get the physics to work and "bind" the Object3d to the Physics body. There is however a problem. In relation to 1. I don't know if i'm seeing the physics matching the 3d. So here is what i'm looking for

A layer ontop of the 3d where I can line draw the physics objects where it is transparent. That way I can maybe see somekind of merger to validate what's happening.

17
Support / camera.getPosition() a copy?
« on: December 30, 2008, 11:26:19 am »
ok so i'm slowly hacking away at getting my core elements going  :P

I've come across a pecularity that came up. I am using LuaJ. It has the problem that it's internvalues don't refer back to floats naturaly in it's enviroment. So if I
Code: [Select]
camera:setPosition(1.0, 2.0, 3.0); // in lua. This will fail. Ok so I came up with a solution

SimplerVector v = camera:getPosition(); //get the simplevector
bridge:setSimpleVector(v, 1.0, 2.0, 3.0);
 
this doesn't work, no error though. this is my custom class that converts the lua values to floats in the java enviro.

I can however do this
Code: [Select]
camera:setPosition(bridge:createSimpleVector(1.0, 2.0, 3.0));  this however creates a new SimpleVector

It seems that geting the camera position get's a copy not the the actual vector that camera uses. Am I doing something wrong?
Also if there is no other solution will creating a new SimpleVector per camera update cause a memory problem?




18
Support / LWJGL applet loader Texture problem
« on: November 17, 2008, 12:49:21 am »
Ok problem with textures. I'm using LWJGL Applet loader to get the hardware acceleration. Ok that works. The problem i'm having is with textures. They don't display.

Heres an object

http://sre.hopto.org/images/badtexture.jpg

Heres the texture

http://sre.hopto.org/images/expo_stones.png

Heres the relevent texture code
Code: [Select]
  public void init(){
    world = new World();
    World.setDefaultThread( Thread.currentThread() );

    // your pick, same result
    //TextureManager.getInstance().addTexture("stone", new Texture(getResource("expo_stones.png")));
    //TextureManager.getInstance().addTexture("stone", new Texture(getDocumentBase(),"expo_stones.png"));
   
    camera = world.getCamera();
    camera.setPosition(80f,-50f,0f);
    camera.lookAt(new SimpleVector(0,0,0)); // this is invalid. this should always look at player. modify soon
   
    world.getLights().setOverbrightLighting ( Lights.OVERBRIGHT_LIGHTING_DISABLED );
    world.setAmbientLight( 50, 50, 50 );
    world.addLight( new SimpleVector( 50, -50, 30 ), 120, 120, 120 );

    Object3D object;
    object = Primitives.getBox(50f, 0.01f);
    object.setTexture("stone");
    object.setEnvmapped(Object3D.ENVMAP_ENABLED);
    object.build();
    world.addObject(object);

    buffer = new FrameBuffer( width, height, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY );
    buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
    canvas = buffer.enableGLCanvasRenderer();
    add( canvas, BorderLayout.CENTER);
    canvas.setVisible( true );
    world.buildAllObjects();
    camera = world.getCamera();
    new Thread(this).start();
  }

  private InputStream getResource( String resourceName ){
    return getClass().getClassLoader().getResourceAsStream( resourceName );
  }

the texture is at the root of the .jar file.

19
Support / Swing/JApplet problem, no panel
« on: July 22, 2008, 05:03:51 am »
blarg

Well got another problem  ::)

My Swing JPanel does not display in the contentPane of the applet.



Code: [Select]

in
init(){
    createGuiEdit();
 
    canvas = buffer.enableGLCanvasRenderer();
    getContentPane().add(canvas, BorderLayout.WEST);
    //add( canvas, BorderLayout.CENTER);
    canvas.setVisible( true );
    canvas.addMouseListener( input );
    canvas.addMouseMotionListener( input );
}


private void createGuiEdit(){
    JButton button;
    panel = new JPanel(new BorderLayout());
   
    button = new JButton("1x1");
    button.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){input.newBox(e); } });
    button.setVisible(true);
    panel.add(button);
   
    panel.setVisible(true);
    getContentPane().add(panel, BorderLayout.EAST);
}


  public void paint(Graphics g){
      input.update();

      buffer.clear(Color.blue);   // erase the previous frame
      // render the world onto the buffer:
      world.renderScene( buffer );
      world.draw( buffer );
      buffer.update();
      buffer.displayGLOnly();
      canvas.repaint();    // Paint the canvas onto the applet (hardware mode)
}

do I need to draw the JPanel?

20
Support / Applet black screen
« on: July 08, 2008, 05:32:55 pm »
sigh....

I've been banging my head over this a good portion last night. I've tried scouring through the support section. I've seen some information but they don't seem to work. I'm missing something obvious I'm sure. I've reduced my work to use Pauls jPCTGears demo as the basics. Can anyone point out whats wrong.

this program runs through applet loader and is in hardware.

Code: [Select]
import java.applet.*;
import javax.swing.JApplet;
import java.awt.*;

import com.threed.jpct.*;

public class Editor extends Applet implements Runnable{
  private boolean exit = false;

  private World world;
  private FrameBuffer buffer;
  private Camera camera = null;
  private int width = 640;
  private int height = 480;
  private boolean loop=true;

  Canvas canvas;
  private EditorInput input;

  public void init(){
   
    world = new World();
    World.setDefaultThread( Thread.currentThread() );
   
    world.setAmbientLight(50, 250, 50);
    world.getLights().setOverbrightLighting (Lights.OVERBRIGHT_LIGHTING_DISABLED );
    world.getLights().setRGBScale( Lights.RGB_SCALE_2X );

    world.setAmbientLight( 150, 150, 150 ); // just trying to get anything besides black screen

    // Create a main light-source:
    world.addLight( new SimpleVector( 50, -50, 300 ), 20, 20, 20 );   
   
    // prepare buffer
    buffer = new FrameBuffer( width, height, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY );
    buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);

    // prepare canvas
    canvas = buffer.enableGLCanvasRenderer();
    add( canvas, BorderLayout.CENTER);
    canvas.setVisible( true );
    //canvas.addMouseListener( input );
    //canvas.addMouseMotionListener( input );
   
    TextureManager.getInstance().addTexture("box", new Texture("box.jpg"));
    //test object
    Object3D box = Primitives.getBox(3f, 2f);
    box.setTexture("box");
    box.setEnvmapped(Object3D.ENVMAP_ENABLED);
    box.build();
    world.addObject(box);
    world.buildAllObjects();

    Camera camera = world.getCamera();
    camera.setPosition(10f,10f,10f);
    camera.lookAt(new SimpleVector(0,0,0)); // look at center of world. assuming box defaults to 0.0.0
   
    new Thread(this).start();
   
  }
 
 
  public void run() {
    while (loop) {
      this.repaint();
      try {
          Thread.sleep(10);
      } catch(Exception e) {
          //Don't care...
      }
    }
   
  }
 
  public void paint(Graphics g){
      buffer.clear();   // erase the previous frame
      world.renderScene( buffer );
      world.draw( buffer );
      buffer.update();
      buffer.displayGLOnly();
      canvas.repaint();    // Paint the canvas onto the applet (hardware mode)
  }

    @Override
    public void destroy()
    {
    loop=false;
    }
}

yeah this code doesn't work. The TaskManager also doesn't report much activity from Firefox or Java. Which leaves me to believe
that no real repainting is being done.

Pages: 1 [2]