Login  Register

Re: how to transform objects not using Transform3D

Posted by Mr. Broccoli on Jul 15, 2022; 11:31pm
URL: https://forum.jogamp.org/how-to-transform-objects-not-using-Transform3D-tp4041515p4041790.html

Hi Phil,
I hope you're not moving anywhere currently ;)
Had to do some other assignments, but now I've got time to pick this up again.

Following what you've written, I've changed the data from Point3f to float[][] arrays.
Now I'm trying to use GeometryUpdater (javadoc), but that's a struggle.
I created a new class (Updater.java) that implements GeometryUpdater in which I'm kind of forced by Eclipse to use
public void updateData(Geometry geometry){}
method. In the documentation it's written that all changes should be made using that method, but the problem I'm having is that the only parameter is the geometry and I don't know how passing of the updated information is supposed to happen.

As I understand, to allow for 'byref' geometry creation, I need to use the flag BY_REFERENCE, e.g.
LineArray cube = new LineArray(cube_edges.length,GeometryArray.COORDINATES|GeometryArray.BY_REFERENCE|GeometryArray.ALLOW_REF_DATA_WRITE);

Now adding that flag throws an error, at a line where I previously used to populate that LineArray with points using setCoordinates method.
I left this as is (with this error) in cube_creation.java .
Again, I'm stuck on populating 'byref' Geometry with these coordinates.
Would you be so kind to give coding example how to properly feed 'byref' Geometry with initial data/changes?

Files I'm using:
tuval1.java main method, creates new tuval7
tuval7.java
Updater.java not sure how to use updateData method here
cube_creation.java creating geometry worked fine before adding BY_REFERENCE flag, but now I'm stuck

In tuval7.java there's a KeyEvent, where I want to use 'a' key, to translate cubes right.
This is also where I attempt to alter geometry by feeding a new point array, but to no avail (updateData method is empty, so that's probalby it, but no clue how to populate it).

Kind regards, Mr. B