I got two questions:
I want to draw:
rectangle 1: rectangle with rounded corners, edges stroked with blue and with transparent fill
rectangle 2: rectangle with rounded corners, edges stroked with blue and filled with a red color
which way is it the best way of doing this? with jit.gl.gridshape with the plane and setting size with scale or with jit.gl.sketch
I had this task with GL. After scouring a all the OpenGL forums I could find, it turns out the GL approach is to draw a lot of triangles.
The basic approach is to divide the rounded rectangle into (1) an inscribed rectangle (with square corners); (2) four rectangles along the edges of the inscribed rectangle; and (3) quarter-circles at the four corners. The last component is where the OpenGL idiom tri_fan is your friend. Otherwise it’s a bit of tedious math and a couple of for loops.
All of this did make me shed a brief tear for QuickDraw, which did all the heavy lifting for RoundRects.
Hope this is of some help.
C74 RSS Feed | © Copyright Cycling '74