Binds a fragment shader output variable to location in a framebuffer. More...
#include <Bind.hpp>
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 |
| Attachment * | attachment |
| Outputs * | outputs |
| Program * | program |
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>
| void associate | ( | ) | [protected, virtual] |
Adds attachment to outputs and sets its index in outputs to program value.
| 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.
| NodeException | if the value in the program does not match. |
Reimplemented from Node.
| GLint getIndex | ( | ) | const [inline, virtual] |
| string toString | ( | ) | const [virtual] |
Reimplemented from Node.
1.6.3