jit.gl.sketch screentoworld

Yoann's icon

I have 2 gl.sketch objects linked to a node object. A gl.handle is also connected to the node.

It seems like the "screentoworld" message sent to the sketch objects don't respond to the transformations done by the handle.

Am I missing something ?

Here a patch to demonstrate.

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks

mark2e's icon

Hi,

It doesn't respond to transformations, because you are querying the "size" attribute of your jit.wjindow.
--> change your window size and the numbers change.
What are you trying to achieve?

Yoann's icon

Yes, I ask the size too (the button is directly connected to getsize message)
If I change the size of the window, yes the numbers change, but there still not what I expect.

The patch is drawing a lot of rectangles/lines (thousands)
The coordinates are generated by the patch, but I want them to stay (+/-) in the field of view of the camera.

Ah ! And just writing that I thought I just found the mistake: moving the object but keeping the camera in the same place, so the field of view is the same.
I tried moving the camera, but same result....

Any ideas ?

Y.

Rob Ramirez's icon

how are you moving the camera? you should use the @camera of gl.render, or a jit.gl.camera object.

Yoann's icon

I tried it with jit.gl.camera, inside my main patch.

But now I try to do it in the patch I posted... and it works...

I guess I have to have a closer look....

Thanks for the advise anyway !

Max Patch
Copy patch and select New From Clipboard in Max.

I'll be back if I can't make it work ;))