Recent

Author Topic: Fast Canvas Library V1.052  (Read 35010 times)

microxa

  • New Member
  • *
  • Posts: 35
Re: Fast Canvas Library V1.052
« Reply #120 on: May 29, 2026, 08:43:31 pm »
Hi Gigatron! 
Do you think about remastering the demo with the «Ocean Waves» shader?

Gigatron

  • Sr. Member
  • ****
  • Posts: 426
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #121 on: May 30, 2026, 12:00:47 am »
Hi Gigatron! 
Do you think about remastering the demo with the «Ocean Waves» shader?

Hi, where is this 'Ocean Waves' shader ?

This one ? http://gigatron3k.free.fr/html5/C2/FX/seasc/

Thx
« Last Edit: May 30, 2026, 12:15:25 am by Gigatron »
Coding faster than Light !  https://www.youtube.com/@gtrgtr9505

microxa

  • New Member
  • *
  • Posts: 35
Re: Fast Canvas Library V1.052
« Reply #122 on: May 30, 2026, 04:13:55 am »

Hi, where is this 'Ocean Waves' shader ?

This one ? http://gigatron3k.free.fr/html5/C2/FX/seasc/

Thx
Yes, it’s a demo (sorry for forgetting its exact name)...P.S.I don’t really understand such a complex topic.I had to dive deep into this wonder — it's truly amazing. Best regards, Gigatron!

Gigatron

  • Sr. Member
  • ****
  • Posts: 426
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #123 on: May 30, 2026, 02:53:20 pm »
Hi @microxa

Ok it's added to my todo list for next week after finishing the level2 of shoot them up.

This shader called Seascape from TDM alias ; Alexander Alekseev.

https://www.shadertoy.com/view/Ms2SD1


Regards Gigatron
« Last Edit: May 31, 2026, 03:59:44 pm by Gigatron »
Coding faster than Light !  https://www.youtube.com/@gtrgtr9505

Gigatron

  • Sr. Member
  • ****
  • Posts: 426
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #124 on: June 02, 2026, 02:09:24 am »
Ok

glcanvas v1.1 include now seascape shader by TDM; sfx by sunriders;

Demo with protracker music with hukka protracker source all under 100   Lines of code.

Have fun , Gtr

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  6.   OpenGLContext, glCanvas, ProTracker.Util, ProTracker.Player, ProTracker_Audio;
  7.  
  8. type
  9.   { TForm1 }
  10.   TForm1 = class(TForm)
  11.     OpenGLControl1: TOpenGLControl;
  12.     Timer1: TTimer;
  13.     procedure FormCreate(Sender: TObject);
  14.     procedure FormDestroy(Sender: TObject);
  15.     procedure OpenGLControl1Paint(Sender: TObject);
  16.     procedure Timer1Timer(Sender: TObject);
  17.   private
  18.   public
  19.   end;
  20. var
  21.   Form1: TForm1;
  22.   txtPosX, demotmr : Integer;
  23.   tmr, rot : single;
  24.   tex    : TGLTextureID;
  25.   tex_w,  tex_h       : Integer;
  26.  
  27.   s_txt : String;
  28.    // font
  29.   fntx   : TGLTextureID;
  30.   fntx_w, fntx_h     : Integer;
  31.  
  32. implementation
  33. {$R *.lfm}
  34.  
  35.  
  36. procedure TForm1.FormCreate(Sender: TObject);
  37. begin
  38.   glInit(OpenGLControl1);
  39.   glEnableVSync(true);
  40.   s_txt := ' GIGATRON THE LEADER PRESENTS - GL SEASCAPE SHADER BY TDM - MADE WITH GL CANVAS V 1.1  LESS CODE MORE FUN ! SFX - SUNRIDERS  - GIGA GREETINGS TO ALL SCENERS AND LAZARUS FORUM MEMBERS SEE YOU BYE ... ';
  41.   fntx   := glLoadPNGToTexture('fonts/tri.png', fntx_w, fntx_h);
  42.   tex    := glLoadPNGToTexture('texture/city.png', tex_w,tex_h);
  43.  
  44.   tmr := 0.0;
  45.   demotmr := 0;
  46.  
  47.     // module
  48.   Module := TPTModule.Create(True, False);
  49.   Module.Stop;
  50.   Module.LoadFromFile('modules/e2.mod');
  51.   PT_Audio_SetPaused(False);
  52.   Module.SetAmplification(0.6);
  53.   Module.SetStereoSeparation(20);
  54.  
  55.   PT_Audio_Init;
  56.   Module.Play(0, 0);
  57.  
  58. end;
  59.  
  60. procedure TForm1.OpenGLControl1Paint(Sender: TObject);
  61. var
  62.   ww, hh  : Integer;
  63. begin
  64.   ww := OpenGLControl1.Width;
  65.   hh := OpenGLControl1.Height;
  66.  
  67.   glFillScreen(OpenGLControl1, 0.0, 0.0, 0.0, 1.0);
  68.  
  69.   glSeascapeShader(0,0,ww,hh,tmr*2.0,0.0,0.0,2.0);
  70.   glDrawTexture2D(0,320,ww,tex_h*1.5,tex,2.0,2.0,0.0);
  71.   glBitmapFontText(fntx, 2500 - txtPosX, 160, s_txt, 36,38, 10,
  72.                   1.0, 0.0, bmAlpha, 10.0, 12.0);
  73.  
  74.   OpenGLControl1.SwapBuffers;
  75. end;
  76.  
  77. procedure TForm1.Timer1Timer(Sender: TObject);
  78. begin
  79.   tmr := tmr +0.02;
  80.   txtPosX := txtPosX + 10; if txtPosX > 80000 then txtPosX := 0;
  81.  
  82.   OpenGLControl1.Invalidate;
  83. end;
  84.  
  85. procedure TForm1.FormDestroy(Sender: TObject);
  86. begin
  87.   if Module <> nil then Module.Stop;
  88.   PT_Audio_Close;
  89.   if Assigned(Module) then FreeAndNil(Module);
  90. end;
  91.  
  92. end.
