I want to push my texture to a threaded saver, but the img saved is all grey, seems like is saving the ofPixels empty without the part that read texture to pixels.
Why this do not work¿
#pragma once
#include "ofMain.h"
class threadSaver : public ofThread
{
public:
threadSaver()
{
startThread();
}
~threadSaver()
{
toSave.close();
waitForThread(true);
}
void paSave(ofTexture & text) {
toSave.send(text);
}
private:
void threadedFunction() {
ofTexture text;
while (toSave.receive(text)) {
ofPixels pxs;
text.readToPixels(pxs);
ofSaveImage(pxs, "C:/Users/natxo/Documents/" + ofToString(ofGetElapsedTimeMillis()) + ".png");
}
}
ofThreadChannel<ofTexture> toSave;
};