Coordinate System Visualization

Have jReality programming problems or questions? Post them here.
Post Reply
karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Coordinate System Visualization

Post by karunaMaitri » Mon 29. Jun 2009, 04:39

Hello,

I am trying to make coordinate system visible by using CoordinateSystemFactory.
I need to visualize all axes, labels, ticks, arrows and bounding box. I would like to have control over visualizations by setting fonts and colors for axes, box and labels.
When I try to set them up I am not getting the desired results.

I tried using the instructions given in the class description of
CoordinateSystemFactory. If I set the properties suggested in the description,
I can see the grid and axes, but no labels are shown.

But when I add the following properties, I get large fonts, three large cones dominating the figure.
setLabelBoxEdges(int[][] edges)
setLabelColor(Color c)
setLabelFont(Font f)
setLabelScale(double labelScale)
showLabels(boolean b)

The documentation suggests to look at the AxesLabel for Mathematica.
I have not used Mathematica before, and I looked at the following page,
and it shows various capabilities of AxesLabel. Can we do all that?
http://reference.wolfram.com/mathematic ... Label.html

My question is: are there some examples that illustrate the usage of
CoordinateSystemFactory and BoundingBoxUtility classes?


Thank you very much!
Karuna

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Coordinate System Visualization

Post by steffen » Mon 29. Jun 2009, 14:47

Hi,

it seems there is a bug in the CoordinateSystemFactory, no ticks are rendered for the z-axis. But the other things seem to work as they should, like setting colors etc. If your font is too large, scale it down with setLabelScale, try something like 0.001. Please give more details what does not work, and post some code that you use to adapt the factory. What size is the bounding box of what you want to have in the coordinate system?

Ah: About Mathematica - I think this is only relevant for the method setLabelBoxEdges...

I hope we get the bug fixed soon...

Steffen.

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Coordinate System Visualization

Post by karunaMaitri » Tue 30. Jun 2009, 09:49

Thank you for your suggestions. Setting up different values for
font and label scale did help to resolve some of the problems.

Here are two different set ups and their corresponding results.
I have also indicated the problems I encountered.
I put the complete code at the end.

1. Setup

Color blue = new Color(0, 0, 255);
CoordinateSystemFactory factory2 = new CoordinateSystemFactory(sgc, axisScale);
factory2.showAxes(true);
factory2.setLabelColor(blue);
factory2.showLabels(true);
factory2.showAxesArrows(true);

Result: XY axes, shows blue labels and ticks.
Problems: The X and Y labels are written onto arows and are not visible.
The x ticks are written onto X-axis.
Shows z at the origin.

2. Set up

double axisScale = 5.0;
Font font = new Font("TimesRoman", Font.PLAIN, 50);
int[][] edges = new int[][]{{1, 1}, {1, 1}, {-1, -1}};
Color green = new Color(0, 255, 0);
Color blue = new Color(0, 0, 255);
Color red = new Color(255, 0, 0);
CoordinateSystemFactory factory2 = new CoordinateSystemFactory(sgc, axisScale);
factory2.setLabelBoxEdges(edges);
factory2.setLabelScale(.02);
factory2.setLabelFont(font);
factory2.showAxes(true);
factory2.setLabelColor(blue);
factory2.showLabels(true);
factory2.showAxesArrows(true);

factory2.showBox(true);
factory2.beautify(true);


Result shows box and grid.
Problems: Multiple lines at axes,
Overlapping labels
I changed the argument values for setLabelBoxEdges without any effect.


3. I cannot find methods in the CoordinateSystemFactory class to
a. make grid "dotted" so that it does not distract from the curve.
b. to add labels to curve directly at different points.


++++++++++++++++++++++++++++++++++++
Here is the code. It draws a simple curve given 13 points.

