Graphics Reference
In-Depth Information
Texture 6 1024 1024
RenderToTexture 6
Background 0. 0.1 0.
Clear
Vertex filter.vert
Fragment filter.frag
Program Filter1 \
uAd <.01 .2 .5> uBd <.01 .2 .5> \
uNoiseAmp <0. 0. 1.> uNoiseFreq <0. 1. 2.> \
uTol <0. 0. 1.>
Teapot
RenderToTexture
Background 0. 0.0 0
Clear
LookAt 0 0 2.5 0 0 0 0 1 0
Vertex image.vert
Fragment image.frag
Program Filter2 uInUnit 6 \
uEdgeDetect <true> \
uTEdge <0. 0. 1.> \
uTSharp <-3. 1. 10.>
Translate 0 0 0.
QuadXY .2 2.
For once, the interesting detail is in the .glib file. The vertex and frag-
ment files used here (two of each) are standard effects that you have already
seen. The steps in the .glib file are as follows:
1. The Texture2D glib command normally looks for a file name, but it can
also take an s and t resolution. In this case, it sets up an empty texture
of that size in graphics memory and assigns it to the given texture unit.
2. The RenderToTexture sets up the rendering output mechanism (just dis-
cussed) to that texture unit.
3. The teapot is rendered with a shader program that creates a procedural
noisy-ellipse texture.
4. The empty RenderToTexture returns rendering to go to the normal screen
framebuffer.
Search WWH ::




Custom Search