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

backprop

  • Guest
Re: Fast Canvas Library V1.052
« Reply #135 on: June 25, 2026, 10:30:27 pm »
Quaternion fractals maybe? For Julia type look here https://paulbourke.net/fractals/quatjulia/

Right, something as this: https://icefractal.com/

And this is amazing structure, who would say this is just a fractal? https://paulbourke.net/fractals/midjourney/
« Last Edit: June 25, 2026, 11:04:19 pm by backprop »

microxa

  • New Member
  • *
  • Posts: 36
Re: Fast Canvas Library V1.052
« Reply #136 on: June 25, 2026, 11:46:13 pm »
This is the most cyberpunk craziness I've ever had to deal with on 16/8-bit machines. Gemini surprised me yet again with its proficiency in OpenGL, implementing (after roughly five attempts) a pixel-perfect OpenGL scroll for this "loom of integral randomness

Code: Pascal  [Select][+][-]
  1.  
  2. {$APPTYPE CONSOLE}{$mode objfpc}
  3. program OpenGLFractal_OnePixelScroll;
  4.  
  5. uses
  6.   SysUtils,
  7.   GL,GLExt,Glu,Glut;
  8.  
  9. //Fast random, origin from BK-0010 (PDP-11 community)
  10. //rework to Pascal by Gemini AI
  11. var Seed: Integer = 1;
  12. function Rand(v: Integer): Integer;
  13. var
  14.   a, e: Integer;
  15. begin
  16.   a := seed;
  17.   e := byte(a) shr 1;
  18.   a := (a and $FFFFFF00 shl 1) or (a and 1 shl 8);
  19.   e := e xor (a shr 24);
  20.   Result := a xor e;
  21.   seed := Result;
  22. end;
  23.  
  24. exports rand;
  25.  
  26. const
  27.   TEX_WIDTH  = 1024;
  28.   TEX_HEIGHT = 512;
  29.  
  30. var
  31.   TextureID: GLuint;
  32.  
  33.   //All coordinates in integer
  34.   CurX: Integer = 0;
  35.   CurY: Integer = 0;
  36.   FineScroll: Integer = 0; // Shift to 0..1023
  37.  
  38.   LineBuffer: array[0..8 * TEX_HEIGHT * 3 - 1] of GLubyte;
  39.  
  40.   // mouse
  41.   RotX: Single = -28.0;// -34.50;
  42.   //45.0;
  43.   RotZ: Single = 90.0;
  44.   Zoom: Single = -1.2;//-2.5;
  45.   MouseX, MouseY: Integer;
  46.   MouseButton: Integer = -1;
  47.  
  48.  
  49. // Write byte in vertical line
  50. procedure BufferByte(Y, Val: Integer);
  51. var
  52.   BitIdx, PixelOffset: Integer;
  53.   Color: integer;
  54. begin
  55.   for BitIdx := 7 downto 0 do
  56.   begin
  57.     PixelOffset := (Y * 8 + (7 - BitIdx)) * 3;
  58.  
  59.     if ((Val shr BitIdx) and 1) = 1 then
  60.       Color := 0 else Color := $FFFFFF;
  61.  
  62.     LineBuffer[PixelOffset + 0] := Color;       // R
  63.     LineBuffer[PixelOffset + 1] := Color shr 8; // G
  64.     LineBuffer[PixelOffset + 2] := Color shr 16;// B
  65.   end;
  66. end;
  67.  
  68. // Visualizer (from Speccy/Orion-128)
  69. procedure RenderLine;
  70. var
  71.   R: Integer;
  72. begin
  73.   R := Rand(0);
  74.   BufferByte(CurY, R);
  75.   Inc(CurY);
  76.  
  77.   if CurY >= TEX_HEIGHT then // Vertical line complete
  78.   begin
  79.     CurY := 0;
  80.  
  81.     glBindTexture(GL_TEXTURE_2D, TextureID);
  82.     // Drop 8-pixels block to current X coordinate CurX
  83.     glTexSubImage2D(GL_TEXTURE_2D, 0, CurX, 0, 8, TEX_HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, @LineBuffer);
  84.  
  85.     // Shift marker up 8 pixels
  86.     CurX := CurX + 8;
  87.     if CurX >= TEX_WIDTH then
  88.     begin
  89.       CurX := 0;
  90.     end;
  91.   end;
  92. end;
  93.  
  94. procedure Idle; cdecl;
  95. var
  96.   i: Integer;
  97. begin
  98.  
  99.   for i := 1 to (TEX_HEIGHT div 8) do RenderLine;
  100.  
  101.   FineScroll := FineScroll + 1;
  102.  
  103.   if FineScroll >= TEX_WIDTH then
  104.     FineScroll := FineScroll - TEX_WIDTH;
  105.  
  106.   glutPostRedisplay;
  107. end;
  108.  
  109. procedure Display; cdecl;
  110. var
  111.   NormOffset: Single;
  112. begin
  113.   glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
  114.  
  115.   NormOffset := ((FineScroll + 8) / TEX_WIDTH);
  116.  
  117.   glMatrixMode(GL_TEXTURE);
  118.   glLoadIdentity;
  119.   glTranslatef(NormOffset, 0.0, 0.0); // Shift one pixel
  120.  
  121.   // --- ������� ������ (3D) ---
  122.   glMatrixMode(GL_MODELVIEW);
  123.   glLoadIdentity;
  124.  
  125.   glTranslatef(0.0, 0.0, Zoom);
  126.   glRotatef(RotX, 1.0, 0.0, 0.0);
  127.   glRotatef(RotZ, 0.0, 0.0, 1.0);
  128.  
  129.   glBindTexture(GL_TEXTURE_2D, TextureID);
  130.   glBegin(GL_QUADS);
  131.     glTexCoord2f(0.0, 0.0); glVertex3f(-1.5, -0.75, 0.0);
  132.     glTexCoord2f(1.0, 0.0); glVertex3f( 1.5, -0.75, 0.0);
  133.     glTexCoord2f(1.0, 1.0); glVertex3f( 1.5,  0.75, 0.0);
  134.     glTexCoord2f(0.0, 1.0); glVertex3f(-1.5,  0.75, 0.0);
  135.   glEnd;
  136.  
  137.   Sleep(40);
  138.   glutSwapBuffers;
  139. end;
  140.  
  141. procedure Reshape(Width, Height: Integer); cdecl;
  142. begin
  143.   if Height = 0 then Height := 1;
  144.   glViewport(0, 0, Width, Height);
  145.   glMatrixMode(GL_PROJECTION);
  146.   glLoadIdentity;
  147.   gluPerspective(45.0, Width / Height, 0.1, 100.0);
  148.   glMatrixMode(GL_MODELVIEW);
  149. end;
  150.  
  151. procedure Mouse(button, state, x, y: Integer); cdecl;
  152. begin
  153.   if state = GLUT_DOWN then
  154.   begin
  155.     MouseButton := button; MouseX := x; MouseY := y;
  156.   end else MouseButton := -1;
  157. end;
  158.  
  159. procedure Motion(x, y: Integer); cdecl;
  160. begin
  161.   if MouseButton = GLUT_LEFT_BUTTON then
  162.   begin
  163.     RotZ := RotZ + (x - MouseX) * 0.5;
  164.     RotX := RotX + (y - MouseY) * 0.5;
  165.     MouseX := x; MouseY := y; glutPostRedisplay;
  166.  
  167.   end;
  168.   if MouseButton = GLUT_RIGHT_BUTTON then
  169.   begin
  170.     Zoom := Zoom + (y - MouseY) * 0.01; MouseY := y; glutPostRedisplay;
  171.   end;
  172. end;
  173.  
  174. procedure Init; var i:integer;
  175. begin
  176.   glClearColor(0.0, 0.0, 0.0, 1.0);
  177.   glEnable(GL_TEXTURE_2D);
  178.   glEnable(GL_DEPTH_TEST);
  179.  
  180.   glGenTextures(1, @TextureID);
  181.   glBindTexture(GL_TEXTURE_2D, TextureID);
  182.  
  183.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  184.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  185.  
  186.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);//GL_NEAREST);
  187.   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);//GL_NEAREST);
  188.  
  189.   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, TEX_WIDTH, TEX_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, nil);
  190.  
  191.   for i := 1 to (TEX_WIDTH * TEX_HEIGHT) div 8 do RenderLine;
  192.  
  193. end;
  194.  
  195.  
  196. begin
  197.   glutInit(@argc, argv);
  198.   glutInitDisplayMode(GLUT_DOUBLE or GLUT_RGB or GLUT_DEPTH);
  199.   glutInitWindowSize(1024, 600);
  200.   glutCreateWindow('XORSHIFT 1-Pixel Scroll');
  201.  
  202.   Init;
  203.  
  204.   glutReshapeFunc(@Reshape);
  205.   glutDisplayFunc(@Display);
  206.   glutIdleFunc(@Idle);
  207.   glutMouseFunc(@Mouse);
  208.   glutMotionFunc(@Motion);
  209.  
  210.   glutMainLoop;
  211. end.
  212.  
  213.  
  214.  

