Skip to content

Commit

Permalink
WIP jogl fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eduramiba committed Jun 10, 2024
1 parent 8425e5d commit 80a486f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<jcp-maven-plugin.version>7.0.5</jcp-maven-plugin.version>
<jcp-maven-plugin.version>7.1.2</jcp-maven-plugin.version>

<gephi.graphstore.version>0.6.15-viz-engine-SNAPSHOT</gephi.graphstore.version>
<gephi.version>0.10.0</gephi.version>
Expand Down

0 comments on commit 80a486f

Please sign in to comment.