u,v Coord Question

Blitz3D Forums/Blitz3D Programming/u,v Coord Question

Hmm. I've gone with the following code:

Function rectangle(x#, y#, width#, height#, red, green, blue, alpha#)
	v1 = AddVertex(mainSurface, x, y, 0, 0.0, 0.0)
	v2 = AddVertex(mainSurface, x+width-1, y, 0, 2/256.0, 0.0)
	v3 = AddVertex(mainSurface, x+width-1, y-height+1, 0, 2/256.0, 1/256.0)
	v4 = AddVertex(mainSurface, x, y-height+1, 0, 0.0, 2/256.0)
	
	t1 = AddTriangle(mainSurface, v1, v2, v3)
	t2 = AddTriangle(mainSurface, v1, v3, v4)
	
	VertexColor mainSurface, v1, red, green, blue, alpha
	VertexColor mainSurface, v2, red, green, blue, alpha
	VertexColor mainSurface, v3, red, green, blue, alpha
	VertexColor mainSurface, v4, red, green, blue, alpha
End Function


This should give me the 2x2 square... but it doesn't. It gives me a slightly larger area. I think what MSW is saying is significant, except it seems to be defaulting to the centre of the pixel. I used texture flags 16 and 32 to disable uv wrapping, which stopped it from accessing the top right of the texture. It still, however leaks into the pixel 3,0 and so forth. I need the large texture for a single surface system so I can't use one small texture for this.

Of course using a 3x3 pixel area solves this little problem for now. I wouldn't mind a more general solution but I can live with this as it is.