VertexColor and TextureFlag 4

Archives Forums/Blitz3D Bug Reports/VertexColor and TextureFlag 4

Midnight(Posted 2006) [#1]
I've come across some very strange behaviour of VertexColor mixed with LoadTexture Flag=4.

Try the listing below(needs any texture1.jpg and texture2.jpg in your directory). The program will create a series of quads with different alpha (set via Vertexcolor) and a sphere on top.

Now switch the texture1.jpg flag to 4, and all quads with alpha <0.5 disappear! You can make them "re-appear" by either removing the vertexcolor command, or by making the texture2.jpg flag equal to 1.

So is this a bug or known feature? Not allowing two textures with texture flag 4 when using vertexcolor?

I'm a little stumped. I'm running 1.91, and I tried this on two different computers (one with an ATI, one with onboard video).

Graphics3D 800,600
SetBuffer BackBuffer()
Global camera
camera=CreateCamera()

AmbientLight 255,255,255


; change this from to ("texture1",4) and the plane disappears
; for all alpha values <.5
tex2=LoadTexture("texture1.jpg",1) 

s=CreateSphere()
TranslateEntity s,0,0,5
EntityTexture s,tex2


Mesh=CreateMesh()
surface=CreateSurface(Mesh)

EntityFX Mesh,35
tex=LoadTexture("texture2.jpg",4)
EntityTexture Mesh,tex


Repeat

	n=0
	ClearSurface surface
	For i=-3 To 2
		For j=-3 To 2
			
			; make little squares (no texture coordinates - makes no diff)
			AddVertex(surface,i,j,5)
			AddVertex(surface,i+1,j,5)
			AddVertex(surface,i,j+1,5)
			AddVertex(surface,i+1,j+1,5)
			
			
			
			AddTriangle(surface,n*4,n*4+2,n*4+1)
			AddTriangle(surface,n*4+1,n*4+2,n*4+3)
	
	
			; remove these three lines and the plane will show up even if 
			; the above texture is loaded with flag=4
			; So somehow the combination of using VertexColor and TextureFlag 4 doesn't work
			For k=0 To 3
				VertexColor surface,n*4+k,255,255,255,Float(n)*0.04
			Next
			
	
			n=n+1
			
	
		Next
	Next

	UpdateNormals Mesh


	UpdateWorld
	RenderWorld
	Flip
Until KeyDown(1)
End






jfk EO-11110(Posted 2006) [#2]
The forth parameter of VertexColor is VertexAlpha.
Some machines have Problems when mixing Mask mode and Alpha mode. Read the versions.txt, there's a note about the reimplmentation of the ability to mix them. Some cards may however make troubles, probably that's the problem.