u,v Coord Question

Blitz3D Forums/Blitz3D Programming/u,v Coord Question

Interesting.

I am using Addvertex, and the last two are the u#, v#, indeed floating point.

Here's the code for drawing a rectangle:

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, 1/255.0, 0.0)
	v3 = AddVertex(mainSurface, x+width-1, y-height+1, 0, 1/255.0, 1/255.0)
	v4 = AddVertex(mainSurface, x, y-height+1, 0, 0.0, 1/255.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 adds a rectangle at x,y, of width*height size, with the rgba values as stated. The texture coordinates are taken from a 256*256 texture where in the top left there is a 2*2 white square (used for drawing this rectangle).

Also interestingly, this is an excerpt from the Blitz Command Reference, both online and the most recent docs downloaded.

The top left of an image has the uv coordinates 0,0.
The top right has coordinates 1,0
The bottom right is 1,1.
The bottom left 0,1

I'll get back to you on the CreateCube.