Chart2d and JavaFX

110 views
Skip to first unread message

bsutter

unread,
Dec 10, 2017, 10:53:12 AM12/10/17
to Jzy3d
Hey, 

I tried to bind a Chart2d to a JavaFX ImageView like this:

       JavaFXChartFactory factory = new JavaFXChartFactory();

       this.line = new LineSerie2d(map.getName());

       this.chart = new Chart2d(factory, Quality.Advanced, Toolkit.offscreen);

       ((ConcurrentLineStrip) line.getDrawable()).setWidth(0.5f);


       chart.getScene().add(line.getDrawable());

       
       
ImageView imageView = factory.bindImageView((AWTChart) chart);


However, if I run the code with the -Djogl.debug.DebugGL flag, I get an error

com.jogamp.opengl.GLException: Caught GLException: Thread[Thread-9,1,javafx concurrent thread pool] glGetError() returned the following error codes after a call to glOrtho(<double> -0.0, <double> 0.0, <double> -0.0, <double> 0.0, <double> 3.464101552963257, <double> 3.464101552963257): GL_INVALID_VALUE ( 1281 0x501),  on thread Thread-9

       at com.jogamp.opengl.GLException.newGLException(GLException.java:76)

       at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1327)

       at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)

       at jogamp.opengl.GLAutoDrawableBase.defaultDisplay(GLAutoDrawableBase.java:467)

       at com.jogamp.opengl.GLAutoDrawableDelegate.display(GLAutoDrawableDelegate.java:190)

       at org.jzy3d.plot3d.rendering.canvas.OffscreenCanvas.forceRepaint(OffscreenCanvas.java:104)

       at org.jzy3d.plot3d.rendering.view.View.shoot(View.java:135)

       at org.jzy3d.plot3d.rendering.view.View.updateBounds(View.java:590)

       at org.jzy3d.plot3d.rendering.scene.Graph.add(Graph.java:101)

       at org.jzy3d.plot3d.rendering.scene.Graph.add(Graph.java:105)

       at org.jzy3d.plot3d.rendering.scene.Scene.add(Scene.java:89)

       at gui.util.MapChartWrapperOneDim.<init>(MapChartWrapperOneDim.java:81)

       at gui.util.MapChartWrapperFactory.create(MapChartWrapperFactory.java:10)

       at gui.application.view.MapEditController$1$1.call(MapEditController.java:191)

       at gui.application.view.MapEditController$1$1.call(MapEditController.java:1)

       at javafx.concurrent.Task$TaskCallable.call(Task.java:1423)

       at java.util.concurrent.FutureTask.run(FutureTask.java:266)

       at javafx.concurrent.Service.lambda$null$492(Service.java:725)

       at java.security.AccessController.doPrivileged(Native Method)

       at javafx.concurrent.Service.lambda$executeTask$493(Service.java:724)

       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

       at java.lang.Thread.run(Thread.java:745)

Caused by: com.jogamp.opengl.GLException: Thread[Thread-9,1,javafx concurrent thread pool] glGetError() returned the following error codes after a call to glOrtho(<double> -0.0, <double> 0.0, <double> -0.0, <double> 0.0, <double> 3.464101552963257, <double> 3.464101552963257): GL_INVALID_VALUE ( 1281 0x501),

       at com.jogamp.opengl.DebugGL4bc.writeGLError(DebugGL4bc.java:31803)

       at com.jogamp.opengl.DebugGL4bc.glOrtho(DebugGL4bc.java:17217)

       at org.jzy3d.plot3d.rendering.view.Camera.projectionOrthoGL2(Camera.java:491)

       at org.jzy3d.plot3d.rendering.view.Camera.doShoot(Camera.java:465)

       at org.jzy3d.plot3d.rendering.view.Camera.shoot(Camera.java:447)

       at org.jzy3d.plot3d.rendering.view.Camera.shoot(Camera.java:431)

       at org.jzy3d.plot3d.rendering.view.View.updateCamera(View.java:932)

       at org.jzy3d.plot3d.rendering.view.View.updateCamera(View.java:919)

       at org.jzy3d.plot3d.rendering.view.View.updateCamera(View.java:915)

       at org.jzy3d.plot3d.rendering.view.View.renderScene(View.java:810)

       at org.jzy3d.plot3d.rendering.view.layout.ColorbarViewportLayout.render(ColorbarViewportLayout.java:54)

       at org.jzy3d.chart.ChartView.render(ChartView.java:47)

       at org.jzy3d.plot3d.rendering.view.Renderer3d.reshape(Renderer3d.java:107)

       at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:646)

       at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:667)

       at jogamp.opengl.GLAutoDrawableBase$1.run(GLAutoDrawableBase.java:431)

       at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1291)

       ... 21 more


and I fail to figure out what exactly is causing it and how to fix it. Is there something obvious I'm missing?

I'm using jzy3d-api and jzy3d-javafx v1.0.1

Aleksej Dontnow

unread,
Mar 23, 2018, 6:29:49 PM3/23/18
to Jzy3d
Hello,
Can you try convert to 2D plot like this:


layout2d
(chart);


import static org.jzy3d.chart.BigPicture.layout2d;   -> required to use layout2d
Reply all
Reply to author
Forward
0 new messages