@Gwio wrote:
Hi
I use an ofFbo to generate some pngs.
When the app gets in the draw/update loop, it works as expected, drawing the first layer from bottom to top. But calling this in setup reverses the order and draws the first layer on top.
I could use an exception just for the setup phase, but there might be a simpler solution. I'am on the master branch.ofFbo fbo; fbo.allocate(x,y,GL_RGBA); fbo.begin(); //clear with alpha ofClear(0, 0, 0, 0); //draw some stuff as first layer ofDrawRectangle(); //draw some stuff as second layer ofDrawRectangle(); fbo.end(); //creating an ofImage to save it later ofPixels pix; pix.allocate(x,y,OF_PIXELS_RGBA); fbo.readToPixels(pix); ofImage tempImg; tempImg.setFromPixels(pix);
Update: hm this works fine in a fresh empty project, so this must be related to the rest of my code. But still not sure whats causing this. See the screenshot below, #1is a png created during setup, #2 is created while runnnig, same function.
fbo.begin(); ofClear(0, 0, 0, 0); ofSetColor(0,255,0); ofDrawRectangle(0,0, 50,50); ofSetColor(255,0,0); ofDrawRectangle(0,0, 20,20); fbo.end();
Posts: 1
Participants: 1