Hi
I must admit I'm pretty confused when it comes to texturing - all those different flags and entity/texture blend modes. :/
Anyway, all I want to do is apply 2 texture layers to a mesh but keep the mesh semi-transparent so I can see stuff behind it. This all works nicely until I add the second texture layer, then mesh becomes completely opaque. Here's a simple demo:
Graphics3D 800,600,32
; Texture 1.
tex1 = CreateTexture(128,128)
SetBuffer TextureBuffer(tex1)
Color 255,0,0
For n = 0 To 127 Step 8
Line 0,n,127,n
Next
TextureCoords tex1,0
; Texture 2.
tex2 = CreateTexture(128,128)
SetBuffer TextureBuffer(tex2)
Color 0,0,255
For n = 0 To 127 Step 8
Line n,0,n,127
Next
TextureCoords tex2,1
SetBuffer BackBuffer()
cam = CreateCamera()
PositionEntity cam,0,0,-10
light = CreateLight()
ball = CreateSphere()
box = CreateCube()
EntityColor box,0,0,0
ScaleEntity box,2,2,2
EntityAlpha box,.5
TextureBlend tex1,3
TextureBlend tex2,3
EntityTexture box,tex1,0,0
Color 255,255,255
While Not KeyHit(1)
TurnEntity box,0,1,0
If KeyHit(57) Then EntityTexture box,tex2,0,1
RenderWorld
Text 10,10,"Press SPACE to add a second texture layer to the cube."
Flip(1)
Wend
End
Am I missing something or doing something wrong? First time I've messed with this kind of thing. :)
Cheers!
|