MyCylinder modification

Blitz3D Forums/Blitz3D Programming/MyCylinder modification

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.

As big10p says you will get a discontinuity as the uvalue wraps from 1 to 0. There are ways to disguise this though, depending on your texture you could just mirror part of the texture and run the uvalues from 0 to 0.5 and then back to 0. Or you could run the uvalues from 0 to 1 and then back to 0 so you have the texture wrapped round the cylinder twice.

As to joining up the verts so there is no seam around the body of the cylinder, I think it goes something like this..

Change the ring segment loops to
For i=0 To (verticalsegments-2)

And change the tri fill to
; Fill in ring segment sides with triangles
For v=1 To (verticalsegments)
If v=verticalsegments Then
tl=tRing(0)
tr=tRing(v-1)
bl=bRing(0)
br=bRing(v-1)
Else
tl=tRing(v)
tr=tRing(v-1)
bl=bRing(v)
br=bRing(v-1)
EndIf

AddTriangle(thissurf,tl,tr,br)
AddTriangle(thissurf,bl,tl,br)
Next

to get the texture wrapped twice try..
udiv#=Float(2.0/(verticalsegments))
And
If i<verticalsegments/2 thisUPos#=thisUPos#-udiv# Else thisUpos=thisUpos+udiv
instead of
thisUPos#=thisUPos#-udiv#
in the loops for the ring segments.
You may have to tweak some of this though, I have not really tested it properly, but I expect you get the idea.