Go to file
Martin Pernollet 0ec6a543d9
Merge pull request #308 from jzy3d/bugs/textRendererMemoryLeak
Text renderer memory leak
2022-12-02 13:45:00 +01:00
.github Simplify controller to let them target a single chart at a time. Disabled CI 2022-09-15 15:17:49 +02:00
doc Bump to version 2.1.1-SNAPSHOT 2022-05-31 13:25:19 +02:00
jzy3d-core Fixed TextRenderer memory leak 2022-11-29 16:10:44 +01:00
jzy3d-core-awt Fix GifDecoder on Ubuntu before running integration tests on memory leak 2022-11-29 16:43:24 +01:00
jzy3d-core-swt Bump to version 2.1.1-SNAPSHOT 2022-05-24 17:31:19 +02:00
jzy3d-depthpeeling [maven-release-plugin] prepare for next development iteration 2022-08-08 15:39:22 +02:00
jzy3d-emul-gl-awt Allow configuring background color of GifExporter 2022-10-04 20:56:57 +02:00
jzy3d-emul-gl-swt Bump to version 2.1.1-SNAPSHOT 2022-05-24 17:31:19 +02:00
jzy3d-everything It test per plateform 2022-09-15 15:34:01 +02:00
jzy3d-io-reports It test per plateform 2022-09-15 15:34:01 +02:00
jzy3d-io-xls [maven-release-plugin] prepare for next development iteration 2022-08-08 15:39:22 +02:00
jzy3d-jGL Fix clipping planes in EmulGL 2022-09-01 17:02:49 +02:00
jzy3d-jdt-core [maven-release-plugin] prepare for next development iteration 2022-08-08 15:39:22 +02:00
jzy3d-native-jogl-awt Fixed TextRenderer memory leak 2022-11-29 16:10:44 +01:00
jzy3d-native-jogl-core Fixed TextRenderer memory leak 2022-11-29 16:10:44 +01:00
jzy3d-native-jogl-javafx Bump to version 2.1.1-SNAPSHOT 2022-05-24 17:31:19 +02:00
jzy3d-native-jogl-newt Simplify controller to let them target a single chart at a time. Disabled CI 2022-09-15 15:17:49 +02:00
jzy3d-native-jogl-swing Fixed TextRenderer memory leak 2022-11-29 16:10:44 +01:00
jzy3d-native-jogl-swt [maven-release-plugin] prepare for next development iteration 2022-08-08 15:39:22 +02:00
jzy3d-svm-mapper [maven-release-plugin] prepare for next development iteration 2022-08-08 15:39:22 +02:00
jzy3d-tester It test per plateform 2022-09-15 15:34:01 +02:00
jzy3d-tester-native Build and test all on M1 OK 2022-09-15 16:06:48 +02:00
jzy3d-tests-java9 Fix GifDecoder on Ubuntu before running integration tests on memory leak 2022-11-29 16:43:24 +01:00
jzy3d-tools-libsvm [maven-release-plugin] prepare for next development iteration 2022-08-08 15:39:22 +02:00
jzy3d-tutorials Fix GifDecoder on Ubuntu before running integration tests on memory leak 2022-11-29 16:43:24 +01:00
.gitignore add bin to gitignore 2022-06-20 16:23:52 +02:00
.project minor doc edit 2014-05-02 17:53:54 +01:00
.travis.yml Improve MAVEN build Performance 2021-08-27 09:23:42 +08:00
README.md Adding manual test scenarios 2022-04-28 11:51:45 +02:00
license.txt clean doc and tutorial code 2021-01-23 17:33:49 +01:00
pom.xml [maven-release-plugin] prepare for next development iteration 2022-08-08 15:39:22 +02:00
settings-obf.xml.enc format conflicting classes 2014-12-27 11:29:48 +01:00
travis.help format conflicting classes 2014-12-27 11:29:48 +01:00

README.md

Jzy3d

Jzy3d is a framework for easily drawing 3d and 2d charts in Java, using either fast native GPU rendering or CPU based rendering to enhance portability across combination of OS/JVM/GPU.

The framework targets simplicity and portability across Java windowing toolkits (AWT, SWT, NEWT, Swing, JavaFX, Offscreen rendering), running either on MacOS, Windows and Linux. Jzy3d is available for other languages or platforms such as Scala, Groovy, Matlab, C#, and even Python.

The API can be used freely in commercial applications. You can explore the tutorials. an then purchase the extended developper guide to support the development effort.

How to use

Refer to the tutorial README file to get help on creating your first chart project with the help of example code.

As this library focuses on portability of the charts, the org.jzy3d.demos.surface package in jzy3d-tutorials demonstrates the same chart running on AWT, SWT, Swing using native OpenGL powered by JOGL and jGL CPU rendering.

public class SurfaceDemoAWT extends AWTAbstractAnalysis {
  public static void main(String[] args) throws Exception {
    SurfaceDemoAWT d = new SurfaceDemoAWT();
    AnalysisLauncher.open(d);
  }

  @Override
  public void init() {
    // Define a function to plot
    Mapper mapper = new Mapper() {
      @Override
      public double f(double x, double y) {
        return x * Math.sin(x * y);
      }
    };

    // Define range and precision for the function to plot
    Range range = new Range(-3, 3);
    int steps = 80;

    // Create the object to represent the function over the given range.
    final Shape surface = new SurfaceBuilder().orthonormal(new OrthonormalGrid(range, steps), mapper);
    surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface, new Color(1, 1, 1, .5f)));
    surface.setFaceDisplayed(true);
    surface.setWireframeDisplayed(true);
    surface.setWireframeColor(Color.BLACK);

    // Create a chart
    GLCapabilities c = new GLCapabilities(GLProfile.get(GLProfile.GL2));
    IPainterFactory p = new AWTPainterFactory(c);
    IChartFactory f = new AWTChartFactory(p);

    chart = f.newChart(Quality.Advanced);
    chart.getScene().getGraph().add(surface);
  }
}

What's inside

Features

Multiple chart types

  • Surface charts
  • Scatter charts
  • Volume charts
  • Bar charts
  • 3D and 2D graphs charts
  • Many primitives to build custom charts (spheres, triangles, polygons, ...)

Flexible layout

  • Colorbars
  • Colormappers for coloring objects
  • Axis box layout with detailed tick definition and tick rendering tools
  • Contour functions
  • Tooltips
  • Background images
  • 2D post renderers
  • Lights

Algorithms

  • Grid based and Delaunay surface tesselation methods
  • 3d line strip interpolation to smooth pathes (Bernstein 3d)
  • 2d envelopes (Convex hulls)
  • Polygon ordering for improved transparency rendering
  • Dual depth peeling: scene graph order independent transparency (expected for 1.0)
  • Matlab-like array processors and statistics tools
  • Experimental Support Vector Machine integration (Svm3d)

Interactions

  • Mouse interaction with objects (selection & picking methods)
  • Mouse interaction with chart (rotation, zoom, scale)
  • Key interaction with chart (rotation, zoom, scale)
  • Thread Controllers
  • Animation of objects' structures (surface, series of lines, etc)

High and low level OpenGL programming

  • Hide complexity and provide out of the box solutions for common low level OpenGL tasks
  • Fully cutomizable framework with access to all OpenGL native features through JOGL

Cross platforms and compatible

  • Straightforward integration to either AWT, Swing, Eclipse RCP (SWT), or JavaFX
  • Windows, Unix, and MacOS. Android supposed to work if enable appropriate JOGL jars
  • Offscreen rendering
  • Multiple file formats (Ply, Obj, Matlab, CSV)
  • C# port
  • Python binding
  • Scala example
  • Matlab integration

Extensions

Dependent libraries

Jzy3d depends on the following libraries that are available on Jzy3d Maven repository (See tutorials for recommended Maven setup)

  • jGL provides a pure Java implementation of OpenGL hence allowing CPU rendering as an alternative to GPU rendering (JOGL)
  • jPLY supports the PLY format for loading 3d objects
  • vecmath is a clone of a former java package

How to add to your project

The tutorial provides the code samples you need to add the library to a Maven project.

Download sources & javadocs in IDE

If you did not built the framework yourself and depend on Jzy3D Maven Repository, then you may wish to see sources and javadoc in your IDE. Simply call :

mvn dependency:resolve -Dclassifier=javadoc
mvn dependency:resolve -Dclassifier=sources

How to build

From command line

Build all

Run unit tests only

This will run all test named **/Test*.java or **/*Test.java.

mvn clean install

Run unit tests and automated integration tests

Integration tests compare charts to baseline images pixel wise. They are important in te toolbelt but have the drawback of being less portable accross computers

  • Different OS have different frame insets (changing actual rendering area size) leading to chart screenshots of different size accross OS.
  • Different OS have different frame insets (changing actual rendering area size) leading to chart a different layout (colorbar position)
  • Different OS have different font rasterization (despite using the JVM font raterizer to minimize OS impact), hence text labels do not match despite having only a few pixel difference.
  • A non HiDPI chart screenshot will not have the same size than the baseline that was generated on a Retina display (x2 pixel ratio). Integration tests that may be impacted by HiDPI are gathered in jzy3d-tests-java9 since at lest Java 9 JREs are required to detect HiDPI for EmulGL charts.

This will run all test named **/ITTest*.java and unit tests.

mvn clean install -Pintegration-tests

Skip automated tests

This will skip all tests (unit and integration)

mvn clean install -DskipTests

Manual tests

Some test require a manual verification.

Deploy source & javadocs

mvn clean source:jar javadoc:jar deploy

Generate javadoc site

Comment module jzy3d-tutorial manually

mvn compile javadoc:javadoc javadoc:aggregate

From intellij

Follow these steps to import in IntelliJ

  • open an existing unrelated project
  • file->new project from version control
  • close the imported project window
  • from the unrelated project ->file-> new project from existing sources -> select the new projects location
  • from new project select top -> file -> add framework-> maven
  • file -> set module language level

From eclipse

Import Maven project or Import Maven project from SCM

How to get help

Changes in 2.0 version

Version 2.0 is a major refactor to allow using multiple OpenGL implementations, which opened the door to EmulGL. To ease porting your 1.* charts, we add the following cheatsheet.

Renamings

Class name in 1.* Class name in 2.0
Quality.Advanced, Intermediate Quality.Advanced(), Intermediate()
AbstractDrawable Drawable
AbstractWireframeable Wireframeable
AxeBox AxisBox
DrawableTexture NativeDrawableImage & EmulGLDrawableImage
IChartComponentFactory IChartFactory
AWTChartComponentFactory AWTChartFactory
NewtChartComponentFactory NewtChartFactory
JavaFXChartComponentFactory JavaFXChartFactory
SwingChartComponentFactory SwingChartFactory
SWTChartComponentFactory SWTChartFactory
FallbackChartFactory
ColorbarViewportLayout ViewAndColorbarsLayout
ViewMouseController NewtViewCameraController
Halign Horizontal
Valign Vertical
Surface SurfaceBuilder

work in progress.

SurfaceBuilder is not static anymore to be overridable.

Additions

  • IPainter
  • IPainterFactory
  • EmulGLPainterFactory
  • IAnimator
  • IImageWrapper and SymbolHandler

Deletions