Coding faster than Light !  https://www.youtube.com/@gtrgtr9505

Gigatron

  • Sr. Member
  • ****
  • Posts: 426
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #125 on: June 02, 2026, 12:46:39 pm »
Hi

In addition you can see the live version of ascii shader demo on YT;
used chars :' LAZARUSFPC'

Code: Pascal  [Select][+][-]
  1. glScreenAsciiShader(OpenGLControl1,12.0,12.0,1,1.0);
  2.  
  3. procedure glScreenAsciiShader(glc: TOpenGLControl; char_w : Single = 8.0; char_h : Single = 8.0; colored : Integer = 1; intensity: Single = 1.0);
  4.  

The weather here has gone completely crazy; storm here

https://www.youtube.com/watch?v=PrefF7EpzRM

Regards
« Last Edit: June 02, 2026, 12:50:23 pm by Gigatron »
Coding faster than Light !  https://www.youtube.com/@gtrgtr9505

microxa

  • New Member
  • *
  • Posts: 35
Re: Fast Canvas Library V1.052
« Reply #126 on: June 03, 2026, 11:29:32 am »
Great job, Gigatron! My old 9600GT is pushing through with all its might to handle these waves!Well, I tried to wrap my head around some of the basics using a lighter shader (one that actually runs on old integrated ATI chips), based on the "Ocean" sample from https://github.com/glscene/GLXEngine/tree/master/Examples/Demos/glslshadersTo do this, I needed to switch to a more lightweight framework, GLUT. Gemini helped me put the program together (and looking at it now, I realize I understand absolutely nothing about how it works). Anyway, at least it boots up and renders an image, even if it's still a bit far from the original look.Best of luck to everyone, and happy coding!

microxa

  • New Member
  • *
  • Posts: 35
Re: Fast Canvas Library V1.052
« Reply #127 on: June 06, 2026, 07:03:07 am »
Well, something interesting turned up for the ancient ATI — the Julia fractal. I didn’t even expect it to pull that off (20 iterations — that’s a record!). I had to push Gemini to find some simple and optimized solutions. Best Regards!

