What's with the texturing here?

Blitz3D Forums/Blitz3D Beginners Area/What's with the texturing here?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

OK, here's an example implementing those U,V:s. The pixel loop is about checking whether custom alpha works on a texure without the alpha flag. (Without the alpha flag I can use 2d commands on it, according to Paul Gerfen, but I don't want to to it unless the alpha byte is still in effect which 'may or may not' be the case). What's wrong now? It doesn't even become a square now...

Graphics3D 640,480


	tex = LoadTexture("c:\windows\stucco.bmp",2)
	
	buf = TextureBuffer(tex)
	
	wid = TextureWidth(tex)
	hig = TextureHeight(tex)
	
	SetBuffer buf: LockBuffer()
	
For x = 0 To wid - 1
	For y = 0 To hig - 1
		pixel = ReadPixelFast(x,y)
	  WritePixelFast X,Y, x Shl 24 Or (pixel And $00ffffff)
	Next
Next

	UnlockBuffer()

	
	cam = CreateCamera()
	
	mesh = CreateMesh()
	surf = CreateSurface(mesh)
		
	v1 = AddVertex(surf, 0,0, 0,1)
	v2 = AddVertex(surf, 1,0, 1,1)
	v3 = AddVertex(surf, 0,-1, 1,0)
	v4 = AddVertex(surf, 1,-1, 0,0)
	
	AddTriangle surf, v1,v2,v3
	AddTriangle surf, v1,v3,v4
	
	EntityTexture mesh, tex
	
	
	
While Not KeyHit(1)


	If KeyDown(200) Then 
		MoveEntity mesh, 0,0,+0.1
	ElseIf KeyDown(208) Then
		MoveEntity mesh, 0,0,-0.1
	ElseIf KeyDown(30) Then
		MoveEntity cam, 0,+0.1,0
	ElseIf KeyDown(44)
		MoveEntity cam, 0,-0.1,0
	End If
	
	UpdateWorld()
	RenderWorld()
	
	Flip
Wend



I know it's only me that keeps windows xp's "Santa Fe Stucco" image as "C:\windows\stucco.bmp" so it's always at hand. I don't remember its original exact path. But it's just a beige 256x256 bitmap...