openframeworks/openFrameworks — pull request #1274 by arturoc (2012-05-25 00:18:28+00:00)
Title: Fbo cleanup arturo

different refactoring of the fbo allocate function. now it has variables to setup the different options and less ifdefs. it also mantains the depth in texture for GL ES. actually in android depth and stencil is not supported except in openGL ES 2 so feel free to change it to whatever works in iOS

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;
settings.depthStencilInternalFormat=GL_DEPTH_COMPONENT32;
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);

i've added some comments in allocate for things i've changed for openGL ES if someone can try iOS and verify it's working?