Login  Register

Re: how to transform objects not using Transform3D

Posted by Mr. Broccoli on Aug 03, 2022; 10:41pm
URL: https://forum.jogamp.org/how-to-transform-objects-not-using-Transform3D-tp4041515p4041807.html

When comes to how zoom works, I was told that moving camera backwards and forwards is different - then you can see how vertices move relative to each other (unlike in zoom). This forward and backward movement is performed by pressing W and S keys, although it's not camera moving, but the object. Isn't it that the scaling I call zooming looks pretty similar to changing focal length (a true zoom)?

From the links you sent I see, that for normals perpendicular to the surface, the dot product is the solution.
Thanks for the context though. What you've written is similar to what NormalGenerator description says, I get the concept.

Since you said not to follow BY_REF normals, I briefly looked again at the code and tried to make my methods work.
I changed my isFrontFacing method so that it uses a reference to the flat point array (same as used for transformations so far).
I call this method together with final triangle sorting in a flush method so it is applied at each key press (tried calling it outside flush on a key press - with the same results).
It works as it should (looking at the display), but each key press causes this flurry of errors to pop out on 'draw':

Exception occurred during Canvas3D callback:
java.lang.NullPointerException: Cannot read field "retained" because "<parameter1>" is null
        at javax.media.j3d.GraphicsContext3D.doDraw(GraphicsContext3D.java:1981)
        at javax.media.j3d.GraphicsContext3D.draw(GraphicsContext3D.java:2128)
        at notusingtransform3D$1.renderField(notusingtransform3D.java:316)
        at javax.media.j3d.Renderer.doWork(Renderer.java:1327)
        at javax.media.j3d.J3dThread.run(J3dThread.java:271)


Any help on this?

The code: notusingtransform3D.java