FB Bug

General FreeBASIC programming questions.
toml_12953
Posts: 27
Joined: Jul 07, 2005 12:37
Location: Malone, NY
Contact:

FB Bug

Postby toml_12953 » Jun 05, 2007 12:42

In QB, the following program draws a white line from the upper left of the viewport then draws a white triangle that's overwritten by a red one. In FB, there's no connecting line and the triangles are not coincident.

screen 8
view (.1*640,.1*200)-(.9*640,.9*200),,15
window(-2,-4)-(5,4)
draw"m0,0;m2,0;m1,2;m0,0"
color 4
line(0,0)-(2,0)
line(2,0)-(1,2)
line(1,2)-(0,0)
sleep ' Remove for QB
end
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Jun 05, 2007 13:08

Sheesh, that is some arcane syntax... :P Anyways, I can't say exactly what the problem is. Hell, I don't even know what half that code is supposed to be doing...
counting_pine
Site Admin
Posts: 6228
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Jun 05, 2007 14:21

I guess this is probably an issue of how Draw is affected by View and Window.
Since you seem to know what you're doing with it, can you provide a simpler example?
(PS. if you could put code within [code]...[/code] blocks, that would be great, thanks.)
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Postby 1000101 » Jun 05, 2007 14:36

This is the result I get from fb:

Image

In qb (vbdos, actually) there is no white triangle but there is a line from the upper left corner of the box to the bottom of the red triangle. I'd take a screen shot of the vbdos version, by XP is gay.
Mico
Posts: 165
Joined: Oct 14, 2005 6:09
Location: Italy

Postby Mico » Jun 05, 2007 15:01

It seems that VIEW is causing this problem. If you omit VIEW, then everything works as expected. If you use (0,0) as the first corner of the viewport, again everything works as expected. If you use a non-(0,0) first corner for VIEW, then DRAW just ignores VIEW and does not shift its coordinate system according to the selected viewport. DRAW fails both with absolute (unsigned) and with relative (signed) coordinates, while LINE always works as expected. Maybe I'm wrong, but this smells like a bug in DRAW...
toml_12953
Posts: 27
Joined: Jul 07, 2005 12:37
Location: Malone, NY
Contact:

Delete VIEW

Postby toml_12953 » Jun 05, 2007 15:22

If the VIEW is removed, it still doesn't work as expected. The DRAW statement should draw a line from the origin to the starting point before drawing the triangle. True, without VIEW the triangle is now in the correct position but the initial line is missing. FB seems to keep the pen off until the first DRAW coordinates are processed. QB leaves the pen on unless ordered not to do so.
Mico
Posts: 165
Joined: Oct 14, 2005 6:09
Location: Italy

Postby Mico » Jun 05, 2007 16:59

This probably depends on differences in the way DRAW works in FB and in QB/VBD (but I didn't test the latter). Maybe I'm wrong, but I assume that in DRAW M0,0 means "draw a line from the current position to 0,0". So, in case the current position is already 0,0, no line is drawn. If you turn 0,0 into 1,1 you'll see a line from 0,0 to 1,1. So, I assume that FB as the graphic cursor at 0,0 at startup...

The bottom line is that:
    1) the first corner in VIEW, if different from 0,0, is not properly handled by FB when using VIEW and DRAW
    2) in FB the position of the graphic cursor at startup is 0,0
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Postby anonymous1337 » Jun 05, 2007 17:41

It's only an FB bug if FB's draw is supposed to work exactly like QB's :P
Mico
Posts: 165
Joined: Oct 14, 2005 6:09
Location: Italy

Postby Mico » Jun 05, 2007 19:58

As for the graphic cursor position at startup, you're right: not being exactly compliant with the QB way of functioning is not a bug, it's a ...feature (kidding aside, I don't think we need 100% compatibility with QB). However, the real bug is in the combination of VIEW and DRAW, as DRAW fails to rescale its output into the viewport specified by VIEW unless the first corner of the viewport is (0,0).
counting_pine
Site Admin
Posts: 6228
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Jun 06, 2007 1:45

I guess the sensible thing to do is to write some test cases that highlight all the differences between QB and FB.
Then we can work out exactly what the differences are, and decide whether they should be fixed, or just documented.
cha0s
Site Admin
Posts: 5317
Joined: May 27, 2005 6:42
Location: Illinois
Contact:

Postby cha0s » Jun 06, 2007 3:40

counting_pine is right, that's where the community part comes in. Some of you have a lot of experience with using this very old QB commands. You guys are the ones who could provide us with the best data/summaries of the problem.

Return to “General”

Who is online

Users browsing this forum: No registered users and 8 guests