Graphics Reference
In-Depth Information
images. Of course there will be changes if we work on a single image (using
only one file, sample.bmp ), if we use a different image (replacing the name of
the image file), or if we include additional uniform variables to support other
computations.
##OpenGL GLIB
Ortho -1. 1. -1. 1.
Texture 5 sample1.bmp
Texture 6 sample2.bmp
Vertex sample.vert
Fragment sample.frag
Program Sample uT <0. 0. 5.> \
uImageUnit 5 uImage2Unit 6
QuadXY .2 5.
This GLIB file puts the two texture images on
texture units 5 and 6. You can arbitrarily pick which
texture units to use, up to the total number sup-
ported by your graphics card.
The vertex shader is short and uses our familiar
conventions for variable names:
If you are using glman ,
do not use texture units 2
and 3, because glman uses
those to hold its built-in
2D and 3D noise textures.
out vec2 vST;
void main( )
{
vST = aTexCoord0.st;
gl_Position = uModelViewProjectionMatrix * aVertex;
}
Throughout this chapter we will be looking at different image manipula-
tion functions that we can build into fragment shaders.
Basic Concepts
GLSL deals with images by treating them as textures and using texture access
and manipulation to set the color of each pixel in the color buffer. This color
bufer may then be displayed, leting you see the efect of your manipulation,
Search WWH ::




Custom Search