DrawableVBO2 Bounds

40 views
Skip to first unread message

Dominik Scharnagl

unread,
Sep 22, 2022, 4:19:20 PM9/22/22
to Jzy3d
Hello,

i have a few DrawableVBO2 Objects i want to Transform (Rotate and Translate to new Positions). I try using the applyGeometryTransform function to these objects. But they don't get transformed. By testing arround I saw that all the DrawableVBO2 Objects don't have a bounds (the output is null).
Can I somehow set the Bounds myself or rotate/translate the object in a different way?

Sincerly,
Dominik

Martin Pernollet

unread,
Sep 23, 2022, 7:47:10 AM9/23/22
to jz...@googlegroups.com
Hi Dominik,

They have bounds but they might be null at the moment you need them. DrawableVBO (1 and 2) are not immediately initialized. They are initialized (and thus have bounds) after they are added to the chart AND after the chart is open and visible. SO if you are processing things about your drawable while the chart is still not open it will fail.

This may be seen in the chart.add method here.

By the way, did you resolve your mouse picking issue? That was a very interesting feature.

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "Jzy3d".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse jzy3d+un...@googlegroups.com.
Cette discussion peut être lue sur le Web à l'adresse https://groups.google.com/d/msgid/jzy3d/48a35c0b-d1cd-4157-a36c-9699e7dab456n%40googlegroups.com.

Dominik Scharnagl

unread,
Sep 23, 2022, 8:46:32 AM9/23/22
to Jzy3d
Hello,

a thanks looks like I have to work with them after initialization then. That explains it then.

Also yes I ficed the mouse picking issue. It was mostly just testing around with the right z values, till I found the ones, that worked right for the different perspectives.

Thanks for the help,
Dominik

Martin Pernollet

unread,
Sep 23, 2022, 9:32:55 AM9/23/22
to jz...@googlegroups.com
Great! May I ask you to share a code demonstrating how you fixed it ? I could integrate this to the API. Or even better : merge request :)

Dominik Scharnagl

unread,
Sep 23, 2022, 10:39:27 AM9/23/22
to Jzy3d
When I find the time I can share the code. But it somehow only works with Newt (and Crashes on AWT) and the depth range I choose was more found out by just changing the paramtere per hand a bit, so its not that pretty.
Maybe I can finde the time this weekend and post it here, but I have a lot to do right now and may not be abel to find the time right now.

Martin Pernollet

unread,
Sep 23, 2022, 12:28:42 PM9/23/22
to jz...@googlegroups.com
You may wish to use the GraphListener to be notified when all drawable have been loaded :


Le ven. 23 sept. 2022 à 14:46, Dominik Scharnagl <dominik.sc...@gmail.com> a écrit :

Dominik Scharnagl

unread,
Sep 24, 2022, 2:02:12 PM9/24/22
to Jzy3d
Hello,

I added how I coded the picking and moving as a .txt to this message. Like I said its probably not the most beautiful solution, but it works for the project I am working on.

I have a question for the chart tho. I updated and Rotated my VBO Objects after the initation and that works. But the graph now looks weird, because the Graph does not allign with the rotated objects, but with how they were before that. How can I update the graph/axis so that it has the same size like the Objects added here.
AxisNotBeingSetToObject.PNG
PickingAndMoving.txt

Martin Pernollet

unread,
Sep 25, 2022, 7:31:30 AM9/25/22
to jz...@googlegroups.com
Hi,

The bounds should be transformed by the post transform you set (if you wait for the data to be ready before configuring transforms), as shown by the implementation of drawable here.

However the way BoundingBox3d applies the transform is bit poor. First it has no unit test to check what should work. But the most important is that I suspect this implementation to only be able to properly deal with scale and shifts, but not with rotation. A naive fix would be to transform all corners of the initial bounding box and then build a new bounding box with all these transformed points.

FYI, Two objects provide the math to properly rotate points : Coord3d, Rotate.

You could evaluate my assumption by simply overriding your DrawableVBO2.setTransformBefore and here hack the bounds (there is no setBounds() on purpose). If this works, a clean fix should rather be in BoundingBox3d.apply. That would be great if you could create a merge request with a unit test on the bounding box.  

Let me know if this works.

I tried what you did in your sample file. It still shakes objects sometime and get them shifted with a factor similar to margin on the axis side. Maybe this will be easier to work on your MR when you have time to do so. But thanks :)

Dominik Scharnagl

unread,
Sep 25, 2022, 8:57:38 AM9/25/22
to Jzy3d
Allright thanks for the answer. I will try that out, when I have the whole functionality down with the Transforming and Rotating the VBOs. But for now it's not that important to have the scale be right.

Also for the moving of the points. It worked on my End. I will look again into it when I have the time for that.

Martin Pernollet

unread,
Sep 29, 2022, 12:10:15 PM9/29/22
to jz...@googlegroups.com
Hi,

I think the exception you encounter after unregistering the mouse controller in AWT comes from the fact that the mouse controller wasn't remove from the canvas, hence still receiving mouse events while it should not. This was not problem up to recently, since I made the mouse controller more powerfull (it is now able to zoom when view is in 2D mode, hence tries to check the state of the chart).

Here's the change.

I just deployed this fix so you could just update your 2.2.1-SNAPSHOT jars if you want to work with AWT.


Dominik Scharnagl

unread,
Nov 14, 2022, 10:57:37 AM11/14/22
to Jzy3d
Hello (after a long pause here)

I was working on rotating VBO2 Objects and got an version now that works. Problem is that it flickers.
That is because I take the vertices of the VBO2 object and translate/rotate them how I want them to and after that remove the VBO2 Object and create and add a new VBO Object with the new Vertices.
That is not realy the most elegant way to do it. But just overwriting the bounds with the transformBefore did not move/rotate the object itself. And I could not find a way to override the vertices of the VBO2 object.

So is there any way to override the vertices of a VBO2 object?

Sincerly,
Dominik

Martin Pernollet

unread,
Nov 14, 2022, 11:19:08 AM11/14/22
to jz...@googlegroups.com
Hi,

I think this is inefficient and I would suggest digging into the bound update problem. When doing such a "manual" rotation, you lose the power of the GPU and instead process it with your CPU. It really won't scale with data whereas the purpose of VBO is to take advantage of the GPU architecture to have efficient rotations on large arrays of vertices.  

Concerning your flickering issue, did you try deactivating animation while updating the VBO? I would ensure the VBO does not get modified while a rendering occurs. If this does not work, maybe try to share a video of your flickering issue, it may help.

Reply all
Reply to author
Forward
0 new messages