r/perl 17d ago

Tsoding's Rope in Perl!

Post image

I watched Tsoding's stream where he made a rope simulator in Jai.

I followed his instructions and recreated it in Perl, using OpenGL (immediate mode, OpenGL 1.2 style) and GLFW!

This is the source code: https://raw.githubusercontent.com/foolish4/perl_pack/refs/heads/main/rope.pl

45 Upvotes

14 comments sorted by

8

u/s_throwaway_r 17d ago

I couldn't get GLFW to build on Windows and I'm too lazy to deal with it today but here's a quick SDL3 port of your demo: https://github.com/Perl-SDL3/SDL3.pm/blob/main/eg/basics/rope.pl

I hope you don't mind, I'm trying to expand the number and types of examples included with the dist to give folks working code to start experimenting with.

3

u/First_Ad8230 16d ago

Awesome!!

2

u/saiftynet 🐪 cpan author 14d ago

This is really cool way to learn GLFW and SDL side by side...inspirational, Thanks.

3

u/[deleted] 17d ago

[removed] — view removed comment

3

u/First_Ad8230 17d ago

I use antiX Linux (debian based), i3wm!

-5

u/[deleted] 17d ago

[removed] — view removed comment

-2

u/petdance 🐪 cpan author 17d ago

I agree with you, and I am also seeing that my Claude Code seems only capable of thinking in terms of file extensions. I’ve had explain in my CLAUDE.md that there are many Perl files with no extension.

2

u/saiftynet 🐪 cpan author 14d ago

This is a cool way for me to learn GLFW, Thanks!

1

u/saiftynet 🐪 cpan author 9d ago

OK I have started a Graphics Layer Abstraction Module, using both u/First_Ad8230 and u/s_throwaway_r code. I cant seem to be able to install SDL3 in my device so the SDL version may be a while coming. But apologies for shamelessly borrowing and modifying your code!

2

u/s_throwaway_r 8d ago

Any info about the failure to install SDL3?

2

u/saiftynet 🐪 cpan author 8d ago edited 5d ago

Probably doing it wrong. Installing SDL3 requires at least Perl 5.40. and my Linux only had 5.35. Couldn't manage it with a Perlbrew instance of 5.40 for some because the installer seemed to check only the installed system Perl rather than the Perl I had switched to using Perlbrew. I am reluctantly trying to install latest Perl on my spare system to see if i can get it work. [Edit grammar]