public class CoordinateAxesTest {

public static void main(String[] args) {
CoordinateAxesTest test = new CoordinateAxesTest();
}

public CoordinateAxesTest() {
ViewerApp va = new ViewerApp(createCurveGeometry());

CameraUtility.encompass(va.getCurrentViewer());

JFrame f = new JFrame();
f.getContentPane().add((Component) va.getViewingComponent());

f.setSize(512, 512);
f.validate();
f.setVisible(true);
}

public SceneGraphComponent createCurveGeometry() {
SceneGraphComponent sgc = new SceneGraphComponent();
IndexedLineSetFactory factory = new IndexedLineSetFactory();
double[][] vertices = generatePoints();
int[][] edgeIndices = createEdgeIndices(vertices);

factory.setVertexCount(vertices.length);
factory.setVertexCoordinates(vertices);
factory.setLineCount(edgeIndices.length);
factory.setEdgeIndices(edgeIndices);

factory.update();

sgc.setGeometry(factory.getPointSet());
sgc.setGeometry(factory.getIndexedLineSet());

double axisScale = 5.0;
Font font = new Font("TimesRoman", Font.PLAIN, 50);
int[][] edges = new int[][]{{-1, 1}, {-1, 1}, {1, 1}};
Color green = new Color(0, 255, 0);
Color blue = new Color(0, 0, 255);
Color red = new Color(255, 0, 0);
CoordinateSystemFactory factory2 = new CoordinateSystemFactory(sgc, axisScale);
factory2.setLabelBoxEdges(edges);
factory2.setLabelScale(.02);
factory2.setLabelFont(font);
factory2.showAxes(true);
factory2.setLabelColor(blue);
factory2.showLabels(true);
factory2.showAxesArrows(true);
factory2.setColor(green);
factory2.setGridColor(red);

factory2.showBox(true);
factory2.beautify(true);

return sgc;
}

public int[][] createEdgeIndices(double[][] points) {
int[][] edges = new int[points.length - 1][2];

for (int i = 0; i < points.length - 1; i++) {
edges[i][0] = i;
edges[i][1] = i + 1;
}
return edges;
}

public double[][] generatePoints() {
double[][] points = new double[13][3];
double[] point1 = new double[3];
point1 = new double[]{0.0, 0.0, 0.0};
points[0] = point1;

double[] point2 = new double[3];
point2 = new double[]{2.0, 2.0, 0.0};
points[1] = point2;

double[] point3 = new double[3];
point3 = new double[]{5.0, 9.0, 0.0};
points[2] = point3;

double[] point4 = new double[3];
point4 = new double[]{10.0, 10.0, 0.0};
points[3] = point4;

double[] point5 = new double[3];
point5 = new double[]{12.0, 8.0, 0.0};
points[4] = point5;

double[] point6 = new double[3];
point6 = new double[]{18.0, 2.0, 0.0};
points[5] = point6;

double[] point7 = new double[3];
point7 = new double[]{20.0, 0.0, 0.0};
points[6] = point7;

double[] point8 = new double[3];
point8 = new double[]{22.0, 2.0, 0.0};
points[7] = point8;

double[] point9 = new double[3];
point9 = new double[]{25.0, 9.0, 0.0};
points[8] = point9;

double[] point10 = new double[3];
point10 = new double[]{30.0, 10.0, 0.0};
points[9] = point10;

double[] point11 = new double[3];
point11 = new double[]{32.0, 8.0, 0.0};
points[10] = point11;

double[] point12 = new double[3];
point12 = new double[]{38.0, 2.0, 0.0};
points[11] = point12;

double[] point13 = new double[3];
point13 = new double[]{40.0, 0.0, 0.0};
points[12] = point13;

return points;
}
}


Thanks,
Karuna

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: Coordinate System Visualization

Post by gunn » Thu 2. Jul 2009, 17:54

I've fixed some problems with CoordinateSystemFactory. Please update svn and post here if there are still problems with it.

Regarding the other features you want:
1) You can probably get dotted grids (at least in JOGL backend) by activating the LINE_STIPPLE boolean (see the tutorial example de.jreality.tutorial.app.LineShaderExample) in the node containing the coordinate system scene graph component. The problem will be that all the line sets will be dotted, which is not probably what you want.
2) Please explain more what you mean about labels that curve. I'm not sure I understand.
jReality core developer

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Coordinate System Visualization

Post by karunaMaitri » Fri 3. Jul 2009, 05:31

Hi Charles, thanks for your reply and suggestions. They are very helpful.

I have written code for displaying axes and bounding box, for surfaces
and put it at the end of the message. It is very nice - the axes, labels, ticks and grid lines are all clear, including the surface. I am fascinated with jReality. It is
an extremely useful tool. I can see that it can be very useful for my
visualization research work.

About adding labels to curves, let me explain it within the context of two
examples. Let us say I am trying to explain Nurbs curves using basis
functions. In order to explain how different polynomials sum up to a
nurbs curve at each point, it is important to show labels for each polynomial
curve (of basis functions). To make things clear, the labels need to appear
directly on the polynomial curves.

As a second example, let us take a freeform surface, where we would like
the user to identify some of the regions with labels.Some examples include
plateaus or valleys. Thus a surface may have several labels attached to it.
I hope this explanation makes it clear.

I have tried the 'cvs' code but I did not have success running it as my IntelliJ
Idea was showing several errors. These errors are in 'audio' directory and
also in ui\viewerapp directory. I have used the code from your download
site.

[code]
import de.jreality.scene.IndexedFaceSet;
import de.jreality.scene.SceneGraphComponent;
import de.jreality.scene.Appearance;
import de.jreality.geometry.QuadMeshFactory;
import de.jreality.geometry.CoordinateSystemFactory;
import de.jreality.util.SceneGraphUtility;
import de.jreality.util.CameraUtility;
import de.jreality.shader.CommonAttributes;
import de.jreality.ui.viewerapp.ViewerApp;

import java.awt.*;
import java.text.DecimalFormat;


