PolyBezier equivalent in TBGLVirtualScreen lazarus / 39-Graphics ---------------------------------------------------------------------- ron.dunn · 2026-01-25 13:04 I'm attempting to make some graphics code faster by moving it from a standard Canvas to TBGLVirtualScreen's TBGLContext.Canvas. I've successfully moved lines, rectangles, ellipses and arcs; but I can't find a functional equivalent for beziers. Any suggestions? ---------------------------------------------------------------------- Lulu · 2026-01-25 19:30 Hi, I don't know well TBGLVirtualScreen but I think you have already done the job! If you see the code in unit BGRACanvasGL, line 1398: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TBGLCustomCanvas.Ellipse(cx, cy, rx, ry: single; AColor: TBGRAPixel);begin  if AColor.alpha = 0 then exit;  Polygons(ComputeEllipse(cx,cy,rx,ry),AColor);end;We can see, first an array of TPointF is returned by ComputeEllipse(...) then this array is drawn as a consecutive lines by Polygons(array, color). To render a Bezier curve, first compute its curve with the functions in unit BGRAPath line 275 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function SplineVertexToSide(y0, y1, y2, y3: single; t: single): single;function ComputeBezierCurve(const curve: TCubicBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;function ComputeBezierCurve(const curve: TQuadraticBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;function ComputeBezierSpline(const spline: array of TCubicBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;function ComputeBezierSpline(const spline: array of TQuadraticBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; overload;function ComputeClosedSpline(const APoints: array of TPointF; AStyle: TSplineStyle; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;function ComputeClosedSpline(const APoints: array of TPointF; AStart, ACount: integer; AStyle: TSplineStyle; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;function ComputeOpenedSpline(const APoints: array of TPointF; AStyle: TSplineStyle; AEndCoeff: single = 0.25; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;function ComputeOpenedSpline(const APoints: array of TPointF; AStart, ACount: integer; AStyle: TSplineStyle; AEndCoeff: single = 0.25; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF;function ClosedSplineStartPoint(const points: array of TPointF; Style: TSplineStyle): TPointF;function ComputeEasyBezier(const curve: TEasyBezierCurve; AAcceptedDeviation: single = DefaultDeviation): ArrayOfTPointF; then call Polygons() ---------------------------------------------------------------------- ron.dunn · 2026-01-25 23:01 Thank you so much, that pushed me in exactly the right direction. It all came down to one line of code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i PolyLines (ComputeBezierCurve(BezierCurve(p[0],p[1],p[2],p[3])),VGABlack); ---------------------------------------------------------------------- Lulu · 2026-01-26 19:09 Quote from: ron.dunn on January 26, 2026, 12:01:41 amThank you so much, that pushed me in exactly the right direction. It all came down to one line of code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i PolyLines (ComputeBezierCurve(BezierCurve(p[0],p[1],p[2],p[3])),VGABlack);Happy to see you have solved your issue. Regard