Hi.
i was making some experiments with boids and with flow fields using perlin noise.
i came up with this one.
i’m really happy with the results
Hi.
i was making some experiments with boids and with flow fields using perlin noise.
i came up with this one.
i’m really happy with the results
That is truly beautiful. Plus so many people post examples without the source code. You cant learn that way. I think the learning process is a better share than just a “WOW thats cool” expression.
ding
hi, i forgot to add that in that source i use a function to draw circles in 3d space, it wont compile without it.
the function is a very simple adaptation of the original one and code is as follows
//this function is pretty much a copy of the other one
//i just added the "z" variable in the constructor...
void ofCircle(float x, float y, float z, float radius){
if (!bSetupCircle) setupCircle();
// use smoothness, if requested:
if (bSmoothHinted && drawMode == OF_OUTLINE) startSmoothing();
// draw:
glPushMatrix();
//and changed this line here to translate also in the Z plane (and thats it):
glTranslatef(x, y, z);
glScalef(radius, radius, 1);
glBegin( (drawMode == OF_FILLED) ? GL_POLYGON : GL_LINE_LOOP);
glCallList(precachedCircle);
glEnd();
glPopMatrix();
// back to normal, if smoothness is on
if (bSmoothHinted && drawMode == OF_OUTLINE) endSmoothing();
}
it goes in the ofGraphics.cpp file, and the constructor must go on the ofGraphics.h file, and thats it
AAHHHH … with more time on my hands these days, I was hoping to start playing with OF again so I took a look at the example section and noticed all the wonderful samples from Pelintra. Boids, noise fields… exactly the stuff that I am trying to tackle and learn… I was so excited until I noticed all the source links were dead!!!
Anyone, including Pelintra, might be gracious enough to provide those files again?
The original links were these:
http://www.rui-m.com/OF/bloodrush/src.zip
http://www.rui-m.com/OF/slugs/src.zip
http://www.rui-m.com/OF/soundvisualstest1src/src.zip
http://www.rui-m.com/OF/bolas/src.zip
http://www.rui-m.com/OF/marchingcubes/src.zip
http://www.rui-m.com/OF/criaturas/src.zip
Hope someone can help!
Thanks so much
M.
I just wrote my own boiding class based upon this pseudocode:
http://www.vergenet.net/~conrad/boids/pseudocode.html
testvideo at vimeo:
http://vimeo.com/1606202
I also added a simple HDR realtime blooming effect using GLSL.
Hey Moka… your stuff is very cool indeed! You are definitely more proficient than me! so for me looking at some good code samples is truly a quick way to get a grasp of things, especially since I have to spend so much time doing other stuff not related to programming =( That’s why these forums and you all are a blessing man! Anyhow, I trying to hack away as much as I can =)
hum…
I’m noob so… I wanted to look how things work…
but i cannot download the code…
I associate with mohei, can some one give some updated link? tnx
hi.
sorry for the dead links. i had some problems with my server (i think it was my fault) and had to have my account restarted. and this happened while i was out on vacation, thats why the sources are not online yet. i’ll upload them either today or tomorrow.
sorry
*edit* they’re online, everything should work now (i think)
It works! Great ( not tryed the code now… just donwloaded ), TNX A LOT
@ Moka,
I’ve been looking at the same pseudocode for writing flocking behaviour, which I would like to experiment with for a new project I’m working on (see this post for info/background on the upcoming project http://forum.openframeworks.cc/t/ofxosc-v0.3-now-available/970/3).(Especially like how the boiding code is setup - allowing for extra rules to be added; like stuff for predators and attractors…)
Since I’m having serious (programming newbie :? ) trouble converting the ideas into compilable of-code, I was wondering if you are willing to share some insight into your boiding class.
cheers,
-tim
Thanks Pelintra. You guys are awesome! =)
hi pelintra,
looks like the link to the source is dead again…
any chance of bring it back to life?
Hi.
i had some problems with my host which led to having my stuff down for over a week!
but its now up again so the link should work.
but anyway, i also created a google code to store all my sources you can check it here:
code.google.com/p/ruisource
cool thanks for that!
its very impressive work btw…
hi pelintra, in your code creatures, you have a call name opengl/opengl.h, were can i find this library i change for gl/gl.h and dosn´t work.
thx for sharing your code…
Hi JohnaVilla2,
you shouldn’t have to include opengl in your code, i only did that because that code is old and i didn’t know what i was doing
delete that line and use #include “ofMain.h” instead, it has the opengl includes that you need.
Rui
thx all works ok, very nice code :S
you are awesome men
Just wanted to notice you that after adding your circle function I got an error with:
glCallList(precachedCircle);
It seems the implementation of circle in 006 is different from when you did your function.
I commented the line out, and it runs but I don’t get any circle rendered
Oh Indeed after some tweaking between your code and the next implementation I tried this:
void ofCircle(float x,float y, float z, float radius){
if (!bSetupCircle) setupCircle();
// use smoothness, if requested:
if (bSmoothHinted && drawMode == OF_OUTLINE) startSmoothing();
glPushMatrix();
glTranslatef(x, y, z);
int k = 0;
for(int i = 0; i < numCirclePts; i++){
circlePtsScaled[k] = x + circlePts[k] * radius;
circlePtsScaled[k+1] = y + circlePts[k+1] * radius;
k+=2;
}
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, &circlePtsScaled[0]);
glDrawArrays( (drawMode == OF_FILLED) ? GL_TRIANGLE_FAN : GL_LINE_LOOP, 0, numCirclePts);
glPopMatrix();
// back to normal, if smoothness is on
if (bSmoothHinted && drawMode == OF_OUTLINE) endSmoothing();
}
and it seems to do the trick (may be haha)
I am not sure, because the circle does not appear near the ribbon…
Anyway thanks again for you great code
I still must find some time to read it and start using oF !
you can get weirder shape with some:
void ofCircle(float x,float y, float z, float radius){
if (!bSetupCircle) setupCircle();
// use smoothness, if requested:
if (bSmoothHinted && drawMode == OF_OUTLINE) startSmoothing();
glPushMatrix();
glTranslatef(x, y, z);
int k = 0;
for(int i = 0; i < numCirclePts; i++){
circlePtsScaled[k] = x + circlePts[k] * radius;
circlePtsScaled[k+1] = y + circlePts[k+1] * radius;
[/code]
circlePtsScaled[k+2] = y + circlePts[k+2] * radius;
k+=3;
}
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, &circlePtsScaled[0]);
glDrawArrays( (drawMode == OF_FILLED) ? GL_TRIANGLE_FAN : GL_LINE_LOOP, 0, numCirclePts);
glPopMatrix();
// back to normal, if smoothness is on
if (bSmoothHinted && drawMode == OF_OUTLINE) endSmoothing();
}
and so on