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

#1
Quote from: raft on April 13, 2010, 03:53:25 PM
swing-gl is not a completed project. for example keyboard events are not dispatched so it's normal that JTextArea doesn't work.

you may want to have a look at PureSwing. it's a mature project but a bit big in size and requires a fairly decent video card

Hi,raft,

I have in trouble and need your help

If i write my keyboard events,how could I do ,give tips please
#2
thanks

give me some time  ;D
#3
Quote from: EgonOlsen on April 08, 2010, 01:06:35 PM
Looks fine to me at first glance. I can't remember exactly if it has to be added to the frame or the canvas...you are doing both. Maybe doing just one of them will make it work?

hi,
i did as you said,but keylisten still not work... :'(

now i am seeking other way...

i used the project powered by raft http://www.jpct.net/forum2/index.php/topic,1338.0.html,everything is run well,but JScrollPanel and JTextArea can't work
i don't konw what's wrong,so give it up

now,i find a GUI API (FengGUI),i will do some test with it later,could you give me more info about it,or other gui project like FengGui :P

this thread will update,if something run, i will let you know first ;D
#4
Quote from: EgonOlsen on April 06, 2010, 07:07:28 AM
Well, you can't render Swing or AWT components on top of a native OpenGL output. You can try to use FrameBuffer.enableGLCanvasRenderer() (don't forget to disable the software renderer in addition), which will return a Canvas. This (heavyweight) Canvas can be combined with Swing/AWT components to a degree. You should find some information about this when searching the forums.

well,as you say ,I get a AWTGLCanvas which i can put this canvas into a JFrame,but the KeyMapper is wrong, i implements a KeyListener(java.awt.event.KeyListener;),but it seemes not work

my code such as
public class Test implements KeyListener {
        frame = new JFrame("test");
        panel = new JPanel();
        frame.setLayout(new GridLayout(1,1));
   frame.setSize(width, height);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.add(panel);
        frame.setVisible(true);
   buffer = new FrameBuffer(panel.getWidth(),panel.getHeight(),FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY);
   buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
   //buffer.enableRenderer(IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);
   canvas = buffer.enableGLCanvasRenderer();
   panel.add(canvas,new GridLayout(1,1));
   canvas.addKeyListener(this);
   frame.addKeyListener(this);
}

public void keyTyped(KeyEvent e){
   System.out.println("ley d");
}
public void keyPressed(KeyEvent e){
   System.out.println("ley d");
}
public void keyReleased(KeyEvent e){
   System.out.println("ley d");
}

the game loop is
buffer.clear();
theWorld.renderScene(buffer);
theWorld.draw(buffer);
buffer.update();
buffer.displayGLOnly();
canvas.repaint();

Is there something I can change to allow the mapper to be correctly ?
#5
OK ,thanks
#6
use hardware accelerated rendering using OpenGL,maybe i need to use software?
#7
HI ,I am back...

First I've to say thanks for this great 3D engine.

but after some tests i got a problem in jPCT Car demo

I want to know how could i add a JTextField or JTextArea in scene of Car demo to accept user's input?

e.g.
there have two textfield "input" and "show"
I input some text in "input" textfield,and when press "send" button,the message was display on "show" textfield
#8
Support / Re: How to remove an object3D from world?
March 17, 2010, 04:04:55 AM

Thanks!
Useful info!

you are right,i want to get the car's coordinates.

now i'm writing a network demo for interests based on JPCT Car,I write a method to send local client's coordinates to srever.

car.getTranslation() or car.getTransformedCenter() ...........let me try ^-^
#9
Support / Re: How to remove an object3D from world?
March 16, 2010, 01:28:29 PM
I'm again ,my first question is bad in forum...

I need to take more time to learn JPCT API

now,i'm in trouble again... ~.~

in the JPCT Car demo, in CarTest.java

class CarTest {
...
car=new Car();
car.translate(55, 0, 55);
car.addToWorld(theWorld);
...
}
the car was loaded in this coordinate (55, 0, 55)

then i move the car ,the car's coordinate has changed

i create a method to output the car's coordinate
i use System.out.println("XAxis="+car.getXAxis())  and System.out.println(car.getZAxis())
but output is like XAxis=(****,0,****)   YAxis=(****,0,****)

i want to get the result like XAxis=****   YAxis=****

how to do ?Maybe something is wrong i did ...
#10
Support / How to remove an object3D from world?
March 15, 2010, 11:49:12 AM
If we want to add an object3D into world we can do this :

World world = new World();
Object3D model1 = ...
Object3D model2 = ...

world.addObject(model1);
world.addObject(model2);

now,if we wang to remove model2 from world , how can we do?