Or should it be black ink drops in muddy water!
ß e n
/**
* asofotsoo v1.0
*/
//
// Dimensions of screen.
//
int kWidth = 640 ; //480 ;
int kHeight = 480 ; // 480 ; // 320 ;
//
// Dimensions of texture.
// For fast PCs reduce or remove the denominator.
//
int kTextureWidth = kWidth ;
int kTextureHeight = kHeight ;
//
// Define a history buffer.
//
PImage history = createImage( kTextureWidth, kTextureHeight, RGB ) ;
void setup()
{
size( kWidth, kHeight, JAVA2D ) ;
colorMode( RGB, 1.0 ) ;
// smooth() ;
}
void draw()
{
//
// Animation based on the frame count this time!
//
float t = frameCount * 0.01 ;
pushMatrix() ;
translate( width/2, height/2 ) ;
rotate( t * 0.006* sin(t*5) ) ;
scale( 1.04 ) ;
image( history, -width/2, -height/2, kWidth, kHeight ) ;
popMatrix() ;
//
// Create the nebula effect - use 8 colour patches as seeds.
//
for ( int j = 0 ; j < 8 ; ++ j )
{
pushMatrix() ;
translate( width/2 + width*0.020*sin(t), height/2 + height*0.020*sin(t*1.37) ) ;
rotate( 2.0*PI*j/8.0 ) ;
translate( width * 0.01, 0.0 ) ;
noStroke() ;
fill( noise(t,0,j), noise(t,1,j), noise(t,2,j), 0.1 ) ;
beginShape() ;
for ( int i = 0 ; i < 100 ; ++ i )
{
float x = width * 0.25 * ( 0.5 - 1.0 * noise( t, 1.5 + 0, i * 0.01 ) ) ;
float y = height * 0.25 * ( 0.5 - 1.0 * noise( t, 1.5 + 1, i * 0.01 ) ) ;
vertex( x, y ) ;
}
endShape() ;
popMatrix() ;
}
//
// Attack ships on fire!
//
float range = width * 0.25 * ( 1.4 + sin(t*0.1) ) ;
pushMatrix() ;
translate( width/2, height/2 ) ;
for ( int i = 0 ; i < 10 ; ++ i )
{
fill( 0.0, 0.0, 0.0, 0.55 ) ;
// fill( noise(t,0), noise(t,1), noise(t,2), 0.5 ) ;
float dx = range * ( 0.5 - noise( t, 0, i*0.1 ) ) ;
float dy = range * ( 0.5 - noise( t, 1, i*0.1 ) ) ;
ellipse( dx, dy, 3, 3 ) ;
}
popMatrix() ;
//
// Use the current frame as the texture for the
// mirror in the next frame.
//
history.copy( get(), 0, 0, width, height, 0, 0, kTextureWidth, kTextureHeight ) ;
}
6 comments:
Pretty fantastic, stuff I guess I need a more powerful graphics card to fully appreciate it though. Still looks a bit muddy on my somewhat ancient linux machine (processor cooling fan needs replacing, that's how ancient).
Hi Martin
Well it doesn't actually do a lot but the real killer is the history.copy() line... it is very very slow to read the screen buffer.
ß e n
So far so good with new processor cooling block and fan, that I've just installed. I wouldn't do it just to get quieter pc though, too hairy, bearings had all but gone on the fan so I didn't have much choice...
I suppose even my old graphics card is not so bad compared with some on-board graphics, or ones that linux doesn't support because your opengl stuff runs pretty well. I'm struggling a bit converting your Mirror program to ruby-processing, I'm learning a lot in the process though...
Sounds like it was on its last legs!
I'm finding it really difficult to push OpenGL in Processing - it all seems to be cpu bound. For example asofotsoo runs slower in OpenGL mode than JAVA2D. So even a brand spanking new gfx card will make no difference in Processing.
I've never tried Ruby... Let me know how you get on!
ß e n
Just updated to AMD 64 bit linux, now looks fantastic, I guess I'll have to give your other sketches a go.
Did you get to see the Karsten Schmidt exhibition?
HI
Been very busy lately and can't remember if I did!
I enjoy seeing your work with Context Free by the way, keep the good work up!
b e n
Post a Comment