Multi-texturing help

Blitz3D Forums/Blitz3D Programming/Multi-texturing help

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!

Here it works (radeon 9200se). Some cards don't like to mix alpha with multiply/add blending modes. Also, in Version 1.86 it was deactivated, so get 1.87.

Thanks, jfk.

Duh, I could have sworn I was using the latest version - just checked and I was using 1.86. Updated to 1.87 and it works now. :)

I guess I shouldn't really be using this method, though, if it doesn't work on some peoples cards?

That's a pity coz you can do some really nice special effects with it.

afaik it's an insignificant number of cards. but maybe you better offer an option to use it without that mix.