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


#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