Hello Guest

Anti-alias insanity

  • 8 Replies
  • 22833 Views
Anti-alias insanity
« on: January 13, 2005, 21:41:38 »
Is it me or is polygon-based anti-aliasing completely fubar'd?

Code: [Select]
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.)

*

Offline Chman

  • ***
  • 100
    • http://www.shakebox.org
Anti-alias insanity
« Reply #1 on: January 14, 2005, 00:28:24 »
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

*

Offline princec

  • *****
  • 1933
    • Puppygames
Anti-alias insanity
« Reply #2 on: January 14, 2005, 09:49:32 »
What he said.

Cas :)

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Anti-alias insanity
« Reply #3 on: January 14, 2005, 11:04:24 »

Anti-alias insanity
« Reply #4 on: January 14, 2005, 13:39:33 »
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!

Anti-alias insanity
« Reply #5 on: January 18, 2005, 21:52:03 »
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

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Anti-alias insanity
« Reply #6 on: January 19, 2005, 10:02:36 »
When creating a new PixelFormat, you need to pass a non-zero value to the samples argument.

Anti-alias insanity
« Reply #7 on: January 19, 2005, 17:50:54 »
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

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
Anti-alias insanity
« Reply #8 on: January 19, 2005, 19:20:11 »
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