public class SimpleSurfaceTesting {

private double[][][] points;
private int uCount = 0;
private int vCount = 0;
private IndexedFaceSet theSurface;

public static void main(String[] args) {
SimpleSurfaceTesting testing = new SimpleSurfaceTesting();
}

public SimpleSurfaceTesting() {
SceneGraphComponent sgc = SceneGraphUtility.createFullSceneGraphComponent("world");
sgc.setGeometry(create3DSurface(50));
Appearance ap = sgc.getAppearance();
ap.setAttribute(CommonAttributes.POLYGON_SHADER + "." + CommonAttributes.DIFFUSE_COLOR, Color.CYAN);
ap.setAttribute(CommonAttributes.TUBES_DRAW, false);
ap.setAttribute(CommonAttributes.LINE_WIDTH, 1.0);

double axisScale = 5.0;
Font font = new Font("TimesRoman", Font.PLAIN, 50);
int[][] edges = new int[][]{{-1, 1}, {-1, 1}, {-1, -1}};
Color green = new Color(0, 255, 0);
Color blue = new Color(0, 0, 255);
Color red = new Color(255, 0, 0);
Color gray = new Color(131, 138, 131);
Color darkviolet = new Color(148, 0, 211);
CoordinateSystemFactory factory2 = new CoordinateSystemFactory(sgc, axisScale);
factory2.setLabelBoxEdges(edges);
factory2.setLabelScale(.02);
factory2.setLabelFont(font);
factory2.showAxes(true);
factory2.setLabelColor(blue);
factory2.showLabels(true);
factory2.showAxesArrows(true);
factory2.setColor(darkviolet);
//factory2.showGrid(false);
factory2.setGridColor(red);
factory2.setBoxColor(gray);

factory2.showBox(true);
factory2.beautify(true);


ViewerApp va = ViewerApp.display(sgc);
va.setAttachNavigator(true);
va.setExternalNavigator(false);
va.update();
va.setBackgroundColor(Color.LIGHT_GRAY);
CameraUtility.encompass(va.getCurrentViewer());
//ViewerApp va = ViewerApp.display(create3DSurface( 50 ));
//CameraUtility.encompass(va.getCurrentViewer());

}

public IndexedFaceSet create3DSurface(int N) {

if (N < 2)
throw new IllegalArgumentException("n neets to be greater then 1");

QuadMeshFactory factory = new QuadMeshFactory();
uCount = 20;
vCount = 20;

double[][][] coords = generate3DPoints(20, 20);
factory.setVLineCount(vCount);
factory.setULineCount(uCount);


factory.setVertexCoordinates(coords);

factory.setGenerateFaceNormals(true);
factory.setGenerateTextureCoordinates(true);

factory.update();

return factory.getIndexedFaceSet();
}


public double roundTwoDecimals(double d) {
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(d));
}

public double[][][] generate3DPoints(int uValues, int vValues) {
//float qrtX = (lrgX - smX) / 4.0f;
//float threeQrtX = 3.0f * qrtX;
//float qrtY = (lrgY - smY) / 4.0f;
//float threeQrtY = 3.0f * qrtY;
//float zVal = 0.0f;
int quarterU = uValues / 4;
int quarterV = vValues / 4;
int threeQuartU = uValues * 3 / 4;
int threeQuartV = vValues * 3 / 4;
int midPointU = uValues / 2;
int midPointV = vValues / 2;

double[][][] points = new double[vValues][uValues][3];

for (int v = 0; v < vValues; v++) {
for (int u = 0; u < uValues; u++) {
double[] point = new double[3];
//Point3D p3D = new Point3D();
if ((u > threeQuartU) || (v > threeQuartV) || (u < quarterU) || (v < quarterV)) {
point[0] = u;
point[1] = v;
point[2] = 0.0f;
points[u][v] = point;
} else if (u < midPointU) {
point[0] = u;
point[1] = v;
point[2] = u;
points[u][v] = point;
} else if (v < midPointV) {
point[0] = u;
point[1] = v;
point[2] = v;
points[u][v] = point;
} else if (u > midPointU) {
point[0] = u;
point[1] = v;
point[2] = uValues - u;
points[u][v] = point;
} else if (v > midPointV) {
point[0] = u;
point[1] = v;
point[2] = vValues - v;
points[u][v] = point;
} else if ((u == midPointU) || (v == midPointV)) {
point[0] = u;
point[1] = v;
point[2] = u;
points[u][v] = point;
}
}
}
return points;
}
}

[/code]

Thank you very much!
Prabhakar

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: Coordinate System Visualization

Post by gunn » Fri 3. Jul 2009, 15:40

If I understand your question correctly, you want to place 3D text in arbitrary positions in your scene, not just as in the coordinate system factory.

This is possible. One place to start is the tutorial on 3D text.

For your purpose, you need to create a point set that has points located at those positions where you want to place the text in 3-space. Use a PointSetFactory for this purpose (See this tutorial.) Attach the labels you want to display using the setLabels() method on the PointSetFactory. If you don't want to see the points themselves (which is probably the case), then set the global appearance attribute CommonAttributes.POINT_RADIUS to 0.0 for the scene graph component containing this point set. This will make the points themselves vanishingly small. (Turning off display of points by using the attribute CommonAttributes.VERTEX_DRAW is not the way to go, since this will also turn off display of the associated labels.) Set the desired text shader settings using the methods shown in the first tutorial above.
jReality core developer

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Coordinate System Visualization

Post by karunaMaitri » Tue 7. Jul 2009, 05:46

Thanks Charles!

I have used your suggestions in my code (attach below).
The labels are nice and useful.

I am not sure how to change the attributes of labels for the
points, edges and faces. If you uncomment the code in labels
method, it changes the colors of the faces as well.

I have two specific questions:
1. How do we modify the colors of labels for points, edges and faces, without changing the attributes of the rest of the geometry.

2. If I want to change other attributes (such as font) of the labels, how can I do it?

Code: Select all

import de.jreality.scene.IndexedFaceSet;
import de.jreality.scene.SceneGraphComponent;
import de.jreality.scene.Appearance;
import de.jreality.scene.data.Attribute;
import de.jreality.scene.data.StorageModel;
import de.jreality.util.SceneGraphUtility;
import de.jreality.util.CameraUtility;
import de.jreality.shader.CommonAttributes;
import de.jreality.geometry.CoordinateSystemFactory;
import de.jreality.geometry.QuadMeshFactory;
import de.jreality.ui.viewerapp.ViewerApp;

