home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dove!poly2.nist.gov!fred
- From: fred@poly2.nist.gov (Frederick R. Phelan Jr.)
- Newsgroups: comp.sys.sgi
- Subject: Re: Hidden line removal...
- Message-ID: <7017@dove.nist.gov>
- Date: 19 Nov 92 21:49:57 GMT
- References: <BxnnxK.CCK@cs.dal.ca>
- Sender: news@dove.nist.gov
- Lines: 93
-
- In article <BxnnxK.CCK@cs.dal.ca>, lingley@ug.cs.dal.ca (William Lingley) writes:
- |> Is there an efficient way to draw a wire frame, but
- |> remove lines that would be hidden behind the solid portions
- |> of the structure in front of the others? I know I can use the z-buffer
- |> and shade with the background color, but this still requires all
- |> panels to be drawn anyway. Preferably it should be a faster draw than
- |> drawing the panels. There was supposed to be an article on this in a magazine
- |> at one point in time. A pointer to this would be nice as well.
- |>
- |> adv-thanx-ance
- |>
- |> William (lingley@scylla.drea.dnd.ca or lingley@ug.cs.dal.ca)
-
- I've never heard of a way to do this without drawing the panels ...
- Please post if you find something.
-
- Here's two different codes that I have managed to snitch from various resources
- including the net that do this. Just change the fill color to the background color
- for wireframe.
-
- void draw_hollow_tri_1()
- {
- /* draws tri with verts p1, p2 and p3 with
- yellow outline, red fill. */
-
- /* Draw red fill. */
- c3f(red_col);
- lsetdepth(0xffff,0x7ffffe);
- bgnpolygon();
- v3f(p1); v3f(p2); v3f(p3);
- endpolygon();
-
- /* Draw yellow outline. */
- c3f(yel_col);
- lsetdepth(0x1,0x7fffff);
- bgnclosedline();
- v3f(p1); v3f(p2); v3f(p3);
- endclosedline();
-
- }
-
-
-
- void draw_hollow_tri_2()
- {
- /* draws tri with verts p1, p2 and p3 with
- yellow outline, red fill. */
- /*
-
- From "The Hidden Charms of Z-Buffer",
- Kurt Akeley, IRIS Universe magazine,
- issue 11.
-
- */
-
- zwritemask(0x0);
- c3f(red_col);
- bgnpolygon();
- v3f(p1); v3f(p2); v3f(p3);
- endpolygon();
-
- c3f(yel_col);
- bgnclosedline();
- v3f(p1); v3f(p2); v3f(p3);
- endclosedline();
-
- zwritemask(0xffffff);
- wmpack(0x0);
-
- bgnpolygon();
- v3f(p1); v3f(p2); v3f(p3);
- endpolygon();
-
- wmpack(0xffffffff);
-
- }
-
-
-
- The second method has the disadvantage of three polygon draws
- to get one hollow polygon. On the other hand, it is slightly
- sharper.
-
-
- Fred
- ---
- Fred Phelan
- fred@poly2.nist.gov
- /*___________________________________________________
- ____ __ ___ __ ___ ___ ___
- /__ /_/ /__ / / /__/ /__/ /__ / /__/ /\ /
- / / ( /__ /_/ / / / /___ /___ / / / \/
- ___________________________________________________*/
-