Hello OFs!
I’ve made some little changes to ofxFBOTexture and ofxShader. If someone is interested you can find the changes here…
It can be really useful if you are into shadows, depth of field, blurs or stuffs like that!
All the credits goes to the peoples who wrote this two addons first! Actually I just added a few lines and most of the time by copy and paste! So big thanks to Zach Gage, Theo Watson, Memo Akten, Josh Nimoy and the guys behind ofxShader!
So here’s the changes:
FBO:
-Now you can manually attach how many textures (render targets) you want.
-You can also attach a depth texture.
-If you need it the stencil buffer can be enabled too.
-I added a statusCheck method wish add more error information if something is wrong!
The code is pretty straight forward:
fbo.attachTexture(attachment1, GL_COLOR_ATTACHMENT1_EXT);
fbo.attachTexture(attachment2, GL_COLOR_ATTACHMENT2_EXT);
fbo.attachTexture(depthAttachment, GL_DEPTH_ATTACHMENT_EXT);
fbo.begin(GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT);
fbo.end();
There’s a little problem with multiple rendertargets and multisampling, and as we are using the blitting technic I’m not sure if there’s any solution for that! If you need multisampling and multiple rendertargets you will need to do the blitting on your own!
Shader:
-I simplified some stuffs and added the geometry shaders
-You can specify the geometry inputs/outputs/maxvert parameters too (wish is more than important if you want you shader to work)
-If you work with multiple render targets you can bind the fragdata in the shader now.
[attachment=0:37ccc3sk]ofxShader.zip[/attachment:37ccc3sk]
shadowVolumesShader.loadShader("Shaders/ShadowVolumes", GL_TRIANGLES_ADJACENCY_EXT, GL_TRIANGLE_STRIP, 10);
Feel free to ask some questions / use or merge the code!
Cheers!
Simon.