We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › water/ripple effect over text
Poll Poll
Question: water/ripple effect over text?



« Created by: dap on: Jul 15th, 2009, 8:42am »

Page Index Toggle Pages: 1
water/ripple effect over text? (Read 1775 times)
water/ripple effect over text?
Jul 15th, 2009, 8:42am
 
Hi..
I'm newbie with Processing.

I manage to have some ripple effects done with opengl librarie.

I intend to have a text as background, and the effects would work on top of text.. simulating the text to be under water.

How can I acheive it with processing?
Any clues would be greatly appreciated.

Thanks in advance
David Palma
Re: water/ripple effect over text?
Reply #1 - Jul 15th, 2009, 8:59am
 
Hi I am doing something similar, I manage by having a ripple class that takes a PImage from the canvas, do the ripple stuff and update

in the draw method I have to refresh the image that gets send  to the ripples class before the update

Code:
void setup() { 
 /*
 here is the init setup of my sketch
 */

 img = createImage(width, height, RGB);
 refreshImg();

 ripple = new Ripple(img);

}

void draw() {
 /*
 here I do my stuff, this is what I capture in the refreshImage method
 */

 refreshImg();
 ripple.update();
}


void refreshImg() {
 img.loadPixels();
 for (int y = 0; y < height; y++) {
   for (int x = 0; x < width; x++) {
     // this can be optimize to use only get();
     // need to sort it out
     int px = get(x, y);
     img.pixels[x + y * width] = px;
   }
 }
 img.updatePixels();
}

Hope this makes sence

Cheers
rS
Re: water/ripple effect over text?
Reply #2 - Jul 15th, 2009, 9:14am
 
I vote 'a'.
Page Index Toggle Pages: 1