Anti-alias insanity

Started by rgrzywinski, January 13, 2005, 21:41:38

Previous topic - Next topic

rgrzywinski

Is it me or is polygon-based anti-aliasing completely fubar'd?

GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, 
                 GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_FASTEST);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_FASTEST);
GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
...
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
    GL11.glVertex2i(x1, y1);
    GL11.glVertex2i(x1, y2);
    GL11.glVertex2i(x2, y1);
    GL11.glVertex2i(x2, y2);
GL11.glEnd();


You end up with a filled rectangle with a "crack" along the diagonal since it seems that OGL doesn't know that it shouldn't anti-alias internal edges.

Anyone have any insight on this?  Are people even AA'ing these days?

And how does one create compound primitives (objects made from multiple GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP, etc components) that have anti-aliased edges?  What about in GDI+?

(I should mention that responding with "use multisample" does me little to understand what's going on.)

Chman

Quote(I should mention that responding with "use multisample" does me little to understand what's going on.)
Hum, that was what I'd respond :D

Opengl built-in antialiasing is crap. Slow, and horrible. Don't use it. Use multisample.

Chman

princec


spasi


rgrzywinski

spasi, what's interesting about that link is that had I not seen and worked with GL_POLYGON_SMOOTH, I would have never known what they were talking about.  There's precious little information about GL_POLYGON_SMOOTH and its impact on blending.

I know I should use multisample and I know GL_POLYGON_SMOOTH sucks, but I don't discount something immediately because I don't understand it and because it appears that it doesn't do what I would like it to do.  If I followed the immediate discount methodology then I'd be coding in C right now rather than Java  :D

Thanks for the postings!

elias4444

I've got a question:

What's the best way to enable multisampling? I can't find sample code or a tutorial anywhere on it.
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

spasi

When creating a new PixelFormat, you need to pass a non-zero value to the samples argument.

elias4444

Not to sound too negative on this, but according to the Javadoc, PixelFormat can cause a crash if samples != 0.

I've been using the concepts from the sample code in the wiki for setting up the appropriate screen depth and such. Does anyone have some good code for using PixelFormat to setup multisampling that won't cause a crash on someone's machine?
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

elias

The reason it states that is that despite our best efforts, at least win32 requires a different code path to select multisample pixel formats. Some drivers are buggy and crashes on this path, but we can't detect this. The only way to stay on the "safest" code path is the avoid multisample altogether.

- elias