Hi Guys, firstly I should say I’m surprised no one posted about problems compiling (other than the FreeImage stuff), because I know I"ve made quite a few little changes to the core here and there… but when I posted the source I couldn’t be bothered to go through it all and find it… I thought it would be quite straightforward for someone else to find with a clean version of OF because the compiler would just give an error at the relevant place (and I had the disclaimer on my site :oops:)
Then I remembered I marked all my changes with a comment so was actually quite easy to go through and see what I’d done - and it turns out there’s only one tiny change needed for this fluids/optical flow stuff to work - and unfortunately the change doesn’t break the compile, it just makes it act a bit weird. I know I shouldn’t have changed the core, but I was in a rush etc, etc, and was a quick fix. The change is:
in /libs/addons/ofxOpenCv/src/ofxCvGrayscaleImage.h change
void threshold( int value, bool invert = false);
to
void threshold( int value, int type = CV_THRESH_BINARY); // MSA
and in /libs/addons/ofxOpenCv/src/ofxCvGrayscaleImage.cpp change
void ofxCvGrayscaleImage::threshold( int value, bool invert) {
//[http://lush.sourceforge.net/lush-manual/01a8321b.html](http://lush.sourceforge.net/lush-manual/01a8321b.html)
if(invert) cvThreshold( cvImage, cvImageTemp, value, 255, CV_THRESH_BINARY_INV );
else cvThreshold( cvImage, cvImageTemp, value, 255, CV_THRESH_BINARY );
swapTemp();
}
to
void ofxCvGrayscaleImage::threshold( int value, int type) { // MSA
cvThreshold( cvImage, cvImageTemp, value, 255, type );
swapTemp();
}
(this does mean that other apps using invert==true on threshold will not work properly, so bear that in mind)
I have no idea what this FreeImage error is about! I’m getting quite a few emails about this, so if someone can shed any iight on the matter it would be great.
And ungaro I have no idea what your crash is related to I’m afraid. Are you sure the noisemap.png is loaded? Can you have a look at what noiseMap.width and noiseMap.height are? (they should be 512x128).
Actually all that stuff isn’t that vital. All thats going on there, is instead of calculating perlin noise every frame for every particle (there are thousands of them), I’m using a pre-calculated array of perlin noise. And instead of pre-calculating the perlin noise at the beginning of the app, I’m just loading it in as an image. So as a temp workaround you could remove everying in getNoiseAt and replace it with:
return ofRandom(-PI, PI);
The glitter won’t behave the same, but will still have a random movement. Its weird that it doesn’t work though. Even weirder that it doesn’t compile with uint!