import java.awt.*;
import java.text.DecimalFormat;
import java.util.Random;

public class SurfaceWithLabelsTest {
    private double[][][] points;
    private int uCount = 0;
    private int vCount = 0;
    private IndexedFaceSet theSurface;

    public static void main(String[] args) {
        SurfaceWithLabelsTest testing = new SurfaceWithLabelsTest();
    }

    public SurfaceWithLabelsTest() {
        SceneGraphComponent sgc = SceneGraphUtility.createFullSceneGraphComponent("world");
        theSurface = create3DSurface(50);
        label(theSurface);
        sgc.setGeometry(theSurface);
        Appearance ap = sgc.getAppearance();
        ap.setAttribute(CommonAttributes.POLYGON_SHADER + "." + CommonAttributes.DIFFUSE_COLOR, Color.YELLOW);
        ap.setAttribute(CommonAttributes.TUBES_DRAW, true);
        ap.setAttribute(CommonAttributes.LINE_WIDTH, 2.0);

        double axisScale = 5.0;
        Font font = new Font("TimesRoman", Font.PLAIN, 50);
        int[][] edges = new int[][]{{-1, 1}, {-1, 1}, {-1, -1}};
        Color green = new Color(0, 255, 0);
        Color blue = new Color(0, 0, 255);
        Color red = new Color(255, 0, 0);
        Color gray = new Color(131, 138, 131);
        Color darkviolet = new Color(148, 0, 211);
        CoordinateSystemFactory factory2 = new CoordinateSystemFactory(sgc, axisScale);
        factory2.setLabelBoxEdges(edges);
        factory2.setLabelScale(.02);
        factory2.setLabelFont(font);
        factory2.showAxes(true);
        factory2.setLabelColor(blue);
        factory2.showLabels(true);
        factory2.showAxesArrows(true);
        factory2.setColor(darkviolet);
        //factory2.showGrid(false);
        factory2.setGridColor(red);
        factory2.setBoxColor(gray);

        factory2.showBox(true);
        factory2.beautify(true);


        ViewerApp va = ViewerApp.display(sgc);
        va.setAttachNavigator(true);
        va.setExternalNavigator(false);
        va.update();
        va.setBackgroundColor(Color.LIGHT_GRAY);
        CameraUtility.encompass(va.getCurrentViewer());

    }

    public IndexedFaceSet create3DSurface(int N) {

        if (N < 2)
            throw new IllegalArgumentException("n neets to be greater then 1");

        QuadMeshFactory factory = new QuadMeshFactory();
        uCount = 20;
        vCount = 20;

        double[][][] coords = generate3DPoints(20, 20);
        factory.setVLineCount(vCount);
        factory.setULineCount(uCount);
         factory.setVLineCount(vCount);
        factory.setULineCount(uCount);
        factory.setClosedInUDirection(false);
		factory.setClosedInVDirection(false);
        factory.setVertexCoordinates(coords);
        factory.setGenerateFaceNormals(true);
        factory.setGenerateTextureCoordinates(true);
        factory.setGenerateEdgesFromFaces(true);
		factory.setEdgeFromQuadMesh(true);	// generate "long" edges: one for each u-, v- parameter curve

        factory.update();

        return factory.getIndexedFaceSet();
    }


    public double roundTwoDecimals(double d) {
        DecimalFormat twoDForm = new DecimalFormat("#.##");
        return Double.valueOf(twoDForm.format(d));
    }

    public double[][][] generate3DPoints(int uValues, int vValues) {

        int quarterU = uValues / 4;
        int quarterV = vValues / 4;
        int threeQuartU = uValues * 3 / 4;
        int threeQuartV = vValues * 3 / 4;
        int midPointU = uValues / 2;
        int midPointV = vValues / 2;

        double[][][] points = new double[vValues][uValues][3];

        for (int v = 0; v < vValues; v++) {
            for (int u = 0; u < uValues; u++) {
                double[] point = new double[3];
                if ((u > threeQuartU) || (v > threeQuartV) || (u < quarterU) || (v < quarterV)) {
                    point[0] = u;
                    point[1] = v;
                    point[2] = 0.0f;
                    points[u][v] = point;
                } else if (u < midPointU) {
                    point[0] = u;
                    point[1] = v;
                    point[2] = u;
                    points[u][v] = point;
                } else if (v < midPointV) {
                    point[0] = u;
                    point[1] = v;
                    point[2] = v;
                    points[u][v] = point;
                } else if (u > midPointU) {
                    point[0] = u;
                    point[1] = v;
                    point[2] = uValues - u;
                    points[u][v] = point;
                } else if (v > midPointV) {
                    point[0] = u;
                    point[1] = v;
                    point[2] = vValues - v;
                    points[u][v] = point;
                } else if ((u == midPointU) || (v == midPointV)) {
                    point[0] = u;
                    point[1] = v;
                    point[2] = u;
                    points[u][v] = point;
                }
            }
        }
        return points;
    }

