diff --git a/modules/opengl-jogl/src/main/java/org/gephi/viz/engine/jogl/JOGLRenderingTarget.java b/modules/opengl-jogl/src/main/java/org/gephi/viz/engine/jogl/JOGLRenderingTarget.java index d884d0a..65ceed9 100644 --- a/modules/opengl-jogl/src/main/java/org/gephi/viz/engine/jogl/JOGLRenderingTarget.java +++ b/modules/opengl-jogl/src/main/java/org/gephi/viz/engine/jogl/JOGLRenderingTarget.java @@ -41,10 +41,20 @@ public JOGLRenderingTarget(GLAutoDrawable drawable) { this.drawable = drawable; } + private boolean listenersSetup = false; + @Override public void setup(VizEngine engine) { this.engine = engine; + setupEventListeners(); + } + + private synchronized void setupEventListeners() { + if (listenersSetup) { + return; + } + drawable.addGLEventListener(this); if (drawable instanceof GLWindow) { @@ -56,6 +66,8 @@ public void setup(VizEngine engine) { } else { System.out.println(drawable.getClass() + " event bridge not supported yet. Be sure to manually setup your events listener"); } + + listenersSetup = true; } private void setup(GLWindow gLWindow) { @@ -125,7 +137,7 @@ public void dispose(GLAutoDrawable drawable) { //NOOP } - private final float backgroundColor[] = new float[4]; + private final float[] backgroundColor = new float[4]; @Override public void display(GLAutoDrawable drawable) { @@ -217,12 +229,14 @@ private void updateFPS() { if (TimeUtils.getTimeMillis() - lastFpsTime > 1000) { if (frame != null && windowTitleFormat != null && windowTitleFormat.contains("$FPS")) { frame.setTitle(windowTitleFormat.replace("$FPS", String.valueOf(fps))); - } else { - System.out.println("FPS: " + fps); } fps = 0; lastFpsTime += 1000; } fps++; } + + public int getFps() { + return fps; + } } diff --git a/modules/opengl-jogl/src/main/java/org/gephi/viz/engine/jogl/pipeline/DefaultJOGLEventListener.java b/modules/opengl-jogl/src/main/java/org/gephi/viz/engine/jogl/pipeline/DefaultJOGLEventListener.java index d6db671..14a74c8 100644 --- a/modules/opengl-jogl/src/main/java/org/gephi/viz/engine/jogl/pipeline/DefaultJOGLEventListener.java +++ b/modules/opengl-jogl/src/main/java/org/gephi/viz/engine/jogl/pipeline/DefaultJOGLEventListener.java @@ -104,11 +104,6 @@ public boolean mouseClicked(MouseEvent e) { return true; } else if (graphSelection.getMode() == GraphSelection.GraphSelectionMode.SIMPLE_MOUSE_SELECTION && leftClick) { //TODO: move to independent selection input listener - final Vector2f worldCoords = engine.screenCoordinatesToWorldCoordinates(x, y); - System.out.println(String.format( - "Click on %s %s = %s, %s", x, y, worldCoords.x, worldCoords.y - )); - return true; } else if (graphSelection.getMode() == GraphSelection.GraphSelectionMode.RECTANGLE_SELECTION) { inputActionsProcessor.clearSelection(); diff --git a/pom.xml b/pom.xml index f403822..f65a0b0 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ UTF-8 1.8 1.8 - 7.0.5 + 7.1.2 0.6.15-viz-engine-SNAPSHOT 0.10.0