DrawLine Problems
BlitzMax Forums/BlitzMax Beginners Area/DrawLine Problems
| ||
The ovals are drawn in the correct position but the line always extends past were it should end Method render(scale:Float) SetBlend SOLIDBLEND SetColor 0,255,0 DrawOval Self.x1*scale,Self.y1*scale,5,5 SetColor 0,0,255 DrawOval Self.x2*scale,Self.y2*scale,5,5 SetColor 255,0,255 DrawLine Self.x1*scale, Self.y1*scale, Self.x2*scale, Self.y2*scale End Method |
| ||
Are you sure the ovals are in the right place? The origin of an oval is the upper left corner, not the centre. This looks better to me: DrawOval (Self.x1*scale)-3,(Self.y1*scale)-3,6,6 SetColor 0,0,255 DrawOval (Self.x2*scale)-3,(Self.y2*scale)-3,6,6 |
| ||
I cannot believe this, apparantly it has something to do with angle from x1,y1 to x2,y2 as demostrated by the code below SetLineWidth 5 SetColor 255,0,0 '****** draws correctly DrawLine 100*scale, 100*scale, 400*scale, 400*scale DrawLine 100*scale, 100*scale, 400*scale, 100*scale SetColor 255,0,255 'flip drawing points '******** extends line !!!!!!!!!!!!!!!!!!! DrawLine 400*scale, 400*scale, 100*scale, 100*scale DrawLine 400*scale, 100*scale, 100*scale, 100*scale Correction the line always extends past the second point drawn. Last edited 2012 |
| ||
Is this an issue you are experiencing with wide lines? You should have said. I'm pretty sure wide lines are not very well supported even by driver manufacturers and can't be guaranteed across different implementations so this is not a bmax issue, but a video card and driver one. If you want pixel perfect wide lines you'll probably have to look into using rotated rects. Unless anyone else knows otherwise. |
| ||
It could be graphics card releated but eliminating Setlinewidth or changing it to 1 dosn't change the result. |
| ||
It works perfectly here, using your code in post #3. Make sure to use SetScale 1,1 before using DrawLine, because it does screw the coords up. |
| ||
Thanks!! SetScale 1,1 was what was missing. |