Skip to main content

[JAVA3D-INTEREST] Geometry by reference

6 replies [Last post]
Anonymous

Hi,

I have a problem displaying a geometry by reference, where nothing is
displayed. The code below doesn't work:

TriangleArray arr = new TriangleArray(vertices.length,
TriangleArray.COORDINATES | TriangleArray.NORMALS |
TriangleArray.BY_REFERENCE);
arr.setCoordRefFloat(vertices);
arr.setNormalRefFloat(normals);

When I use code below everything is ok and I can see the geometry on the
screen:

TriangleArray arr = new TriangleArray(vertices.length,
TriangleArray.COORDINATES | TriangleArray.NORMALS);
arr.setCoordinates(0, vertices);
arr.setNormals(0, normals);

Do you guys have any suggestions?

Thanks a lot,
Ilya

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mnjacobs
Offline
Joined: 2003-06-13

> Q2: I am not compiling it ( call compile() ), I just
> add it to the scene graph

Thats what I meant to say ;-).

I took one of my 'by reference' implementations and reverted back in the same way you describe and it worked fine. I was using an indexed triangle strip array, so perhaps you have stumbled upon a TriangleArray bug?

Mike

Message was edited by: mnjacobs

ostenl
Offline
Joined: 2004-11-06

When using BY_REFERENCE the vertices are stored in a float array, float[vertexCount*3], but the input to the constructor shall be the number of vertex points. You could try
[code]

vertices[3*i] = vertex[i].x;
vertices[3*i+1] = vertex[i].y;
vertices[3*i+2] = vertex[i].z;
.
.
new TriangleArray(vertices.length/3,....|TriangleArray.BY_REFERENCE);
[/code]

izelker
Offline
Joined: 2004-11-02

Thanks, that worked for me!!!

mnjacobs
Offline
Joined: 2003-06-13

Two questions would help me understand the problem.

Q1. Are the vertices and normals exactly the same for both scenarios?

Q2. Does the code attempt to change the geometry after you have compiled the scene graph?

Mike

Ilya Zelker

Q1: Both vertices and normals are the same
Q2: I am not compiling it ( call compile() ), I just add it to the scene graph

Thanks,
Ilya

At 02:28 PM 11/5/2004 -0500, you wrote:
>Two questions would help me understand the problem.
>
>Q1. Are the vertices and normals exactly the same for both scenarios?
>
>Q2. Does the code attempt to change the geometry after you have compiled
>the scene graph?
>
>Mike
>---
>[Message sent by forum member 'mnjacobs' (Mike Jacobs)]
>
>http://www.javadesktop.org/forums/thread.jspa?messageID=36538躺
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

kcr
Offline
Joined: 2004-03-17

If you have a small, reproducible test case, please post the URL or file an issue and attach the program.

-- Kevin