Problems with antialiasing
I'm having some problems with antialiasing in my application...
I've added the code:
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
But my polygons are still serrated, and I can't achieve this effect!
Can you help me?
Thanks, and sorry for my English!
IIRC you also need to enable blending (glEnable(GL_BLEND)) and set the blending function (glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)).
This is no real Antialiasing filter. You might want to look up for GL_ARB_multisample, which allows you to enable a real multisampling filter for your application.
@OrangyTang: What has this to do with Blending??
@OrangyTang: What has this to do with Blending??
Ok Enrico!
But my application loads some complex objects from files...
Don't it will be very slowly to apply a multisample algorithm to a huge quantity of polygons?
But my application loads some complex objects from files...
Don't it will be very slowly to apply a multisample algorithm to a huge quantity of polygons?
The polygon based antialiasing will smooth the edges using alpha blending (so it'll almost certainly need to be switched on), but you'll need to sort your polys from back to front for it to work correctly.
MSAA will work for most general cases, but may not be available on all GPUs especially if you use a floating-point based format. But multisampling should have a more consistant GPU hit.
MSAA will work for most general cases, but may not be available on all GPUs especially if you use a floating-point based format. But multisampling should have a more consistant GPU hit.
Quote:Original post by FiPoO
Ok Enrico!
But my application loads some complex objects from files...
Don't it will be very slowly to apply a multisample algorithm to a huge quantity of polygons?
I don't know how slow it will become, but you get nothing for free. Either smooth polygon borders with a speed decrease or jaggy borders at full speed...
Quote:Original post by FiPoO
Ok Enrico!
But my application loads some complex objects from files...
Don't it will be very slowly to apply a multisample algorithm to a huge quantity of polygons?
Yes, it has the potential to slow your application down quite a bit. All of the sampling is done in hardware though, which is very fast. As ever in real-time graphics, it's a trade-off between image quality and rendering speed.
There are several different levels of anti-aliasing, usually ranging from 2 samples to 16. Depending on the complexity of your scene and the spec of your graphics card, I guess you should be able to use 2x-4x sampling without a massive frame-rate hit. Could be wrong, though.
Quote:Original post by Enrico
@OrangyTang: What has this to do with Blending??
Line and polygon smoothing adds extra pixels with decreasing alpha values around lines and polygons. If blending isn't enabled, the alpha values aren't used, and the extra pixels appear solid.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement