Pro OpenGL ES for iOS

(singke) #1

188 CHAPTER 6: Will It Blend?^


Table 6-2. Possible Values for GL_TEXTURE_ENV_MODE

Texture Mode Function

GL_ADD Pn+Sn (component-wise addition of the RGBA values from the
two texture fragments, with S being source, P being the previous)

GL_BLEND Pn( 1 −Sn)+Sn×C (C is constant color set by
GL_TEXTURE_ENV_COLOR)

GL_COMBINE described below

GL_DECAL Pn×( 1 −San)+(Scn×San)


GL_MODULATE Pn×Sn


GL_REPLACE Output color =
Sn

Now compile and run. Your display should superficially resemble the results of
Figure 6-11.

Figure 6-11. Hedly is the ‘‘previous’’ texture on the left, while the Jackson Pollack-ish painting is the ‘‘source.’’
When using GL_MODULATE, the results are on the right.
Free download pdf