@cuinjune wrote:
Hi, I just figured out calling ofImage::setFromPixels() causes crash on iOS while it works fine on MacOS.
Here's my test code.
ofFbo fbo; ofImage img; //-------------------------------------------------------------- void ofApp::setup(){ ofSetBackgroundColor(0); //allocate an image space img.allocate(ofGetWidth(), ofGetHeight(), OF_IMAGE_COLOR_ALPHA); //clear and allocate a fbo fbo.begin(); ofClear(0,0,0,0); fbo.end(); fbo.allocate(ofGetWidth(), ofGetHeight(), GL_RGBA); //draw an ellipse to the fbo fbo.begin(); ofClear(0,0,0,0); ofSetColor(255); ofDrawEllipse(ofGetWidth()/2, ofGetHeight()/2, ofGetWidth(), ofGetHeight()); fbo.end(); //copy pixels from fbo to image ofPixels pixels; fbo.getTexture().readToPixels(pixels); img.setFromPixels(pixels); } //-------------------------------------------------------------- void ofApp::update(){ } //-------------------------------------------------------------- void ofApp::draw(){ //draw the image img.draw(0, 0, ofGetWidth(), ofGetHeight()); }And this is the result you will see if you run the code on MacOS.
However, if you run the same code on iOS, it crashes on startup with the following error.
It doesn't produce any error if I comment out
img.setFromPixels(pixels);Should I report this on github?
And Is there any other way to copy pixels from ofFbo to ofImage?
Thanks!
Posts: 12
Participants: 2