Code: Pascal  [Select][+][-]
  1. {$apptype console}
  2. program julia_fractal; uses GL, GLU, GLEXT, Glut;
  3.  
  4. var
  5.   ShaderProgram,TextureID: GLuint;
  6.  
  7.   // Julia C const
  8.   Cx: Single = -0.7;
  9.   Cy: Single = 0.27015;
  10.   Zoom: Single = 3.0;
  11.  
  12. VertSrc:PChar =
  13.   'varying vec2 vTexCoord;'#10+
  14.   'void main() {'#10+
  15.       'vTexCoord = gl_MultiTexCoord0.xy;'#10+
  16.       'gl_Position = ftransform();'#10+
  17.   '}'#10;
  18.  
  19. FragSrc:PChar=
  20.   'varying vec2 vTexCoord;'#10+
  21.   'uniform vec2 u_center;'#10+
  22.   'uniform float u_zoom,u_cx,u_cy;'#10+
  23.   'uniform sampler2D u_pal;'#10+
  24.   'void main() {'#10+
  25.       'float x = (vTexCoord.x - 0.5) * u_zoom;'#10+
  26.       'float y = (vTexCoord.y - 0.5) * u_zoom;'#10+
  27.       'for (int i = 0; i < 20; i++) {'#10+
  28.        //PLAZMA CUB: (x * x) + (y * y)
  29.           'float t = (x * x) - (y * y) + u_cx;'#10+
  30.           'y =  (x + x) * y + u_cy;'#10+
  31.           'x = t;'#10+
  32.       '}'#10+
  33.  
  34.       'gl_FragColor = texture2D(u_pal, vec2(x, y) * 0.5 + vec2(0.5, 0.5));'#10+
  35.   '}';
  36.  
  37. procedure GenTexture;
  38. var
  39.   TextureData: array[0..255, 0..2] of Byte;
  40.   i: Integer;
  41. begin
  42.   randomize;
  43.  
  44.   for i := 0 to 255 do
  45.   begin
  46.     TextureData[i, 0] := random(255);
  47.     TextureData[i, 1] := random(255);
  48.     TextureData[i, 2] := random(255);
  49.   end;
  50.  
  51.   glGenTextures(1, @TextureID);
  52.  
  53.   glBindTexture(GL_TEXTURE_2D, TextureID);
  54.  
  55.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  56.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  57.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  58.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  59.  
  60.   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, @TextureData);
  61.  
  62.   glBindTexture(GL_TEXTURE_2D, 0);
  63. end;
  64.  
  65. procedure InitShaders;
  66. var
  67.   VertShader, FragShader: GLuint;
  68.   Compiled, Linked: GLint;
  69. begin
  70.   VertShader := glCreateShader(GL_VERTEX_SHADER);
  71.   glShaderSource(VertShader, 1, @VertSrc, nil);
  72.   glCompileShader(VertShader);
  73.  
  74.   glGetShaderiv(VertShader, GL_COMPILE_STATUS, @Compiled);
  75.   if Compiled = GL_FALSE then Halt(1);
  76.  
  77.   FragShader := glCreateShader(GL_FRAGMENT_SHADER);
  78.   glShaderSource(FragShader, 1, @FragSrc, nil);
  79.   glCompileShader(FragShader);
  80.  
  81.   glGetShaderiv(FragShader, GL_COMPILE_STATUS, @Compiled);
  82.   if Compiled = GL_FALSE then Halt(1);
  83.  
  84.   ShaderProgram := glCreateProgram();
  85.   glAttachShader(ShaderProgram, VertShader);
  86.   glAttachShader(ShaderProgram, FragShader);
  87.   glLinkProgram(ShaderProgram);
  88.  
  89.   glGetProgramiv(ShaderProgram, GL_LINK_STATUS, @Linked);
  90.   if Linked = GL_FALSE then Halt(1);
  91.  
  92.   glDeleteShader(VertShader);
  93.   glDeleteShader(FragShader);
  94.  
  95.   glUseProgram(ShaderProgram);
  96. end;
  97.  
  98. procedure DisplayProc; cdecl;
  99. var
  100.   LocZoom,LocCx,LocCy,LocPalette: GLint;
  101. begin
  102.  
  103.   LocCx      := glGetUniformLocation(ShaderProgram, 'u_cx');
  104.   LocCy      := glGetUniformLocation(ShaderProgram, 'u_cy');
  105.   LocZoom    := glGetUniformLocation(ShaderProgram, 'u_zoom');
  106.  
  107.   glUniform1f(LocZoom, Zoom);
  108.   glUniform1f(LocCx, Cx);
  109.   glUniform1f(LocCy, Cy);
  110.  
  111.   glActiveTexture(GL_TEXTURE0);
  112.   glBindTexture(GL_TEXTURE_2D, TextureID);
  113.   LocPalette := glGetUniformLocation(ShaderProgram, 'u_pal');
  114.   glUniform1i(LocPalette, 0);
  115.  
  116.   glBegin(GL_QUADS);
  117.     glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0); glVertex2f(-1.0, -1.0);
  118.     glMultiTexCoord2f(GL_TEXTURE0, 1.0, 0.0); glVertex2f( 1.0, -1.0);
  119.     glMultiTexCoord2f(GL_TEXTURE0, 1.0, 1.0); glVertex2f( 1.0,  1.0);
  120.     glMultiTexCoord2f(GL_TEXTURE0, 0.0, 1.0); glVertex2f(-1.0,  1.0);
  121.   glEnd();
  122.  
  123.   glutSwapBuffers();
  124. end;
  125.  
  126. procedure ReshapeProc(w, h: Integer); cdecl;
  127. begin
  128.   glViewport(0, 0, w, h);
  129. end;
  130.  
  131. procedure PassiveMotionProc(x, y: Integer); cdecl;
  132. begin
  133.   Cx := (x / glutGet(GLUT_WINDOW_WIDTH)) * 2.0 - 1.0;
  134.   Cy := (y / glutGet(GLUT_WINDOW_HEIGHT)) * 2.0 - 1.0;
  135.   glutPostRedisplay();
  136. end;
  137.  
  138. procedure KeyboardProc(key: Byte; x, y: Integer); cdecl;
  139. begin
  140.   case Chr(key) of
  141.     '+', '=': Zoom := Zoom * 0.85;
  142.     '-':      Zoom := Zoom * 1.15;
  143.     'r','R':  GenTexture;
  144.     #27:      Halt(0);
  145.   end;
  146.   glutPostRedisplay();
  147. end;
  148.  
  149. begin
  150.   glutInit(@argc, argv);
  151.   glutInitDisplayMode(GLUT_DOUBLE or GLUT_RGB or GLUT_DEPTH);
  152.   glutInitWindowSize(512, 512);
  153.   glutCreateWindow('Julia Set OpenGL 2.0');
  154.   glext_LoadExtension('GL_version_2_0');
  155.  
  156.   glutDisplayFunc(@DisplayProc);
  157.   glutReshapeFunc(@ReshapeProc);
  158.   glutKeyboardFunc(@KeyboardProc);
  159.   glutPassiveMotionFunc(@PassiveMotionProc);
  160.  
  161.   InitShaders; GenTexture;
  162.  
  163.   glClearColor(0.0, 0.0, 0.0, 1.0);
  164.   glutMainLoop();
  165. end.
  166.  

