To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 7433
7432  |  7434
Subject: 
Antialiasing lines and printed polygons
Newsgroups: 
lugnet.cad.dev
Date: 
Tue, 9 Jul 2002 15:40:28 GMT
Viewed: 
604 times
  
In lugnet.cad.dev, Don Heyse writes:
In lugnet.cad, Travis Cobbs writes:
I think I'll add antialiased lines to my list of future features.  I already
draw the lines last, so that's not a problem.

You should definitely do it!  I think it's less than 10 lines of code to
antialias them and they look much, much better.  The hard part for me in
ldglite was breaking it into multiple passes.  The antialiasing was easy.
Just try this before you draw the lines.

   glEnable( GL_LINE_SMOOTH );
   glHint( GL_LINE_SMOOTH_HINT, GL_NICEST ); // GL_FASTEST GL_DONT_CARE
   glEnable( GL_BLEND );
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

On my ancient hardware I don't notice any speed difference.  And from
what I read about lines in openGL, they're already slow on a lot of
the hardware accelerators, so this may not slow it down there either.

The only other thing I do to make it look good is draw the line endpoints
with glPointSize() when glLineWidth is set wider than a pixel.  I do this
before the drawing the lines, and don't bother with GL_POINT_SMOOTH.
This way the lines blend into the endpoints and you don't get those ugly
rectangular line ends.

Another nifty thing to do is to draw the printed polygons (type 3 and 4
lines in ldraw that don't use color 16) a second time in GL_LINE mode and
antialias them along with the type 2 and type 5 edge lines.  This gives
you a nice cheap fullscreen antialiased look for the printed parts.
Check out the difference.  Before:

  http://ldglite.sourceforge.net/torso.png

After:

  http://ldglite.sourceforge.net/torsoa.png

Don



Message is in Reply To:
  Re: *** LDView Version 1.9.5 Released ***
 
(...) Classses? Objects? Destructors? Instances? Don't worry, I won't be borrowing much of that. So far ldglite is just plain C code and I'm not planning on spoiling it with any of that nasty OOP stuff at this point. ;^) I was just thinking about (...) (22 years ago, 30-May-02, to lugnet.cad.dev)

25 Messages in This Thread:








Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR