DrawLine problem
BlitzMax Forums/BlitzMax Programming/DrawLine problem
| ||
OK, I'm pulling my hair out here. I've got some VERY simple code that just doesn't seem to be doing what it should. Can someone please explain why the following doesn't produce a line with ends at the two dots? It instead produces a line which starts at one dot, connects with the second dot, but continues through on the other side (try it to see what I mean). |
| ||
I see no problem on my end, the line goes from dot to dot. You dont have a stray SetScale somewhere by chance? |
| ||
fx = 50 fy = 90 tx = 100 ty = 200 setcolor 255,0,0 DrawLine fx , fy , tx , ty, 1 setcolor 0,255,0 DrawOval tx , ty , 1 , 1 setcolor 0,0,255 DrawOval fx , fy , 1 , 1 Flip WaitKey() the 50,90 point doesn't connect to the line completely. |
| ||
Cus you're telling it not to draw the last pixel? |
| ||
grable - I don't think I have a stray SetScale anywhere, but I'll double check tonight, because I do use it elsewhere in the code. Can't do any harm to reset the scale to one before I plot anything, that's for sure. Regular K - yeah I've got the DontDrawLastPixel set, but the problem I'm having is the line is over twice as long as it should be (which does make is sound like a scaling issue). Thanks for the input chaps! I'd like to caveat that I'm not a total programming idiot - I've got my simple game pretty much up and running: All my animations and collision detection are working fine. So I was a bit taken aback when I couldn't PLOT A LINE! ;) |
| ||
... concerned about your "not a total programming idiot ". What happens with your code in this simple test. If it works then your problem is somewhere else and you'll need to provide more code. If it fails then it's a gfx card or Bmax level issue. I do remember something like this being reported before but it was month ago. Does it fail with GL graphics driver as well as DX? Graphics 800,600 fx = 50 fy = 90 tx = 100 ty = 200 DrawLine fx , fy , tx , ty, 1 DrawOval tx , ty , 3 , 3 DrawOval fx , fy , 3 , 3 Flip WaitKey() What version of Bmax are you using? |
| ||
tonyg: Not to worry, it turns out that I am just far more of an idiot than I gave myself credit for! If I SetScale just before the drawing routines, it's fine. (And I thought I'd been really careful about resetting any graphics changes I made elsewhere in the code. I must have missed something when I recently ported it all over to a MaxGUI canvas.) Nothing to see here people, move along. :whistlesnonchalantly: |