Drawing in 2D - Rendered 3D Geometry?!?

Hey there!

I’m pretty new to TD, but already starting to love it! Super powerful! I come from a very dark engineer background, knowing how to code in Assembly, C, C++, Java and all their friends, but still… TD is awesome! :wink:

My question is pretty straightforward: How can I draw a circle or a line on top of a TOP image?

My project is currently capturing the x and y of the mouse clicks from the user, storing them in a table. Then, for each of the table row (I guess using a replicator), I want to draw a circle on the image where the user clicked.

A first solution I found was creating a TOP circle, and then “drawing” it using a TOP composite. I translated the circle to the location I wanted. It kind of worked… but then, I wanted to draw lines… but there is not TOP line…

So I decided to change with 3D geometry, and then rendering them in 2D, before “drawing” them on my image with composite. It is almost working now, but to me, it sounds like overkill to draw in 3D, do a projection in 2D, and then use the 2D results…

Is there a better way?

Thanks a mil for your input!

Cheers,

Laurent

hi , welcome to the forum!

if you open the Palette, there are two different examples you can look at:

Techniques->leapPaint
Drag this one into your network and then click its bottom right + sign to activate its viewport. Now click&draw with the mouse in the viewport. It’s drawing 2d circles on a surface where the user clicked his mouse, and adding those circles to the canvas using the feedback TOP.

Techniques->gestureCapture
Drag this one into your network and click on its bottom right + sign to activate its viewport. Now click&draw with the mouse in the viewport. This one is a bit more advanced, drawing with lines.

have fun!

Hey hey!

Thanks a lot for your swift and detailed reply! Love it!

So, from the first example, what I learnt is that I could have used the parameters “centers” to draw my circles instead of translate… why doing it complicated when we can do it simple! :wink:

From the second one, it uses indeed 3D geometry and then reprojection to 2D… thus I wasn’t so wrong! So a question I have now, is does it impact performances a lot or not much to draw in 3D and project everything to 2D?

Thanks again for your examples!

well that depends on what your drawing and how fast your computer is, how much it impacts performance :wink:
But generally everything in OpenGL is already in 3d - what you see in a TOP is essentially a screen-aligned quad which has a texture on it.
I would not worry too much about it - while you learn and start building more complicated networks there will be other things soon that slow down your networks below 60FPS, and 3d-to 2d projection will be the least of those optimizing worries.

I got you! Indeed, I haven’t faced any performance issue yet, and I guess I still have time before it happens! :wink:

Thanks!