How to quickly draw a curved shape?

  • by "quickly" I presume one should use hardware facilities as much as possible

  • by "curved" I mean boundaries defined by either quadratic or cubic Bezier curves

  • by "shape" I mean either a "fat" stroke (i.e. more than 1px wide) or even-odd/non-zero filled "2D curved polygon", possibly with holes (i.e. letter "O")

I'm asking because the options I know of have several drawbacks:

  • triangulating the shape and sending it to OpenGL - does the most difficult work on CPU and might use too many/few triangles (i.e. wasteful/coarse)

  • texture atlas - has to recompute/upload the texture on every change (shape, scale, rotation, ...)

  • Signed distance field - on large scales the details don't look pretty or has to recompute/upload the texture

  • NV_path_rendering - could be it, if it was not working only on Nvidia's cards

  • OpenVG - could be it, if it was not working only on mobile

  • ?

* It seems to me that OpenVG is not exactly moving forward, to put it mildly. Does anyone know anything about its future prospects? Is it worth at all to keep an eye on in the present day?

** OpenGL 4+ provides means of on-fly tessellation of polygons. Could it be somehow used to refine the the mesh from the "triangulating" option so that the shape boundary at least wont look "angled"?

  • 2
    $\begingroup$ This GPU Gems article rasterizes quadratic curves by identifying parts of the hull that are curved and analytically computing the coverage in the pixel shader, might be worth a look: developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch25.html $\endgroup$
    – yuriks
    Aug 10, 2015 at 20:41
  • 2
    $\begingroup$ @yuriks Yeah, Loop & Blinn, totally forgot about it. But isn't it patented? $\endgroup$
    – Ecir Hana
    Aug 10, 2015 at 22:12
  • $\begingroup$ See also Massively-Parallel Vector Graphics, published in SIGGRAPH Asia 2014. $\endgroup$
    – lhf
    Aug 20, 2015 at 1:24
  • $\begingroup$ Between the options you've listed in your question and the Loop and Blinn paper, I think you've pretty much exhausted all the possibilities. $\endgroup$ Aug 20, 2015 at 5:41
  • $\begingroup$ You can tessellate a line, like described here. Or you can triangulate in a compute shader. $\endgroup$ Aug 20, 2015 at 13:28

2 Answers 2


You can use OpenGl 4.x tessellation shaders to convert Bezier control points into polygons.

A google search for "tessellation shader bezier" found this outline describing the tessellation of Bezier surfaces and curves:


This offloads the Bezier evaluation from the CPU to the GPU and reduces the data flow across the bus.

  • 3
    $\begingroup$ You could improve this answer by elaborating a bit, or even just linking to something that explains further. $\endgroup$ Nov 12, 2015 at 20:41
  • 1
    $\begingroup$ One way of expanding this answer would be to address the drawbacks the author mentions, and explain how your approach helps with those. $\endgroup$
    – trichoplax
    Nov 12, 2015 at 20:46

One can do curved drawing with hardware. There is a method described in GPU Gems 3 that describes how to do this. User @yuriks actually comments this. I have actually made a quick a dirty demo for you to take a look at.


Image 1: HW accelerated curve shapen (drawn usung a triangle) and webgl source


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.