PDA

View Full Version : Antialiasing



Mreal
10-04-2002, 01:33 AM
I've problems antialiasing polygons.Please post a code here to help me!I do just like it's said in "The Red Book" but nothing happens.

V-man
10-05-2002, 04:13 PM
I think a few things need to be enabled and blending mode needs to be set.

IIRC,

glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_BLEND);
glEnable(GL_ONE, GL_ALPHA_SATURATE);

V-man

*Aaron*
10-06-2002, 06:46 AM
It could be that your hardware does not properly support polygon antialiasing.

glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_BLEND);
glEnable(GL_ONE, GL_ALPHA_SATURATE);
This is not correct. The last line should be
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
Keep in mind that antialiased polygons are transparent around the edges, so they must be drawn from back to front to be drawn correctly.
Edit: Fixed a typo.

[This message has been edited by *Aaron* (edited 10-06-2002).]

Mreal
10-06-2002, 07:38 AM
What do you mean from back to front?I use auxSolidCube(1.0).
The Red Book says
glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE)
also i look at another place and there also is told GL_SRC_ALPHA_SATURATE & GL_ONE to be passed to glBlendFunc(), but it doesn't work.

Bob
10-06-2002, 08:44 AM
For glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE) to work, you need to have a destination alpha channel. You may not get one automatically, so you may have to ask for it. You must also set the alpha value of the clear color to zero. If works for me at least.

Back to front order means every single triangle must be sorted in back to front order, so that no single part of any triangle will be overwritten when drawn. auxSolidCube does not (I assume) care about this, so it will fail to work properly.