Weird VertexTexCoords behaviour?

Blitz3D Forums/Blitz3D Programming/Weird VertexTexCoords behaviour?

The problem is that all triangles will have tex applied to uv coords 0 and tex2 applied to uv coords 1.

This is why the light texture has a square edge around it which looks like the wood texture, you can't tell Blitz that the 2 small triangles should only have tex2 applied to them unless you use 2 different surfaces.

The alternative is to just use 2 triangles and position the light texture using a combination of scaleing and uv offsetting remembering to load the texture with clampU and clampV flags.


Graphics3D 640,480,16,2

Camera = CreateCamera()

PositionEntity Camera,0,1,-5

AmbientLight 255,255,255

tex=LoadTexture("woodfloor1.jpg") 
tex2=LoadTexture("light.jpg",16+32) 

TextureCoords tex2,1

LevelMesh=CreateMesh()


Surface1=CreateSurface(LevelMesh)

AddVertex (Surface1,-1,1,0,0,0)
AddVertex (Surface1,1,1,0,1,0)
AddVertex (Surface1,-1,-1,0,0,1)
AddVertex (Surface1,1,-1,0,1,1)


VertexTexCoords Surface1,0,0,0,0,1 
VertexTexCoords Surface1,1,1,0,0,1 
VertexTexCoords Surface1,2,0,1,0,1 
VertexTexCoords Surface1,3,1,1,0,1
 


AddTriangle (Surface1,0,1,2) 
AddTriangle (Surface1,1,3,2) 




TextureBlend tex2,2 ;or 3 
 
EntityTexture LevelMesh,tex,0,0

EntityTexture LevelMesh,tex2,0,1

UpdateNormals LevelMesh

u#=0.0
v#=0.0

Repeat

If KeyDown(205) Then u#=u#+0.01
If KeyDown(203) Then u#=u#-0.01
If KeyDown(208) Then v#=v#+0.01
If KeyDown(200) Then v#=v#-0.01

PositionTexture tex2,u#,v#

	UpdateWorld()

	RenderWorld()


	Flip


Until KeyDown(1)