Skip to content

Commit 4f02580

Browse files
committed
Post-draw GL read-backs now work from antialiased framebuffer (fix openframeworks#822; replaces commit 29e8034).
We're now setting display-mapped 'resolve' buffer (defaultFramebuffer) as current framebuffer after a draw, rather than the fsaa buffer. The fsaa buffer is set as current again before next draw.
1 parent 5764ce1 commit 4f02580

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

addons/ofxiPhone/src/gl/ES1Renderer.m

+10-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ -(EAGLContext*) context {
4848

4949
- (void)startRender {
5050
[EAGLContext setCurrentContext:context];
51+
52+
if(fsaaEnabled) {
53+
// Set up so that we draw into the multisampled buffer.
54+
glBindFramebufferOES(GL_FRAMEBUFFER_OES, fsaaFrameBuffer);
55+
}
5156
}
5257

5358
- (void)finishRender {
@@ -70,8 +75,11 @@ - (void)finishRender {
7075
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
7176

7277
if(fsaaEnabled) {
73-
glBindFramebufferOES(GL_FRAMEBUFFER_OES, fsaaFrameBuffer);
74-
}
78+
// Set current fb to the 'resolve' buffer (mapped to the display). This means GL state is such that we can
79+
// read back (screen-grabs, texture-grabs, etc.) from within event handling methods.
80+
// Caveat: Can't execute direct GL draws from event handling methods...but don't think we should be anyway.
81+
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
82+
}
7583
}
7684

7785
- (BOOL)resizeFromLayer:(CAEAGLLayer *)layer {

0 commit comments

Comments
 (0)