; TextureBlend Example ; -------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,45,45,0 cube=CreateCube() PositionEntity cube,0,0,5 ; Two texture layers: the logo on layer 0, chrome on layer 1. ; Layer 1 blends down onto layer 0 using its TextureBlend mode. tex0=LoadTexture("media/b3dlogo.jpg") tex1=LoadTexture("media/Chorme-2.BMP") EntityTexture cube,tex0,0,0 EntityTexture cube,tex1,0,1 blend=2 While Not KeyDown(1) ; Keys 1-6 select blend modes 0-5 for the top layer If KeyHit(2) Then blend=0 If KeyHit(3) Then blend=1 If KeyHit(4) Then blend=2 If KeyHit(5) Then blend=3 If KeyHit(6) Then blend=4 If KeyHit(7) Then blend=5 blend_name$="do not blend" If blend=1 Then blend_name="no blend / alpha" If blend=2 Then blend_name="multiply (default)" If blend=3 Then blend_name="add" If blend=4 Then blend_name="dot3" If blend=5 Then blend_name="multiply 2" ; Set the blend mode used by texture layer 1 TextureBlend tex1,blend TurnEntity cube,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Keys 1-6: blend mode for the chrome layer Arrows: camera Esc: exit" Text 0,20,"TextureBlend tex1,"+blend+" ("+blend_name+")" Flip Wend End