paulf
July 10, 2012, 9:50am
1
Hi
I am trying to create an effect of having mesh progressively appearing/ construsting itself
this is how I did
if(vertexNumber<mesh.getNumVertices())
{
vertexNumber++;
}
for(int i=0; i<vertexNumber; i++)
{
ofVec3f cur = mesh.getVertex(i);
glPointSize(2.0f);
glBegin(GL_POINTS);
glVertex3f(cur.x,cur.y,cur.z);
glEnd();
}
This is working with points, but not working with lines or triangles because the points are not in the good order for the loop.
Thanks for your help.
Have you tried mesh.getNumIndicies for the for loop and getIndex? It would look something like this, though I haven’t tested.
if(indexNumber < mesh.getNumIndicies()) {
indexNumber++;
}
glBegin(GL_LINES);
for(int i=0; i< indexNumber; i++) {
ofVec3f cur = mesh.getVertex( mesh.getIndex(i) );
glVertex3f(cur.x,cur.y,cur.z);
}
glEnd();
paulf
July 12, 2012, 12:15am
3
Hi Nick,
Thanks a lot for your reply, it worked great!!
It helped me to understand about mesh principles
If you have interesting links or resources for learning about mesh and working with 3d in OF please let me know.
Hi Paul,
Have you checked out the 3d examples in OF 0071?
https://github.com/openframeworks/openFrameworks/tree/master/examples/3d
Roxlu made some slides about the structure of 3d in OF
http://www.slideshare.net/roxlu/openframeworks-007-3d
If you are looking for 3d physics, you can check out my bullet wrapper, which has some examples
https://github.com/NickHardeman/ofxBullet