3 ms·
Ah, raw PPM output. Reminds me of this which I wrote some years ago: #!/usr/bin/perl # Output is a PPM file : try snowflake | xloadimage stdin # se
by pjc50 9y ago
Ah, raw PPM output. Reminds me of this which I wrote some years ago:
#!/usr/bin/perl
# Output is a PPM file : try snowflake | xloadimage stdin
# see http://cam.pm.org/christmasppc-summary.shtml#Pete_Clay for explanation
$w= 100
;$w*=5; ;$W=$w*
$w; q--; $p=atan2(1,0)* 2;3; @P=
("\000"x3)x( $W); BEGIN{$";sub
S{$_.='fhoq' }sub K{$_.='s'.((
$n ++)) .(( '' .'' .'{' ))
;}; sub Y{$_ .= $_[0 ]}; S;K
;Y(''. '$k/=2;$'. '' .'l/=2}'); S;K;0;
Y( '$k/=3;$l/=3;$k+=$j/4}fhoqh{'. ''
.'cevq"P6\a$jq$j\a255\a",q@P}');S;K;Y('$g=$c/3;e}');
S;K; Y(q.$g=$. .'c/-3;' .'e}');S ;K;Y('$'. 'g'.
'=' .'$c*2' .'/3}' );;s/v /vag/x; sub
p{$P [$x+$w/2+ int($y)* $w+$W/2] ="\377"x3 }sub
r{$z=$x*cos($t)+$y*sin($t);$y=$x*sin($t)-$y*cos($t);
$x =$z};tr/a-z/n-za-m/;s/d/$"/gx; $x
++;$y= 4;eval$_}; s/ /japh/;sub T{;$a=
$_[ 0]; ;$b= (( $a&( ($a |(+
$a <<1) )<< 1) )>> 2)|( $a
>>3);if($b){ $_[0 ]=""}else{$_
[0]="f$a;p;" }};; for(1..20000
*10 ){$_ =int(rand(20)) ;T$_ ;0;
eval$_} u#byPJC
#JA PH#
Ironically on the DOS systems (and early home computers) I learnt on it was really easy to display images from programs as the framebuffer was at a known memory address and you could just write to it. Windowing systems make that a bit harder, and very little of this is really portable.
- fb03 9y agoOn MS-DOS the FB was at $A000 and you could address it easily using stuff like mem[] in Pascal. I remember doing lots of animation and random graphics stuff in DOS using mode 13, the usual stuff at the time, plasma etc. 320 x 200 was more than enough for this kind of fun. Good times, simple times!
- faragon 9y agoIt is as easy to setup a framebuffer into a SDL window, working pretty much like in the DOS days.
- fb03 9y agoyeah, SDL rekindled my passion with this kind of stuff, man. It is so easy to set up and deference a simple software-only framebuffer and after you whet your appetite, setting up a hardware accelerated one is also dead simple in SDL2.
- stuaxo 9y agoI used to love the simplicity of this, though the default of being limited to 64k segments was a bit of a bummer.