Hi,
I'd like to be able to detect gestures, and it looks like NEWT supports that. I'm trying out NEWT and can't seem to get any gestures to be detected. I have tried gestures with my touchpad and with my touchscreen. Neither have any effect. No pinch-to-zoom, no drag-to-scroll, etc. Below is my minimalist code. Any ideas? import java.awt.*; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.event.GestureHandler.GestureEvent; import com.jogamp.newt.event.GestureHandler.GestureListener; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; public class Test { public static void main(String[] args) { JFrame frame = new JFrame("Test"); JPanel panel = new JPanel(new BorderLayout()); GLWindow window = GLWindow.create(new GLCapabilities(GLProfile.get(GLProfile.GL2))); NewtCanvasAWT canvas = new NewtCanvasAWT(window); window.addGLEventListener(new GLEventListener() { @Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.setSwapInterval(1); } @Override public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glRotatef(0.2f, 0, 0, 1); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); gl.glColor3f(0, 0, 0); gl.glBegin(GL2.GL_TRIANGLES); gl.glVertex2f(-0.9f, -0.9f); gl.glVertex2f( 0.0f, 0.9f); gl.glVertex2f( 0.9f, -0.9f); gl.glEnd(); } @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } @Override public void dispose(GLAutoDrawable drawable) { } }); window.addGestureListener(new GestureListener() { @Override public void gestureDetected(GestureEvent gh) { System.out.println("Gesture detected: " + gh.toString()); } }); Animator animator = new Animator(window); animator.setUpdateFPSFrames(1, null); animator.start(); panel.add(canvas, BorderLayout.CENTER); panel.add(new JLabel("label text here..."), BorderLayout.NORTH); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 500); frame.setVisible(true); } } |
Administrator
|
Hi
Gestures are supported in NEWT only under some platforms. It works under Android as far as I remember and it will work under GNU Linux in JOGL 2.3.3. Sorry. We are open to contributions.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |