Graphics Reference
In-Depth Information
11
Image Manipulation
with Shaders
The OpenGL computer graphics API is primarily intended for rendering 3D
synthetic scenes from geometric primitives, but some capabilities for manipu-
lating images were built into the system from the beginning. With the addition
of shader capabilities, OpenGL can now use texture access and manipulation
operations to carry out a number of new image functions. In this chapter, we
describe some of these functions. Our main tools will be the ability to get texels
directly from a texture and the ability to do arithmetic on texel values.
The general form of the GLIB file is as below, including a uniform slider
variable T , used in case you use a parameterized operation such as image
blending, and variables for the resolution of the image file. Each texture needs
to be assigned to a texture unit. Here we have set up the GLIB file for two
textures, because some of the later examples in this chapter operate on two
239
 
 
Search WWH ::




Custom Search