Bind Class Reference
[Advanced]

Binds a fragment shader output variable to location in a framebuffer. More...

#include <Bind.hpp>

Inheritance diagram for Bind:
Node

List of all members.

Public Member Functions

 Bind (const Tag &tag)
virtual GLint getIndex () const
virtual string toString () const

Protected Member Functions

virtual void associate ()
virtual void finalize ()

Private Attributes

string name
string to
GLint index
Attachmentattachment
Outputsoutputs
Programprogram

Detailed Description

Binds a fragment shader output variable to location in a framebuffer.

Although the built-in gl_FragData array can be used to render to framebuffer attachments directly by their index, it has been deprecated in GLSL 1.3 and will eventually be removed. User-defined out variables in the fragment shader take their place.

A Bind node sets the value of one of these variables in a Program above it to the index of a named framebuffer attachment in the current outputs list. The variable is set during the associate stage before the program is linked and is not touched again.

XML Name

XML attributes

name Name of the output variable in the fragment shader.
to Name of the attachment to link to.

XML example

   <texture name="layer0">
   <texture name="layer1">
     <framebuffer>
       <target link="layer0" />
       <target link="layer1" />
       <program>
         <shader file="layers.vert" />
         <shader file="layers.frag" />
         <outputs>
           <bind name="Layer0" to="layer0" />
           <bind name="Layer1" to="layer1" />
         </outputs>
         <uniform type="mat4" name="MVPMatrix" as="modelviewprojection" />
         <cube />
       </program>
     </framebuffer>
   </texture>
   </texture>
 
See also:
Framebuffer
Attachment
Target
Outputs

Constructor & Destructor Documentation

Bind ( const Tag tag  ) 

Initializes the name and to attributes.


Member Function Documentation

void associate (  )  [protected, virtual]

Adds attachment to outputs and sets its index in outputs to program value.

Exceptions:
NodeException if Attachment with name could not be found.
NodeException if could not find Outputs list.
NodeException if maximum number of outputs exceeded.
NodeException if could not find Program.

Reimplemented from Node.

void finalize (  )  [protected, virtual]

Checks that the variable's value was set successfully.

Exceptions:
NodeException if the value in the program does not match.

Reimplemented from Node.

GLint getIndex (  )  const [inline, virtual]
Returns:
Index of the target in the outputs list.
string toString (  )  const [virtual]
Returns:
String comprised of the object's attributes.

Reimplemented from Node.


The documentation for this class was generated from the following files:
Generated on Wed Jun 9 01:36:35 2010 for Gander by  doxygen 1.6.3