¿Cómo utilizar la biblioteca de gráficos Jzy3d Java 3D?

Can someone please give me some extra basic example of how jzy3d ¿debería ser usado?
(The source site's examples don't seam to work for me)

Probé el siguiente código:

import org.jzy3d.chart.Chart;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import org.jzy3d.colors.colormaps.ColorMapRainbow;
import org.jzy3d.maths.Range;
import org.jzy3d.plot3d.builder.Builder;
import org.jzy3d.plot3d.builder.Mapper;
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
import org.jzy3d.plot3d.primitives.Shape;

public class Test {

    public static void main(String[] args) {

        JFrame frame = new JFrame();
        Chart chart = getChart();

        frame.add((javax.swing.JComponent) chart.getCanvas());

        frame.setSize(800, 800);

    public static Chart getChart() {
        // Define a function to plot
        Mapper mapper = new Mapper() {
            public double f(double x, double y) {
                return 10 * Math.sin(x / 10) * Math.cos(y / 20) * x;

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

        // Create the object to represent the function over the given range.
        org.jzy3d.plot3d.primitives.Shape surface = (Shape) Builder.buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper);
        surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
        //surface.setFace(new ColorbarFace(surface));
        //surface.setFace2dDisplayed(true); // opens a colorbar on the right part of the display

        // Create a chart
        Chart chart = new Chart();
        return chart;

But when I try to run it, I get that exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path

¿Alguien puede ayudarme?

preguntado el 08 de noviembre de 11 a las 09:11

2 Respuestas

Deberías agregar jogl.jar to classpath and jogl.dll a PATH.
Para más información mira aquí y aquí.

Puedes leer jogl Instrucciones de instalación aquí.

respondido 08 nov., 11:14

I follow the first tip of this link : (code.google.com/p/jzy3d/wiki/FAQ). But now I get another error :: Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\UserName\workspace\Test\bin2\win32\jogl.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform - Jsncrdnl

The links helped me found a 64bit version to use in my project. And I can now go farther. Now the problem is relative to the integration in my interface. Indeed, I followed that instructions :: (code.google.com/p/jzy3d/wiki/…). With Swing :: """Exception in thread "main" java.lang.ClassCastException: org.jzy3d.plot3d.rendering.canvas.CanvasAWT cannot be cast to javax.swing.JComponent"""". With AWT :: "Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: com.sun.opengl.impl.JAWTFactory.JAWT_GetAWT0(Ljava/nio/ByteBuffer;)Z" - Jsncrdnl

You should run your program or demo where the JOGL native libraries stand, i.e. ./bin/{platform}. If you are working with Eclipse, right click on the project, choose Propeties, Java Build Path then the Libraries tab. Under the item "jogl.jar - ..." select "Native library location: (None)" and click the Edit button. Press the Workspace... button and select the ./bin/{platform} folder.

respondido 08 nov., 11:14

I follow the first tip of this link but now I get another error :: Exception in thread "main" java.lang.UnsatisfiedLinkError: """C:\Users\UserName\workspace\Test\bin2\win32\jogl.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform """ - Jsncrdnl

You might not be using the appropriate binaries. Try to load the AMD binaries. - Martin

Because you're trying to run the 32 bit demo on a 64 bit JVM. The paltform @Martin was referring to should be amd64 or win64 or whatever path contains the jogl.dll for 64 bits. Or, you can use a 32 bit JVM to run it (to be selected in "Running configuration"). - Mateo

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.