     public static void label(IndexedFaceSet ps) {
          /*double[][] vc = ps.getVertexAttributes(Attribute.COORDINATES).
			toDoubleArrayArray(null);
		for (double[] c : vc) for (int i = 0; i<3; ++i) c[i] = .5 + .5*c[i];
		ps.setVertexAttributes(Attribute.COLORS,
				StorageModel.DOUBLE_ARRAY.array(3).createReadOnly(vc));*/
        int n = ps.getNumPoints();
        String[] labels = new String[n];
         Random ran = new Random();
         for (int i = 0; i < n; i = i+5+ ran.nextInt(10)) labels[i] = "Point " + i;
        ps.setVertexAttributes(Attribute.LABELS, StorageModel.STRING_ARRAY.createReadOnly(labels));


        n = ps.getNumEdges();
        labels = new String[n];
        for (int i = 0; i < n; i = i + 2+ ran.nextInt(5)) labels[i] = "Edge " + i;
        ps.setEdgeAttributes(Attribute.LABELS, StorageModel.STRING_ARRAY.createReadOnly(labels));

        n = ps.getNumFaces();
        labels = new String[n];
        for (int i = 0; i < n; i = i +5+ ran.nextInt(10)) labels[i] = "Face " + i;
        ps.setFaceAttributes(Attribute.LABELS, StorageModel.STRING_ARRAY.createReadOnly(labels));
    }
}


Thank you very much!
Karuna

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: Coordinate System Visualization

Post by gunn » Tue 7. Jul 2009, 13:58

The code as you provided it didn't run for me since there were many "nulls" in the array of labels you created. It ran when I forced every String to be non-null.

Regarding your questions,

0. Take a look first at the tutorial example de.jreality.tutorial.geom.LabelsOnCube.

1. There is currently no support for changing the color of the labels beyond the setDiffuseColor() method on the TextShader interfaces (see tutorial example). That means, regardless of the color of the associated vertex, edge or face, the color of the label is determined by this color. The default is white.

2. The tutorial example shows how to change the properties of the displayed labels, including the font.
jReality core developer

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Coordinate System Visualization

Post by karunaMaitri » Mon 21. Sep 2009, 04:52

Hi,

I am interested to make my visualizations provide quantitative as well as symbolic information. Within this broad context I am trying to set up a visualization with multiple curves. This visualization also shows coordinate system and labels to identify each curve. An example is to display derivatives of NURBS curves and surfaces. To each curve I attach a label such as N03_D1 indicating that it is the first derivative (D1) of N03 basis function.

I have been using modified code from two examples given in jReality code: de.jreality.geometry.CoordinateSystemTest for coordinate system, and de.jreality.tutorial.app.LineShaderExample for attaching labels to curves.
I am encountering several problems.
*************************************
First, the code from CoordinateSystemTest works for some curves but the labels on the axes become invisible. When I tried to change the properties, I get the following error.

Code: Select all

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at java.lang.Object.clone(Native Method)
	at de.jreality.shader.ImageData.getByteArray(ImageData.java:244)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:304)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:143)
	at de.jreality.jogl.JOGLRendererHelper.renderLabels(JOGLRendererHelper.java:750)
	at de.jreality.jogl.JOGLRendererHelper.drawPointLabels(JOGLRendererHelper.java:685)
	at de.jreality.jogl.JOGLPeerGeometry.render(JOGLPeerGeometry.java:93)
	at de.jreality.jogl.JOGLPeerComponent$1.run(JOGLPeerComponent.java:123)
	at de.jreality.scene.Scene.executeReader(Scene.java:81)
	at de.jreality.jogl.JOGLPeerComponent.preRender(JOGLPeerComponent.java:181)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:142)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLRenderer.renderOnePass(JOGLRenderer.java:268)
	at de.jreality.jogl.JOGLRenderer.render(JOGLRenderer.java:215)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:539)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:406)
	at de.jreality.jogl.AbstractViewer.display(AbstractViewer.java:363)
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at java.lang.Object.clone(Native Method)
	at de.jreality.shader.ImageData.getByteArray(ImageData.java:244)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:304)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:143)
	at de.jreality.jogl.JOGLRendererHelper.renderLabels(JOGLRendererHelper.java:750)
	at de.jreality.jogl.JOGLRendererHelper.drawPointLabels(JOGLRendererHelper.java:685)
	at de.jreality.jogl.JOGLPeerGeometry.render(JOGLPeerGeometry.java:93)
	at de.jreality.jogl.JOGLPeerComponent$1.run(JOGLPeerComponent.java:123)
	at de.jreality.scene.Scene.executeReader(Scene.java:81)
	at de.jreality.jogl.JOGLPeerComponent.preRender(JOGLPeerComponent.java:181)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:142)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLRenderer.renderOnePass(JOGLRenderer.java:268)
	at de.jreality.jogl.JOGLRenderer.render(JOGLRenderer.java:215)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:539)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:406)
	at de.jreality.jogl.AbstractViewer.display(AbstractViewer.java:363)


Here are the settings I used:

Code: Select all

public void createCoordinateSystem(SceneGraphComponent component){
		 //create coordinate system
	    final CoordinateSystemFactory coords = new CoordinateSystemFactory(component);
	    //SET PROPERTIES:
	    coords.setAxisScale(0.25);
	    coords.setLabelScale(0.005);
	    //coords.showBoxArrows(true);
	    coords.showAxesArrows(true);
	    //coords.showLabels(false);
	    //coords.setColor(Color.RED);
	    //coords.setGridColor(Color.GRAY);
	    coords.setLabelColor(Color.MAGENTA);
	    coords.setLabelFont(new Font("Sans Serif", Font.PLAIN, 72));
	    
	    
	    //display axes/box/grid
	    //coords.showAxes(false);
	    coords.showBox(true);
	    //coords.showGrid(false);
	    
	    //beautify box
	    coords.beautify(true);
	}
