Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!hsdndev!think.com!mintaka!electron!andru From: andru@electron.lcs.mit.edu (imagician) Newsgroups: comp.sys.sgi Subject: Re: Trouble drawing point-sampled polygons Message-ID: <1991Feb8.224137.9455@mintaka.lcs.mit.edu> Date: 8 Feb 91 22:41:37 GMT References: <1991Feb8.200816.20381@Neon.Stanford.EDU> Sender: daemon@mintaka.lcs.mit.edu (Lucifer Maleficius) Organization: complexly fractured Lines: 26 In article <1991Feb8.200816.20381@Neon.Stanford.EDU> loan@Neon.Stanford.EDU (James P. Loan) writes: > >I'm trying to draw several copies of the same polygon and I'm having >a hard time getting them to look EXACTLY alike. I realize that there >is round-off error when translating within a window, but the manual >presents a way to fix that. I thought the purpose of the +/-0.5 >adjustment in an ortho2() call was to "move" the coordinate system >so that integer vertices would fall exactly in the center of pixels. [...] >not points on the lines connecting the vertices. > viewport(0,(Screencoord)xs-1,0,(Screencoord)ys-1); > ortho2(-0.5,(Coord)xs+0.5,-0.5,(Coord)ys+0.5); >/* ortho2(0.0,(Coord)xs+1,0.0,(Coord)ys+1); */ Your ortho calls are wrong. The viewport is xs pixels wide, but you are mapping a coordinate system which is (xs+1) wide onto it. What you want is ortho2(-0.5, (Coord)xs-0.5, -0.5, (Coord)ys-0.5); Any apparent discrepancy is because viewport() takes pixel indices as arguments, whereas ortho() calls take coordinates as arguments. Andrew