Main Menu
Menu

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.

Show posts Menu

Messages - slenkar

#1
ah ok thanks,

I switched to the normal gl renderer in the end

Ill keep that in mind if i have to switch back for some reason.
#2
I did some tests and realised it happens when moving the mouse and pressing the button at the same time.


import com.threed.jpct.*;

//import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.KeyListener;
//import java.awt.Insets;
import javax.swing.JFrame;

public class mousebutton extends JFrame implements MouseListener,
MouseMotionListener,KeyListener {
public static World world;
private FrameBuffer buffer;
public JFrame frame;
   
public void keyPressed(KeyEvent e)
{}

public void keyTyped(KeyEvent e)
{
if (e.getKeyCode()==KeyEvent.VK_A)
{
//System.out.println("typed a");
}
//nothing
}
public void keyReleased(KeyEvent e)
{
if (e.getKeyCode()==KeyEvent.VK_W)
{
    //System.out.println("released a");
}
//nothing
}

public static void main(String[] args) throws Exception {
new mousebutton().loop();
}

public void mouseEntered( MouseEvent e ) {}
    public void mouseExited( MouseEvent e ) {}
    public void mouseReleased( MouseEvent e ){
   
    System.out.println("mouse released");
    }
    public void mouseClicked( MouseEvent e ){
   
    System.out.println("mouse clicked");
    }
    public void mousePressed( MouseEvent e )
    {
     
      }



  public void mouseMoved( MouseEvent e ) {
 
        int x = e.getX();
        int y = e.getY();
 
  }
    public void mouseDragged( MouseEvent e )
    {
   
        // get the mouse's coordinates:

    }


public mousebutton() throws Exception {

frame=new JFrame("Hello world");
frame.setSize(800, 600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
}



private void loop() throws Exception {
FrameBuffer buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
Canvas canvas=buffer.enableGLCanvasRenderer();
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
frame.add(canvas);
canvas.addMouseListener( this );
        canvas.addMouseMotionListener( this );
        canvas.addKeyListener(this);
while (frame.isShowing()) {


buffer.clear(java.awt.Color.BLACK);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();

canvas.repaint();

//Bullet.update_bullets();
Thread.sleep(10);
//System.out.println(Mouse.getDX());
}
//buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
// buffer.dispose();
frame.dispose();
System.exit(0);
}

}


notice only mouse release events are generated, when moving the mouse
#3
Im using AWT to handle mouse and keyboard events ,is this the reason?

When I use Lwjgl to handle events the screen goes blank, is there a different renderer that allows lwjgl mouse handling?
#4
Support / mouse responsiveness with AWTGL renderer?
June 01, 2009, 04:59:46 PM
Has anyone noticed a lack of mouse-button responsiveness with the AWTGL renderer?
The mouse movements and keyboard work fine but the mouse button isnt always registered.
#5
oh yeah another thing, im not sure about animation speed - thats one thing ive never tested

Does JPCT use 'transform and lighting' for hardware animation, or software animation rendering?
#6
like when you make a 2d game and you draw several large images
#7
Support / Re: this == null
June 01, 2009, 01:09:34 AM
ah ok thanks
#8
ive done extensive research with those onboard intel cards, most laptops ship with intel gfx cards.

They are decent at rendering polygons and there is almost no limit, but their texture fill-rate is terrible,

so just make sure that you dont fill the screen multiple times with textures.
therefore 2d games can be quite slow as you drawing lots of textures to the screen.

As long as you only use opengl 1.1 with no extensions you should be fine

terrains with many polygons will slow the game down to 28fps most of the time
#9
Support / this == null
May 31, 2009, 11:43:33 PM
here is my bullet class with constructor:

public class Bullet{
   
   public static ArrayList list ;
   public Object3D obj;
   
   public Bullet(Object3D parent)
   {
   
      
      if (list==null)
      {
         ArrayList<Bullet> list = new ArrayList<Bullet>();
      }
      
      
      this.obj=HelloWorldAWTGL.bullet.cloneObject();
       this.obj.setBillboarding(true);
       obj.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
       HelloWorldAWTGL.world.addObject(this.obj);
       Matrix pos=parent.getTranslationMatrix().cloneMatrix();
       Matrix rot=parent.getRotationMatrix().cloneMatrix();
       this.obj.setTranslationMatrix(pos);
       this.obj.setRotationMatrix(rot);
       list.add(this);
   }

when i try to add 'this' to the list it says this==null in the debugger, but the other operations on 'this' all work fine.

can anyone help?
#10
Support / Re: couple of random questions
May 30, 2009, 09:30:15 PM
thanks egon+paul that will send me in the right direction
#11
Support / couple of random questions
May 30, 2009, 08:07:54 PM
1. If you create a webstart game or applet can the player save their game information on their PC?


2.When compiling a program in eclipse where is the compiled Jar file?, i looked in the workspace folder but it wasnt there.

#12
thanks for 'the codez' they work very well
#13
Support / Re: Camera matching Object3d Z Axis
May 30, 2009, 05:12:19 PM


EDIT - it was my fault, sorry I just needed to set the camera angle to zero
#14
so i would interpolate between the dummy and object1's matrices?

#15
when i was using another 3d engine i did this:

1.created a dummy object and made it a child of object 1
2.pointed the dummy to object2 (target object)
3.got local yaw and pitch of dummy (relative to its parent)
4.increased/decreased yaw(yaxis) and pitch(xaxis) of object1 by a certain amount  (depends how good the ships turn thrusters are)
(in  my game you can upgrade turn thrusters so ships can turn to face another quicker)

if the dummys yaw is bigger than object1
reduce object1's yaw by turn thruster amount
if the dummys yaw is smaller than object1
increase object11's yaw by turn thruster amount

if the difference of the dummys yaw and pitch compared to its parent are less than the ships turn thruster amount, then just set the yaw and pitch as the same
5.set roll (zaxis) as the same for every object (zero) to make them look better, so that no ship looks upside down


is this possible in jpct?