ofDrawBitmapString() move along the ofMesh's wireframe

#1

Hi everyone,
I am wondering if anyone know how to make the ofDrawBitmapString move along the ofMesh’s wireframe?

for example, i have this bird ofMesh and I want the word “hey” moves along this bird mesh’s wireframe from vertex to vertex.

I know how to get each vertex’s position, but don’t know how to implement the “hey” will move along with the mesh edge/wireframe

If anyone can point out a direction to work it will be super helpful! Thanks!

#2

Or anyone know how the drawWireframe() function know there is or not a line between certain vertices? it will be helpful too!

#3

Hi,

I think you can do it using multiple ways.
I would select the vertices of your vbo you want to see the word moving from and use them 2 by two, storing the average positions over time into an ofVec3f:

in ofApp.cpp::update():

    //with prop a function of the time : 
    float prop = ofMap(ofGetElapsedTimeMillis() % 1000, 0, 10000, 0, 1);
    ofVec3f heyPos = vbo.getVertex(indexVertex) * prop + vbo.getVertex(indexVertex+1) * (1-prop);
    if (prop > 1)indexVertex ++;

Hope this helps,

++
P

1 Like
#4

Hi P,
Thanks for the solution, it works!
However, it will jump around after finish move from one vertex to another like the gif below


Do you know it is doing that?
Thanks!

#5

I’m glad it’s working !

yeah that’s because the order of your indices don’t correspond to their place in space, you need to sort them by place in space.
To do that, you need to use this method i think : setupIndicesAuto of your mesh.

++

P

#6

Hi P,
Sorry I didn’t saw the notification of your last reply, I will try setupIndecesAuto() later.
But I just figure out another way! And here is how it looks textBird

This getUniqueFaces() function will return a vector of faces of the mesh, each face is constructed of 3 vertices, then we will know these 3 vertices is definitely connected to each other.

Later we need to build a data struct to store the connection information, and do a repeat checking(there will a huge amount of overlapped vertex), also make sure the overlapped vertices share the same connection information.

Hope this would help someone who is interested in the similar idea later : )

2 Likes