lkesteloot / alice

Website documenting a hardware project from the 1990s.
http://lkesteloot.github.io/alice/
Apache License 2.0
74 stars 9 forks source link

Reference rasterizer rectf*() GL API not functional in flight demo #68

Open sgi-demos opened 1 year ago

sgi-demos commented 1 year ago

Hello!

In debugging the flight demo for sgi-demos project, I found the runways and taxiways were not drawing due to a bug in rectf_() in gl.c:

void rectf_(Coord x1, Coord y1, Coord x2, Coord y2) {
    pmv_(x1, y1, 0);
    pdr_(x1, y2, 0);
    pdr_(x2, y2, 0);
    pdr_(x2, y1, 0);
    end_polygon();
}

And this fixed it for me:

void rectf_(Coord x1, Coord y1, Coord x2, Coord y2) {
    bgnpolygon();
    pdr_(x1, y1, 0);
    pdr_(x1, y2, 0);
    pdr_(x2, y2, 0);
    pdr_(x2, y1, 0);
    endpolygon();
}

Thanks for the inspiration and the GL rasterizer!

lkesteloot commented 1 year ago

Nice! Yeah the flight code is clearly half-way through some larger change, unfortunately! It's a snapshot we found on some FTP site. I'm a little surprised we've not found a better version.

bradgrantham commented 1 year ago

That's a great catch! Thanks, fixed and pushed.

I wonder if "pclos" also has a bug. "jello" calls "pclos" but I'm not sure when I can find time to test it.

sgi-demos commented 1 year ago

I'm a little surprised we've not found a better version.

I've got four versions of the source here, and I intend to port all of them. :^)

I wonder if "pclos" also has a bug.

Oh good point, that may help with another glitch I'm seeing in newave. Based on the GL reference, looks I could funnel pmv*() to bgnpolygon() + v3f() and pclos() to endpolygon().

Do you recall any gotchas with doing this? I realize it may have been a few years.

bradgrantham commented 1 year ago

I just mean it looks like pclos calls end_polygon and maybe should call endpolygon like you've changed in rectf_.

Sorry, I don't remember much about the gotchas. We didn't have a reference so we may have lost one or two small visual details that weren't obvious, and as Lawrence points out we never got the flight simulator working.

Great project, thanks for including us!