Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Edit public variable value inside another thread using threadedFunction

$
0
0

@fdiba wrote:

Hello,

I'm starting a new project and I need to save a vector of meshes as ply files every 5 minutes.

I am doing it using a second thread. I have written a class MyThread based on this example:

http://openframeworks.cc/documentation/utils/ofThread/

Everything works fine: I am able to exchange data between the ofApp.ccp and the header of MyThread using the function update() located in ofApp.ccp using code like this:

myImage = thread.image;

But how can I do the exact opposite ?

Obviously thread.image = myImage won't work.

If I put this line of code in the threadedFunction() defined in the header of the class MyThread I am not able to recognize "myImage".

To sum up, how can I access and edit "myImage" (or any public variable declared in the header of ofApp) inside the threadedFunction() defined at the adress below ?

http://openframeworks.cc/documentation/utils/ofThread/

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles