openframeworks/openFrameworks — pull request #1275 by arturoc (2012-05-25 10:42:18+00:00)
Title: Fbo refactor

@ofTheo this has all your changes but refactored in a different way so there's less ifdef's. it also keeps depth/stencil as texture for openGL ES but i haven't been able to test it cause actually in android depth and stencil is not supported except in openGL ES 2 if you can give it a try in iOS and if it doesn't work we can just set the flag to false in GL ES and log.

I've also disabled the mandatory stencil + depth for GL ES. from some posts in the forum, it seems like it should work just not the way it was done before, also if you can try it, if it doesn't work just uncomment the first lines in allocate which set stencil if depth is enabled

stencil only doesn't work for me in the desktop either but it's the same as before so it's probably my implementation which doesn't support stencil only or the current code is broken.

here's a simple test for the depthAsTexture:

ofFbo::Settings settings;
settings.depthStencilAsTexture = true;
settings.width=640;
settings.height=480;
settings.useDepth=true;
settings.useStencil=true;
depth.allocate(settings);

depth.begin(true);
glEnable(GL_DEPTH_TEST);
ofBox(0,0,0,100);
ofBox(100,100,-100,100);
ofBox(300,300,-300,100);
depth.end();

glDisable(GL_DEPTH_TEST);

then in draw

depth.getDepthTexture().draw(0,0);