Octopus Tentacles: Bgrabmp ellipse too slow but GL does it lazarus / 39-Graphics ---------------------------------------------------------------------- Boleeman · 2025-07-29 09:42 Hi all. I tried making an octopus tentacles animation but I am finding the movement of the tentacles very sluggish. The alpha changes as the tentacles sway. Not sure how to improve the speed of the tentacles movement to make a hypnotic movement? ---------------------------------------------------------------------- Gigatron · 2025-07-29 14:03 Quote from: Boleeman on July 29, 2025, 11:42:31 amHi all. I tried making an octopus tentacles animation but I am finding the movement of the tentacles very sluggish. The alpha changes as the tentacles sway. Not sure how to improve the speed of the tentacles movement to make a hypnotic movement? Nice @Boleeman To test the glCanvas quick conversion to gl version of this cool fx; Regards ---------------------------------------------------------------------- Thaddy · 2025-07-30 07:37 Nice! Nice conversion to glcanvas too... ---------------------------------------------------------------------- Boleeman · 2025-07-30 13:29 Wow GigaTron. Looks like GL is the way to go for Ellipse animations. That's the exact effect that I was trying to achieve. For some reasonTBgrabmp does not handle ellipse animations well, but its really good at stationary renders. Thanks Gigatron. ---------------------------------------------------------------------- Boleeman · 2025-07-30 13:52 Actually Gigtron, not sure if you could possibly help with another ellipse animation? I had another project of a Burning sun that uses ellipses, but it also has Canvas2D to do ctx.Translate(x, y); Not sure if you could possibly work out how to do it in GL? The effect should be a really nice trippy burning Sun, but I could not get this to animate properly. ---------------------------------------------------------------------- Gigatron · 2025-07-30 15:16 Quote from: Boleeman on July 30, 2025, 03:52:04 pmActually Gigtron, not sure if you could possibly help with another ellipse animation? I had another project of a Burning sun that uses ellipses, but it also has Canvas2D to do ctx.Translate(x, y); Not sure if you could possibly work out how to do it in GL? The effect should be a really nice trippy burning Sun, but I could not get this to animate properly. Hi, i have not all gl functions to translate rotate like ctx Canvas2D; but this conversion is not bad i think; Regards ---------------------------------------------------------------------- Gigatron · 2025-07-31 00:50 Hi With the new version of the glcanvas  the code is more understandable and easy, support of ctx.save, ctx.restore, ctx.translate, ctx.rotate + 3D cubes ; glSaveMatrix; glRestoreMatrix; glTranslateMatrix(rayX, rayY, 0); glRotateMatrix(-i + rot, 0, 0, 1); // Z rotation  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 unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,  OpenGLContext, Math, glcanvas; type  { TForm1 }  TForm1 = class(TForm)    OpenGLControl1: TOpenGLControl;    Panel1: TPanel;    Timer1: TTimer;    procedure FormCreate(Sender: TObject);    procedure OpenGLControl1Paint(Sender: TObject);    procedure Timer1Timer(Sender: TObject);  private    num, rot: Single;  public  end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Timer1Timer(Sender: TObject);begin  OpenGLControl1.Invalidate;end; procedure TForm1.FormCreate(Sender: TObject);begin  glInit(OpenGLControl1);  if not OpenGLControl1.MakeCurrent then raise Exception.Create('OpenGL context makeCurrent Error');  num := 0;  rot := 0;end; procedure TForm1.OpenGLControl1Paint(Sender: TObject);var  i, q: Integer;  a, d: Single;  cx, cy: Integer;  rayX, rayY: Single;begin  if not OpenGLControl1.MakeCurrent then Exit;  glFillScreen(OpenGLControl1, 0.0, 0.0, 0.0, 1.0);   cx := OpenGLControl1.Width div 2;  cy := OpenGLControl1.Height div 2;   glSaveMatrix;                    // sun  glTranslateMatrix(cx, cy, 0);   for i := -180 to 179 do    if i mod 12 = 0 then    begin      rayX := sin(DegToRad(i)) * 15;      rayY := cos(DegToRad(i)) * 15;       glSaveMatrix;      glTranslateMatrix(rayX, rayY, 0);      glRotateMatrix(-i + rot, 0, 0, 1); // Z rotation       for q := 0 to 195 do        if q mod 5 = 0 then        begin          d := 40 - (q / 200) * 40;          a := sin(DegToRad(-i + q + num)) * 2;          glEllipse(a, q * 1.7, d, d, 20, 1.0, 0.6, 0.0, 0.1, true);        end;       glRestoreMatrix;    // rays    end;   glRestoreMatrix;  // sun  glSaveMatrix;  glFilled3DCube(OpenGLControl1, -80, 0, 0,  50, 1.0, 1.0, 1.0, 1.0, rot, -rot, rot, 0.0, 0.0, 1.0);  glWired3DCube(OpenGLControl1,  -80, 0, 0,  50, 1.0,0.0,0.0, 1.0, rot, -rot, rot, 4.0);  glRestoreMatrix;  glFilled3DCube(OpenGLControl1, 80, 0, 0, 50, 0.0,0.5,1.0, 1.0, rot, rot, rot, 1.0, 0.0, 0.0);  glWired3DCube(OpenGLControl1, 80, 0, 0,  50, 0.5,0.5,0.5, 1.0, rot, rot, rot, 4.0);  num += 11.5;  // deg  rot += 1.15;  // deg   OpenGLControl1.SwapBuffers;end; end. ---------------------------------------------------------------------- Boleeman · 2025-07-31 08:56 Thanks for helping out Gigatron. I used a := sin(DegToRad(-i + q + num)) * 10; to make the rendering wobble a bit more. Now need to try to make an alpha trail from the vertices to make it look like heat is coming from it, like a heat trail from the Sun. I will need to learn a bit more about GL from your latest code. Wondered if GL also does conic gradient? as TBgrabmp only has linear and radial gradient. Thanks Gigatron for your help.