Moving and Zooming a 2D Visualization with [jit.gl.mesh] and [jit.gl.meshwarp]
I’m trying to convert LiDAR data into TUIO. For the first time since I started with Max, I’m using Jitter to draw the LiDAR point cloud and the area that will define where points will be transformed into TUIO.
I’m using [jit.pwindow] because I want to embed the window directly into the patch in a GL environment. After searching the forums, I found how to create and display the point cloud (https://cycling74.com/forums/display-360-lidar-point-in-jitter). The next step was to draw 4-vertex polygons that I could modify with the mouse. My inexperience led me to [jit.gl.meshwarp], which seems very suitable for what I want to do, ignoring the texture deformation feature for which it was originally created (and which I don’t need).
The problem arose when I tried to manipulate the visualization I generated. The point cloud is very large, so it’s necessary to move the view around and zoom in to accurately adjust the polygon’s vertices with the mouse. I only need to move along the X, Y, and Z axes because my environment is effectively 2D. It’s important to note that keeping the point cloud and the polygon proportionate is crucial so that the polygon accurately represents “real” positions in relation to the point cloud.
I assumed @ortho in [jit.gl.render] would be enough for my purposes, but I found that:
1. @ortho 2 does not make the Z position affect [jit.gl.meshwarp]; it only affects the point cloud.
2. @ortho 0 is not helpful because it applies perspective, which fails to maintain the distance between the point cloud and the polygon as they move, and also doesn’t move the polygon in Z.
Additionally, changing the X and Y position of [jit.gl.render] negatively affects mouse usage because those shifts aren’t compensated to locate the polygon’s vertices at their visual positions. For example, if I modify X in [jit.gl.render], I have to offset my mouse movement accordingly to select and move any vertex in the [jit.gl.meshwarp] polygon. The same applies to the Y axis, of course.
I’ve also tried [jit.gl.camera], but the issues are essentially the same. I tested [jit.gl.videoplane] and [jit.gl.node] as well—apparently these might be part of the solution—but I haven’t made any progress.
No doubt the issue is my own lack of knowledge. I’ve studied several Jitter tutorials but still can’t move forward, and I’ve been stuck on this for three days now!
I’m attaching the patch here, which probably explains the situation better than I can. It includes two externals (that I’m still testing) which I believe are not relevant to this matter.
Any kind of help would be greatly appreciated.