As I understand, it requires a lot of memory. It slows down quite a bit.
At present, I do not have a clear idea as how to choose settings that would not effect the performance of my programs. If you can point out to some documentation as how to set values, it will be helpful!
***********************************
Second, my program uses label program from your LineShader example as well as the CoordinateSystemTest program. It works fine when the number of curves to be displayed are small (say 7), but it gives the following error when I have large number of curves (say 35).

Code: Select all

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at java.lang.Object.clone(Native Method)
	at de.jreality.shader.ImageData.getByteArray(ImageData.java:244)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:304)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:143)
	at de.jreality.jogl.JOGLRendererHelper.renderLabels(JOGLRendererHelper.java:750)
	at de.jreality.jogl.JOGLRendererHelper.drawPointLabels(JOGLRendererHelper.java:685)
	at de.jreality.jogl.JOGLPeerGeometry.render(JOGLPeerGeometry.java:93)
	at de.jreality.jogl.JOGLPeerComponent$1.run(JOGLPeerComponent.java:123)
	at de.jreality.scene.Scene.executeReader(Scene.java:81)
	at de.jreality.jogl.JOGLPeerComponent.preRender(JOGLPeerComponent.java:181)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:142)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLRenderer.renderOnePass(JOGLRenderer.java:268)
	at de.jreality.jogl.JOGLRenderer.render(JOGLRenderer.java:215)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:539)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:406)
	at de.jreality.jogl.AbstractViewer.display(AbstractViewer.java:363)
	at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)
	at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:435)
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
	at java.lang.Object.clone(Native Method)
	at de.jreality.shader.ImageData.getByteArray(ImageData.java:244)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:304)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:143)
	at de.jreality.jogl.JOGLRendererHelper.renderLabels(JOGLRendererHelper.java:750)
	at de.jreality.jogl.JOGLRendererHelper.drawPointLabels(JOGLRendererHelper.java:685)
	at de.jreality.jogl.JOGLPeerGeometry.render(JOGLPeerGeometry.java:93)
	at de.jreality.jogl.JOGLPeerComponent$1.run(JOGLPeerComponent.java:123)
	at de.jreality.scene.Scene.executeReader(Scene.java:81)
	at de.jreality.jogl.JOGLPeerComponent.preRender(JOGLPeerComponent.java:181)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:142)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLRenderer.renderOnePass(JOGLRenderer.java:268)
	at de.jreality.jogl.JOGLRenderer.render(JOGLRenderer.java:215)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:539)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:406)
	at de.jreality.jogl.AbstractViewer.display(AbstractViewer.java:363)
	at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)
	at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:435)
java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(EventQueue.java:997)
	at de.jreality.jogl.AbstractViewer.render(AbstractViewer.java:444)
	at de.jreality.ui.viewerapp.ViewerSwitch.render(ViewerSwitch.java:198)
	at de.jreality.util.RenderTrigger$RenderTriggerSingleCaster.render(RenderTrigger.java:222)
	at de.jreality.util.RenderTrigger.fireRender(RenderTrigger.java:138)
	at de.jreality.util.RenderTrigger.visibilityChanged(RenderTrigger.java:166)
	at de.jreality.scene.event.SceneGraphComponentEventMulticaster.visibilityChanged(SceneGraphComponentEventMulticaster.java:97)
	at de.jreality.scene.event.SceneGraphComponentEventMulticaster.visibilityChanged(SceneGraphComponentEventMulticaster.java:97)
	at de.jreality.scene.event.SceneGraphComponentEventMulticaster.visibilityChanged(SceneGraphComponentEventMulticaster.java:97)
	at de.jreality.scene.event.SceneGraphComponentEventMulticaster.visibilityChanged(SceneGraphComponentEventMulticaster.java:97)
	at de.jreality.scene.SceneGraphComponent.fire(SceneGraphComponent.java:677)
	at de.jreality.scene.SceneGraphComponent.fire(SceneGraphComponent.java:694)
	at de.jreality.scene.SceneGraphComponent.writingFinished(SceneGraphComponent.java:702)
	at de.jreality.scene.SceneGraphNode.finishWriter(SceneGraphNode.java:143)
	at de.jreality.scene.SceneGraphComponent.setVisible(SceneGraphComponent.java:577)
	at de.jreality.geometry.CoordinateSystemFactory.updateBox(CoordinateSystemFactory.java:977)
	at de.jreality.geometry.CoordinateSystemBeautifier$1.transformationMatrixChanged(CoordinateSystemBeautifier.java:82)
	at de.jreality.scene.SceneGraphPathObserver.fireTransformationChanged(SceneGraphPathObserver.java:181)
	at de.jreality.scene.SceneGraphPathObserver.transformationMatrixChanged(SceneGraphPathObserver.java:203)
	at de.jreality.geometry.CoordinateSystemBeautifier.perform(CoordinateSystemBeautifier.java:86)
	at de.jreality.toolsystem.ToolSystem.processToolSet(ToolSystem.java:677)
	at de.jreality.toolsystem.ToolSystem.processTriggerQueue(ToolSystem.java:571)
	at de.jreality.toolsystem.ToolSystem.processToolEvent(ToolSystem.java:456)
	at de.jreality.toolsystem.ToolEventQueue$1.run(ToolEventQueue.java:82)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.OutOfMemoryError: Java heap space
	at java.lang.Object.clone(Native Method)
	at de.jreality.shader.ImageData.getByteArray(ImageData.java:244)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:304)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:143)
	at de.jreality.jogl.JOGLRendererHelper.renderLabels(JOGLRendererHelper.java:750)
	at de.jreality.jogl.JOGLRendererHelper.drawPointLabels(JOGLRendererHelper.java:685)
	at de.jreality.jogl.JOGLPeerGeometry.render(JOGLPeerGeometry.java:93)
	at de.jreality.jogl.JOGLPeerComponent$1.run(JOGLPeerComponent.java:123)
	at de.jreality.scene.Scene.executeReader(Scene.java:81)
	at de.jreality.jogl.JOGLPeerComponent.preRender(JOGLPeerComponent.java:181)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:142)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLRenderer.renderOnePass(JOGLRenderer.java:268)
	at de.jreality.jogl.JOGLRenderer.render(JOGLRenderer.java:215)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:539)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:406)
	at de.jreality.jogl.AbstractViewer.display(AbstractViewer.java:363)
	at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)
	at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:435)
