0

I want to draw a curve that passes through any three points specified by the fragment shader. Considering the usage, I think that a quadratic function is better than calculating a control point like a Bezier curve or a B-spline (I want you to pass through 3 specified coordinate points). How can I draw a parabola that passes through the three coordinate points specified by the quadratic function?

x001017
  • 93
  • 5
  • You have to be more specific. Your question is very vague. Are you looking for something like [Draw anti-aliased thick tessellated curves](https://stackoverflow.com/questions/68134348/draw-anti-aliased-thick-tessellated-curves)? – Rabbid76 Jul 15 '21 at 14:59
  • "*specified by the fragment shader*" How does a fragment shader specify points? Via an SSBO or something? – Nicol Bolas Jul 15 '21 at 15:22
  • @Rabbid76, I would like to have an anti-aliased curve that always passes through the specified (x1, y1), (x2, y2), (x3, y3) coordinates. I think that it is possible to make a curve using polygons with vertex shader, but is it possible with only fragment shader? – x001017 Jul 16 '21 at 00:06
  • @Nico Bolas, Specify uniform for fragment shader. In vec2, there are three (x1, y1), (x2, y2), (x3, y3). – x001017 Jul 16 '21 at 00:13
  • see [rendering thick 2D cubics in GLSL](https://stackoverflow.com/a/60113617/2521214) ... internaly it uses interpolation cubic which passes through 4 cotrol points on parameter interval `t=<-1,+2>` however only `<0,1>` is used so you need to render 2 cubics for example `(p0,p0,p1,p2),(p0,p1,p2,p2)` ... instead of duplicated point at start and end you can use mirror-ed point... Using [Quadratics](https://stackoverflow.com/a/31423105/2521214) is not as convenient as it does not behave well on joint points between multiple curves ... another option is to fit your parabola to your control points. – Spektre Jul 16 '21 at 06:27

0 Answers0