SKOOP
SKOOP

Reputation: 364

Best way to add rounded corners to a triangle in OpenGL ES 2+ on iOS

When drawing filled, no outline triangles with OpenGL ES 2+ is there a way to easily add rounded corners to the triangles?

Is it also performant or is there a need to do it in a more complex manner to get performant rounded corners on a triangle?

// think dynamic triangles. And dynamic ability to adjust the radius of the corners would be useful also.

The only way I can think of is stepping around the corner, but I'm hoping there's an easy effect or some other magical less intensive effort required to pull it off.

Upvotes: 0

Views: 1019

Answers (1)

Muzza
Muzza

Reputation: 1256

There is no shortcut to doing this. Adding rounded corners to a triangle means it is not a triangle any more, so cannot be rendered as a single primitive.

Instead it needs to be constructed out of many triangles to give the illusion of a smooth rounded corner. So your own suggestion about 'stepping around the corner' is the correct way to do it.

Upvotes: 0

Related Questions