Class KX_BlenderMaterial -- Blender Game Engine 2.49b



 
   








setBlending

setBlending( source, destination)

Textures are drawn by blending the incoming (source) RGBA color values with the RGBA color values already in the frame buffer (destination)

source:
GameLogic.BL_ZERO
GameLogic.BL_ONE
GameLogic.BL_SRC_COLOR
GameLogic.BL_ONE_MINUS_SRC_COLOR
GameLogic.BL_DST_COLOR
GameLogic.BL_ONE_MINUS_DST_COLOR
GameLogic.BL_SRC_ALPHA
GameLogic.BL_ONE_MINUS_SRC_ALPHA
GameLogic.BL_DST_ALPHA,
GameLogic.BL_ONE_MINUS_DST_ALPHA
GameLogic.BL_SRC_ALPHA_SATURATE

destination:
GameLogic.BL_ZERO
GameLogic.BL_ONE
GameLogic.BL_SRC_COLOR
GameLogic.BL_ONE_MINUS_SRC_COLOR
GameLogic.BL_DST_COLOR
GameLogic.BL_ONE_MINUS_DST_COLOR
GameLogic.BL_SRC_ALPHA
GameLogic.BL_ONE_MINUS_SRC_ALPHA
GameLogic.BL_DST_ALPHA,
GameLogic.BL_ONE_MINUS_DST_ALPHA
GameLogic.BL_SRC_ALPHA_SATURATE

Note:
The code below uses a texture's alpha channel.  The Alpha button on the Texture Face tab doesn't have to be enabled.

Sample Code

# get the currrent controller
controller = GameLogic.getCurrentController()

# get object that owns this controller
obj = controller.owner
 
# There's only one mesh
mesh = obj.meshes[0]

# And only one material
mat = mesh.materials[0]

# Using Blender GLSL Materials or Blender Multitexture Materials?
if hasattr(mat, "getMaterialIndex") == True:

# set blending of pixels to use texture's alpha channel
mat.setBlending(GameLogic.BL_SRC_ALPHA ,
GameLogic.BL_ONE_MINUS_SRC_ALPHA )

 
Game developers can use the game engine to create casual video games, first and third person shooters, role playing games, racing simulations and more. The game engine can be used to make both 2D games and 3D games.  Beginning game developers will only need basic knowledge of game design and programming to create rich and complex game models with photo realistic textures to add detail to the graphics of the video game.  Today's games need more than good looking low polygon game models.  Use normal maps and photo realistic textures to create high quality game models.