java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(EventQueue.java:997)
	at de.jreality.jogl.AbstractViewer.render(AbstractViewer.java:444)
	at de.jreality.ui.viewerapp.ViewerSwitch.render(ViewerSwitch.java:198)
	at de.jreality.util.RenderTrigger$RenderTriggerSingleCaster.render(RenderTrigger.java:222)
	at de.jreality.util.RenderTrigger.fireRender(RenderTrigger.java:138)
	at de.jreality.util.RenderTrigger.visibilityChanged(RenderTrigger.java:166)
	at de.jreality.scene.event.SceneGraphComponentEventMulticaster.visibilityChanged(SceneGraphComponentEventMulticaster.java:97)
	at de.jreality.scene.event.SceneGraphComponentEventMulticaster.visibilityChanged(SceneGraphComponentEventMulticaster.java:97)
	at de.jreality.scene.event.SceneGraphComponentEventMulticaster.visibilityChanged(SceneGraphComponentEventMulticaster.java:97)
	at de.jreality.scene.event.SceneGraphComponentEventMulticaster.visibilityChanged(SceneGraphComponentEventMulticaster.java:97)
	at de.jreality.scene.SceneGraphComponent.fire(SceneGraphComponent.java:677)
	at de.jreality.scene.SceneGraphComponent.fire(SceneGraphComponent.java:694)
	at de.jreality.scene.SceneGraphComponent.writingFinished(SceneGraphComponent.java:702)
	at de.jreality.scene.SceneGraphNode.finishWriter(SceneGraphNode.java:143)
	at de.jreality.scene.SceneGraphComponent.setVisible(SceneGraphComponent.java:577)
	at de.jreality.geometry.CoordinateSystemFactory.updateBox(CoordinateSystemFactory.java:977)
	at de.jreality.geometry.CoordinateSystemBeautifier$1.transformationMatrixChanged(CoordinateSystemBeautifier.java:82)
	at de.jreality.scene.SceneGraphPathObserver.fireTransformationChanged(SceneGraphPathObserver.java:181)
	at de.jreality.scene.SceneGraphPathObserver.transformationMatrixChanged(SceneGraphPathObserver.java:203)
	at de.jreality.geometry.CoordinateSystemBeautifier.perform(CoordinateSystemBeautifier.java:86)
	at de.jreality.toolsystem.ToolSystem.processToolSet(ToolSystem.java:677)
	at de.jreality.toolsystem.ToolSystem.processTriggerQueue(ToolSystem.java:571)
	at de.jreality.toolsystem.ToolSystem.processToolEvent(ToolSystem.java:456)
	at de.jreality.toolsystem.ToolEventQueue$1.run(ToolEventQueue.java:82)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.OutOfMemoryError: Java heap space
	at java.lang.Object.clone(Native Method)
	at de.jreality.shader.ImageData.getByteArray(ImageData.java:244)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:304)
	at de.jreality.jogl.shader.Texture2DLoaderJOGL.render(Texture2DLoaderJOGL.java:143)
	at de.jreality.jogl.JOGLRendererHelper.renderLabels(JOGLRendererHelper.java:750)
	at de.jreality.jogl.JOGLRendererHelper.drawPointLabels(JOGLRendererHelper.java:685)
	at de.jreality.jogl.JOGLPeerGeometry.render(JOGLPeerGeometry.java:93)
	at de.jreality.jogl.JOGLPeerComponent$1.run(JOGLPeerComponent.java:123)
	at de.jreality.scene.Scene.executeReader(Scene.java:81)
	at de.jreality.jogl.JOGLPeerComponent.preRender(JOGLPeerComponent.java:181)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:142)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLPeerComponent.renderChildren(JOGLPeerComponent.java:189)
	at de.jreality.jogl.JOGLPeerComponent.render(JOGLPeerComponent.java:143)
	at de.jreality.jogl.JOGLRenderer.renderOnePass(JOGLRenderer.java:268)
	at de.jreality.jogl.JOGLRenderer.render(JOGLRenderer.java:215)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:539)
	at de.jreality.jogl.JOGLRenderer.display(JOGLRenderer.java:406)
	at de.jreality.jogl.AbstractViewer.display(AbstractViewer.java:363)
	at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)
	at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:435)
The prgoram I have used has the following two methods.

Code: Select all

