I noticed yesterday that cpu intensive sketches tend to run a whole lot smoother when I run them from within Safari browser versus when I run them from within Processing or as an exported app on my mac.
I have a few questions about this, that I want to ask ye fellow computar wizerds :
Is it just me?
If not, is this an issue with JavaVM?
Is this because of the code is compiled differently for web browser?
Also, almost any applet crashes or bugs out when running with Chrome but I think thats an issue with Chrome.
I run a MacBookPro with the latest OSX, Core i7 and
NVIDIA GeForce GT 330M
I'm trying to figure out how to achieve a "blend to white" or a "blend to black" effect.
For example I have many particles flying around the screen and leaving very faint, almost transparent, purple trails behind. Instead of having the pixels show opaque purple after enough overlapping, I want them to veer to white, or to black, depending on the background colour. (Maybe they could simply veer to the inverse colour of the background?)
I've been messing around with various alpha blend settings and even tried an OPENGL hack with no success.
I have some code I would like to optimize using precalculated value table to avoid redundant operations.
Here is the code, it's pupose is to set a moving particle's color based on its speed :
float vRatio = vel.mag()/MAX_VEL;
float cLevel = TWO_PI*vRatio;
if (heatVision)
{
//float rPhase = TWO_PI/4;
//float gPhase = 3*TWO_PI/4;
float bPhase = PI/2;
int R = int(255 / (1 + pow(2.718, 10 * (0.4 - vRatio)))); //int(128*sin(cLevel*0.5-rPhase)+127);
int G = int(220 / (1 + pow(6, 12 * (0.8 - vRatio)))); //R-int(128*sin(cLevel*0.25-gPhase)+255);
int B = int(128*sin(cLevel*1.35-bPhase)+127);
pig = color(R, G, B);
}
I would like to pracalculate a table of R, G and B values using 255 values of vRatio (from 0 to 1) and then call each value based on closest match to vRatio at runtime.
I'm guessing I need to compile this table at start time and save it in an extarnal file but I'm at a loss on how to accomplish this.
Your help is greatly appreciated!!! I will post the full source once it is complete.