Gigatron

  • Sr. Member
  • ****
  • Posts: 433
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #137 on: July 30, 2026, 12:42:04 am »
Hi
In the past i've made a nice game for construct2 called X-ball,
this attempt is try to make this game in pascal code using glCanvas;

https://www.construct.net/en/free-online-games/x-ball-1727/play

Please improve or play with it; Arrow keys Left/Right to control ball and hit 'S' Sprite to gain
speed .
 
Regards
Gigatron
« Last Edit: July 30, 2026, 12:43:44 am by Gigatron »
Coding faster than Light ! Finishing 5 Java Projects , will come back soon ;
https://www.youtube.com/@gtrgtr9505

Datalore

  • New Member
  • *
  • Posts: 16
Re: Fast Canvas Library V1.052
« Reply #138 on: July 30, 2026, 11:25:04 pm »
Looks like a neat fun little game  :D

Just a tiny nitpick,

glLoadPNGToTexture('fonts/32/bitmap_font.png', fntx_w, fntx_h); should really, really, really be
glLoadPNGToTexture('Fonts/32/bitmap_font.png', fntx_w, fntx_h); as the name of your fonts directory is capitalized.

Things tend to be case sensitive on some systems ;-)

Granted, code from Redmond is designed by clowns who are supervised by monkeys who report to caffeinated toddlers who are overseen by a bunch of floppy puppies who are monitored by a wasted bachelorette party whose boss is just a large inflatable tube man (take this with a large grain of salt, i'm not really serious here) so on most of these systems this doesn't matter as much, but it can be enabled.

Gigatron

  • Sr. Member
  • ****
  • Posts: 433
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #139 on: August 07, 2026, 01:53:29 am »
@Datalore  it's ok for future;

Today i would share something new with lazarus users, i am working on a new
oldschool demomaker library only for windows like fastcanvas with Win Api but
this time GL rendering and LCL free, just made a little demo; the exec is very small than
300 kb;
Sfx  : by Reptile & Sky ; outrun 2000 remix . xm zipped;

Regards  GTR
Coding faster than Light ! Finishing 5 Java Projects , will come back soon ;
https://www.youtube.com/@gtrgtr9505

microxa

  • New Member
  • *
  • Posts: 36
Re: Fast Canvas Library V1.052
« Reply #140 on: August 09, 2026, 01:11:53 pm »
An AI-slop WinAPI implementation of the legacy GLUT

Thausand

  • Hero Member
  • *****
  • Posts: 613
Re: Fast Canvas Library V1.052
« Reply #141 on: August 09, 2026, 05:25:14 pm »
A docile goblin always follow HERMES.md

Gigatron

  • Sr. Member
  • ****
  • Posts: 433
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #142 on: August 10, 2026, 01:28:23 am »
Hi

2D primitives added with xmp player lite version (no packing added) this mean
the module must not zipped.
Cool demo example here ;

Regards Gigatron
Coding faster than Light ! Finishing 5 Java Projects , will come back soon ;
https://www.youtube.com/@gtrgtr9505

Gigatron

  • Sr. Member
  • ****
  • Posts: 433
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #143 on: August 22, 2026, 01:39:26 am »
Hello;
 I'm working on 5 Java projects with Android Studio so I'm not there yet, but of course I'm doing oldschool demos in my little free time with the glCanvas101... Here is the remake of the second demo after Boing Ball... El Gato (Blair· Sullivan Computer Graphics, 1987) Cat animation demo... live version on YT;

https://www.youtube.com/watch?v=wKmHqsX4vZE
Original:
https://www.youtube.com/watch?v=hNT4w8DLEaI
Sfx sample by; Depeche Mode - Strangelove (Razormaid Mix)
https://www.youtube.com/watch?v=F2aR2-53jRE

All size calculated to 500 kb to upload to the forum , modules and other gfx , sorry
for bad resolution.

Regards Gigatron
« Last Edit: August 23, 2026, 03:13:34 am by Gigatron »
Coding faster than Light ! Finishing 5 Java Projects , will come back soon ;
https://www.youtube.com/@gtrgtr9505

Gigatron

  • Sr. Member
  • ****
  • Posts: 433
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Fast Canvas Library V1.052
« Reply #144 on: August 27, 2026, 01:35:12 am »
Hi

I would like to share a new demo coded with the latest glcanvas 1.01 added some new fx
to make the Famous World of Wondes copper cycle command ;

 --  glCopperCycle(0, 0, ww, scaleY, WoWRamps, 31, 10, 10, 38, tmr*4.0);

WowRamps are colors of bands like so ;

WoWRamps: array[0..6] of TglColor = (
    (R:0; G:0; B:1; A:1),   // bleu
    (R:0; G:1; B:0; A:1),   // vert
    (R:1; G:0; B:0; A:1),   // rouge
    (R:1; G:0; B:1; A:1),   // magenta
    (R:0; G:1; B:1; A:1),   // cyan
    (R:1; G:1; B:0; A:1),   // jaune
    (R:1; G:1; B:1; A:1)    // blanc
  );   

Wow demo on YT ; https://www.youtube.com/watch?v=EQe7WycyYwE 

My demo on YT  ; https://www.youtube.com/watch?v=fZJCAivXI8U

Contain old amiga digitized sound from various group .. (1986-87) before Soundracker;

Demo zipped in one file; with just 1 digitized sample

Regards
Coding faster than Light ! Finishing 5 Java Projects , will come back soon ;
https://www.youtube.com/@gtrgtr9505

 

TinyPortal © 2005-2018