Drawing Lines Correctly - with SetLineWidth?
BlitzMax Forums/BlitzMax Beginners Area/Drawing Lines Correctly - with SetLineWidth?
| ||
What I draw a thick line in BMAX I get some half-hearted result at the ends of the lines.![]() This is caused by this code: I change the code and I get semi-decent results, problem is that it don't work all the time. Here is the new code: And now some lines are correct and some are worse! ![]() The two lines (on last pic) were drawn with : SetLineWidth(24) DrawLine 400,50,240,200 ' GOOD LINE DrawLine 10,180,400,050 ' WORSE LINE Can someone please help, it's been a long day. |
| ||
No worries, I figured it out. |
| ||
Well what was the answer? Now I'm curious! |
| ||
Dang it man! Share with us! The suspense is killing me!! |
| ||
Something like this :Method DrawTexturedLine( frame:TDX7ImageFrame,x0#,y0#,x1#,y1#,tx#,ty# ) If islost Return Local lx0#,ly0#,lx1#,ly1# lx0=x0*ix+y0*iy+tx ly0=x0*jx+y0*jy+ty lx1=x1*ix+y1*iy+tx ly1=x1*jx+y1*jy+ty Local lw#=linewidth*0.5 Local xd# = lx0 - lx1 Local yd# = ly0 - ly1 Local Mag:Double = Sqr(xd*xd + yd*yd) xd = xd / mag * lw yd = yd / mag * lw Local verts#[]=New Float[20] If Abs(ly1-ly0)>Abs(lx1-lx0) verts[0]=lx0-yd verts[1]=ly0+xd verts[2]=0 verts[3]=0 verts[4]=0 verts[5]=lx0+yd verts[6]=ly0-xd verts[7]=0 verts[8]=0 verts[9]=1 verts[10]=lx1-yd verts[11]=ly1+xd verts[12]=0 verts[13]=1 verts[14]=0 verts[15]=lx1+yd verts[16]=ly1-xd verts[17]=0 verts[18]=1 verts[19]=1 Else verts[0]=lx0+yd verts[1]=ly0-xd verts[2]=0 verts[3]=0 verts[4]=0 verts[5]=lx0-yd verts[6]=ly0+xd verts[7]=0 verts[8]=0 verts[9]=1 verts[10]=lx1+yd verts[11]=ly1-xd verts[12]=0 verts[13]=1 verts[14]=0 verts[15]=lx1-yd verts[16]=ly1+xd verts[17]=0 verts[18]=1 verts[19]=1 EndIf SetActiveFrame frame device.DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_XYZ|D3DFVF_TEX1,verts,4,0) End Method |