Drawing Anti-Aliased Shapes With Open GL

Member
Posts: 24
Joined: 2009.03
Post: #1
Hi,

Is it possible to get the basic shapes I draw with GL to be anti-aliased?

cheers
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
If by basic shapes you mean triangles? Then sort of.

You can render into FBO that is 2x larger than the screen and scale it down with linear filtering. That gets you 4x supersampling, but it's going to kill your framerate very likely, and 4x supersampling isn't fantastic.

If you are just drawing sprites and such, turning on linear filtering when creating your textures will do very high quality AA.

Lastly, you can do something like this: http://homepage.mac.com/arekkusu/bugs/invariance/
That is a line and point drawing library that uses small textured polygons to get high quality AA.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #3
muleskinner Wrote:Hi,

Is it possible to get the basic shapes I draw with GL to be anti-aliased?

cheers

Another way would be to surround your shapes with very small border geometry and render it using alpha blend with alpha values ranging from 1 on the inside vertices to 0 on the outside vertices.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
warmi Wrote:Another way would be to surround your shapes with very small border geometry and render it using alpha blend with alpha values ranging from 1 on the inside vertices to 0 on the outside vertices.

That's basically the same thing the texture based AA, but with the downside that it can't use mipmapping or anything like that to give you a good average for a pixel. I think just blending the color like that will simply point sample the color value, leaving you with a very low quality AA with lots of moire.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #5
Skorche Wrote:That's basically the same thing the texture based AA, but with the downside that it can't use mipmapping or anything like that to give you a good average for a pixel. I think just blending the color like that will simply point sample the color value, leaving you with a very low quality AA with lots of moire.

It was simpler to implement and worked just fine for me , given what I was doing ( relatively static shapes .) - just another option.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Chipmunk physics accessing shapes in multiple methods issue JinnoRb 0 1,981 Mar 24, 2010 11:53 AM
Last Post: JinnoRb
  Drawing menu versus drawing game johncmurphy 4 4,152 Jan 6, 2010 09:14 AM
Last Post: AnotherJake
  Drawing shapes opengl es jjslay 2 3,958 Aug 14, 2009 11:07 AM
Last Post: jjslay
  Anti-aliased lines in OpenGL ES OdieGiblet 2 5,970 Sep 2, 2008 07:08 PM
Last Post: arekkusu