My VirtualGL lib again - showcase&cry for help

Blitz3D Forums/Blitz3D Programming/My VirtualGL lib again - showcase&cry for help

hi all,

i have changed the your function renderline.

[code]
Function vgliFillTriLine(p1x, p1d, p1u, p1v, p2x, p2d, p2u, p2v, y)

If p1x > p2x Then
tx = p1x : td = p1d : tu = p1u : tv = p1v
p1x = p2x : p1d = p2d : p1u = p2u : p1v = p2v
p2x = tx : p2d = td : p2u = tu : p2v = tv
EndIf

p1x = p1x+vglViewportX
p2x = p2x+vglViewportX
Local dif= (p2x - p1x)
Local fact=0
If p1x <vglViewportX Then
fact= -p1x
p1x = vglViewportX
EndIf
If p1x => p2x Then Return

Local id = (p2d - p1d) / dif
Local iu = (p2u - p1u) / dif
Local iv = (p2v - p1v) / dif

Local tw = (vglTex\w Shl vglShlUV)-1
Local th = (vglTex\h Shl vglShlUV)-1

Local d = p1d + (fact*id)
Local u = ((p1u + vglShlUV2) Mod tw) + (fact*iu)
Local v = ((p1v + vglShlUV2) Mod th) + (fact*iv)

tex.vglTexture = vglTex

If p2x >(vglViewportX+vglViewportW) Then p2x = (vglViewportX+vglViewportW )

y2 = y + vglViewportY
Local texw = tex\h
;texture 512 = shl 9
For x = p1x To p2x
;===>
If u > tw Then u = 0
If v > th Then v = 0
If u < 0 Then u = tw
If v < 0 Then v = th
;===>
If d < vglBuffer(x, y) Then
vglBuffer(x, y) = d
; WritePixelFast x, y2 , tex\texel[((v Shr vglShlUV) * shl 9 ) + (u Shr vglShlUV)]
WritePixelFast x, y2 , tex\texel[((v Shr vglShlUV) * texw ) + (u Shr vglShlUV)]
EndIf
d = d + id
u = u + iu
v = v + iv
Next
End Function


/[code]