Getting ready

The g-buffer will contain three textures for storing the position, normal, and diffuse color. There are three uniform variables that correspond to these three textures: PositionTex, NormalTex, and ColorTex; these textures should be assigned to texture units 0, 1, and 2, respectively. Likewise, the vertex shader assumes that position information is provided in vertex attribute 0, the normal is provided in attribute 1, and the texture coordinate in attribute 2.

The fragment shader has several uniform variables related to light and material properties that must be set from the OpenGL program. Specifically, the structures Light and Material apply to the shading model used here.

You'll need a variable named deferredFBO (type GLuint) to store the handle to the FBO.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset