PDA

View Full Version : Weird Antialiasing



arrison
08-27-2000, 11:06 AM
I'm having a terrible time trying to figure out antialiasing. And just when I think I have it, I get this http://www.graphcalc.com/opengl/ . It seems the gl_lines aren't antialiasing to the thing behind them, but rather to the clear_color background. Here's what I'm using for initialization:
glDrawBuffer(GL_BACK);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);

Any ideas what's going on?

MikeC
08-27-2000, 11:27 AM
It's a Z-buffering problem. OpenGL antialiases by making pixels partially transparent along the edges and blending with the current background. Unfortunately, unless you've enabled alpha test, these partially transparent pixels update the depth buffer like any other pixels, so subsequent drawing behind them has no effect on the framebuffer.

This is a standard issue with transparent blending; on current mainstream hardware there's no solution except to depth-sort your geometry. Which is messy; you might want to reconsider whether antialiasing is all that important to you. (It's a fair performance hit, and FSAA can reduce the jaggies on cards that can manage it.)