Friends link: exam 70-450 cert 9a0-125 Adobe 9A0-127 exam Apple 9l0-410 Certification a00-202 Exam dumps IBM a2010-570 Exam dumps Pass A2160-669 Exam asc-029 Exam Dumps BCP-240 Actual Exam ISEB bh0-006 exam
GLOW » Hello FBO
canada goose jacke parajumpers ugo parajumpers jas ugo canada goose uk moncler outlet
2011+06+08

Hello FBO

Frame Buffer Objects are powerful stuff and could be used to create all sorts of cool effects. In this tutorial we take a look at the basics.

You can see the result here. Please view the source code and have it at hand when going through the tutorial as we’ve only touch upon the specifics here.

As usual, we create a context and setup a simple cube shader (with some hacked directional light this time). Then we create a Frame Buffer Object…

var FBO = new GLOW.FBO();

There are tons of parameters that you can send to the GLOW.FBO but the default values are OK. Please check the source for the available options.

Then we setup another shader for our post effect and use the FBO as a texture…

var postEffectShader = {
  vertexShader = "...vertex shader code...",
  fragmentShader = "...fragment shader code...",
  data = {
    fboTexture: FBO // Here we assign the FBO
  },
  elements = [ ...UInt16Array containing element info... ]
}

var postEffect = new GLOW.Shader( postEffectShader );

The idea is to render the cube to the FBO and then the FBO onto the screen, using the post effect shader. So, finally, the render loop…

context.cache.clear();
FBO.bind();
context.clear();
cube.draw();
FBO.unbind();
postEffect.draw();

As always, we begin with clearing the cache. Then we bind the FBO, so this is the buffer we’re drawing and modifing now. We clear (the FBO) and then draw the cube. When that’s done, we unbind the FBO so the screen becomes the current buffer. Finally we draw the post effect shader. Voila.