Gigatron

  • Sr. Member
  • ****
  • Posts: 426
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #128 on: June 13, 2026, 01:48:44 am »
Hi

I am late and installed   lazarus 4.8 ; so here is the same fractal made with glcanvas with internal command :

glDrawTexturedShader(0,0,ww,hh,tex,fs,1.0,1.0,1.0,1.0,0.0);  // 

All project is packed to maintain demo style example with music; Feel free
to play with formula in memo1 shader text.*

Regards Gigatron
 
« Last Edit: June 13, 2026, 01:58:41 am by Gigatron »
Coding faster than Light !  https://www.youtube.com/@gtrgtr9505

microxa

  • New Member
  • *
  • Posts: 35
Re: Fast Canvas Library V1.052
« Reply #129 on: June 14, 2026, 12:37:01 pm »
Gigatron, thanks, my vintage laptop pulled off the demo! Though I had to figure out what was wrong this time; turned out it didn’t like a trailing ';', probably not by strict C canons. Respect for to do this!

Gigatron

  • Sr. Member
  • ****
  • Posts: 426
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #130 on: June 14, 2026, 04:57:35 pm »
Hi

Is possible Mac or old drivers are not accept directly the out color like this ;

gl_FragColor =texture2D(u_texture,vec2(x, y) * 0.5 + vec2(0.5, 0.5));

But need to declare gl_FragColor correctly , so the out_color is vec4 variable (x,y,z,w) ;

try this :  gl_FragColor = vec4(texture2D(u_texture,vec2(x, y) * 0.5 + vec2(0.5, 0.5),1.0));

missing 'w' was now set;

Regards Gigatron

Ps: When i am rich i will send you the latest and better laptop :)

Coding faster than Light !  https://www.youtube.com/@gtrgtr9505

backprop

  • Sr. Member
  • ****
  • Posts: 257
Re: Fast Canvas Library V1.052
« Reply #131 on: June 23, 2026, 04:59:12 pm »
Hi Gigatron.

What about Mandelbrot explorer with GLSL? Julia is just 2D, while Mandelbrot is full 4D. Or even more interesting - 3D cut instead standard 2D... IIRC, there is some fractal explorer which doing exactly that... At least it is more interesting to dig in that...
« Last Edit: June 23, 2026, 05:00:50 pm by backprop »

Gigatron

  • Sr. Member
  • ****
  • Posts: 426
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #132 on: June 23, 2026, 07:10:09 pm »
Hi backprop

Are you talking about this example ? https://mandelbrot.site/

Regards
Coding faster than Light !  https://www.youtube.com/@gtrgtr9505

backprop

  • Sr. Member
  • ****
  • Posts: 257
Re: Fast Canvas Library V1.052
« Reply #133 on: June 24, 2026, 08:13:53 am »
No. I have forgot what was it, but there was in the past projects which aimed fractals and not focusing just on 2D cut.

MathMan

  • Hero Member
  • *****
  • Posts: 532
Re: Fast Canvas Library V1.052
« Reply #134 on: June 25, 2026, 09:31:50 pm »
No. I have forgot what was it, but there was in the past projects which aimed fractals and not focusing just on 2D cut.

Quaternion fractals maybe? For Julia type look here https://paulbourke.net/fractals/quatjulia/

 

TinyPortal © 2005-2018