Game Development Reference
In-Depth Information
by the blend function, the simplest being GL_ONE , which equals 1.0. That means the
resulting pixel's color will be as follows:
(0.1 * 1 + 0.4 * 1, 0.2 * 1 + 0.5 * 1, 0.3 * 1 + 0.6 * 1) = (0.5, 0.7, 0.9)
The blendFunc property has a very profound effect on how particles are displayed.
By using a combination of the following blend modes for both source and target, you
can create rather bizarre effects or simply cause the effect to render as black squares.
There's lots of room for experimentation.
You'll find more information on the OpenGL blend modes and details about the blend
calculations in the OpenGL ES documentation at
documentation/opengles1_0/html/glBlendFunc.html .
Tip Because it's hard to imagine which blend functions will create which res-
ults with varying images, I'd like to point you to an article that describes the
most common blend operations with example images:
2009/02/11/glblendfunc/ .
Even more interesting is the Visual glBlendFunc tool developed by Anders
Riggelsen: . With any
HTML5-compatible browser, you can play with various images and blend
functions to see the results instantly.
Note that you can also modify the blendFunc property of other cocos2d
nodes, namely, all nodes that conform to the CCBlendProtocol such as the
Search Nedrilad ::

Custom Search