public void drawCurveWithLabel2(double[][] verts, int index1, int index2, SceneGraphComponent sgc,
			Color color) {
		SceneGraphComponent child = SceneGraphUtility
				.createFullSceneGraphComponent("child" + index1 + index2);
		sgc.addChild(child);
		int numPoints = verts.length;
		int[][] edges = createEdgeIndices(verts);
		// double[][] edgeColors = createEdgeColors(edges.length, index);
		int labelPoint = numPoints / 2;

		//setUpLabelForCurve2(child, color, verts, labelPoint, index1, index2);
		// set up the indexed line set for this example
		IndexedLineSetFactory lsf = new IndexedLineSetFactory();
		lsf.setVertexCount(numPoints);
		lsf.setVertexCoordinates(verts);
		lsf.setVertexNormals(verts); // outward pointing normals for lighting
		// enabled
		lsf.setEdgeCount(edges.length);
		lsf.setEdgeIndices(edges);

		lsf.update();
		IndexedLineSet ils = lsf.getIndexedLineSet();
		child.setGeometry(ils);

		// set up the line shader
		Appearance ap = child.getAppearance();
		defaultGeometryShader = ShaderUtility.createDefaultGeometryShader(ap, true);
		defaultGeometryShader.setShowPoints(false);
		defaultGeometryShader.setShowLines(true);
		RenderingHintsShader rhs = ShaderUtility
				.createDefaultRenderingHintsShader(ap, true);
		DefaultLineShader dls = (DefaultLineShader) defaultGeometryShader
				.createLineShader("default");
		dls.setTubeDraw(false);
		dls.setLineWidth(3.0);
		dls.setDiffuseColor(color);
	}

Code: Select all

public void setUpLabelForCurve2(SceneGraphComponent child, Color color,
			double[][] verts, int labelPoint, int index1, int index2) {
		// create the label at the center of the example
		Appearance app = setUpLabels(color, new double[] {
				verts[labelPoint][0], verts[labelPoint][1] + 2,
				verts[labelPoint][2] });
		/*Appearance app = setUpLabels(color, new double[] {
				verts[labelPoint][0], verts[labelPoint][1] + 2 });*/
		SceneGraphComponent labelSGC = SceneGraphUtility
				.createFullSceneGraphComponent(label1 + index1 + "_" + label2 + index2);
		PointSetFactory labelFac = new PointSetFactory();
		labelFac.setVertexCount(1);
		labelFac.setVertexCoordinates(new double[] { verts[labelPoint][0],
				verts[labelPoint][1] + 2, verts[labelPoint][2] });
		/*labelFac.setVertexCoordinates(new double[] { verts[labelPoint][0],
				verts[labelPoint][1] + 2});*/
		labelFac.setVertexLabels(new String[] { label1 + (index1 + 1) + "_"+ label2 + (index2 + 1) });
		labelFac.update();
		labelSGC.setGeometry(labelFac.getPointSet());
		labelSGC.setAppearance(app);
		child.addChild(labelSGC);
	}

Code: Select all

public void setUpCoordinateSystem(SceneGraphComponent component) {
		// create coordinate system
		final CoordinateSystemFactory coords = new CoordinateSystemFactory(
				component);
		// SET PROPERTIES:
		double axisScale = 0.01;
		Font font = new Font("TimesRoman", Font.PLAIN, 60);
		coords.setAxisScale(axisScale);
		coords.setLabelScale(0.01);
		// coords.showBoxArrows(true);
		coords.showAxesArrows(true);
		coords.showLabels(true);
		// coords.setColor(Color.RED);
		// coords.setGridColor(Color.GRAY);
		coords.setLabelColor(Color.DARK_GRAY);
		coords.setLabelFont(font);
		coords.setColor(Color.BLUE);

		// display axes/box/grid
		coords.showAxes(true);
		// coords.showBox(true);
		coords.showGrid(false);

		// beautify box
		coords.beautify(true);
	}
I just discovered that it is working if the coordinate system is specified in the following way. I do not fully understand it why.

Code: Select all

public void createCoordinateSystem(SceneGraphComponent component){
		 //create coordinate system
	    final CoordinateSystemFactory coords = new CoordinateSystemFactory(component);
	    //SET PROPERTIES:
	    //coords.setAxisScale(0.25);
	    //coords.setLabelScale(0.005);
	    //coords.showBoxArrows(true);
	    //coords.showAxesArrows(false);
	    //coords.showLabels(false);
	    //coords.setColor(Color.RED);
	    coords.setGridColor(Color.GRAY);
	    //coords.setLabelColor(Color.MAGENTA);
	    //coords.setLabelFont(new Font("Sans Serif", Font.PLAIN, 72));
	    
	    
	    //display axes/box/grid
	    //coords.showAxes(false);
	    coords.showBox(true);
	    //coords.showGrid(false);
	    
	    //beautify box
	    coords.beautify(true);
	}

It is possible to automate the settings for the coordinate system and the labels for curves and axes? Are there some examples?

Thank you very much!
Karuna

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Coordinate System Visualization

Post by steffen » Mon 21. Sep 2009, 10:06

The problem is probably the font size (72), choose a much smaller font size and increase the label scale instead. I think this should fix your problems...

Steffen.

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Coordinate System Visualization

Post by karunaMaitri » Wed 23. Sep 2009, 09:19

Thanks Stephen, for the suggestions. I reduced fonts considerably and increased the axis scale. Now it displays all curves with axes labels and curve labels.

Thanks again!
Karuna

Post Reply