#### Archived

This topic is now archived and is closed to further replies.

# GL_POLYGON_SMOOTH

This topic is 6115 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

After many days of struggling with this, I''m trying to find a demo w/ source that uses GL_POLYGON_SMOOTH. Nehe got one? I want to draw a simple object (box, sphere, etc.) that is blended with the background. Nothing is working, red book, etc.. no help. I''ve read and seen nearly everything except the right solution. Here''s my setup. I just need poly smoothing, but I try to enable every damn smoothing function I can think of as a last desperate resort to get something working. But nada.
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glEnable( GL_CULL_FACE ); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glEnable( GL_LIGHTING ); glDisable( GL_TEXTURE_2D ); glShadeModel( GL_SMOOTH ); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); //glBlendFunc( GL_SRC_ALPHA_SATURATE, GL_ONE ); glEnable( GL_DITHER ); glEnable( GL_POINT_SMOOTH ); glEnable( GL_LINE_SMOOTH ); glEnable( GL_POLYGON_SMOOTH ); glHint( GL_POINT_SMOOTH_HINT, GL_NICEST ); glHint( GL_LINE_SMOOTH_HINT, GL_NICEST ); glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST ); glDepthMask(GL_FALSE); for(INT i=0; i < num_polygons; i++) { glBegin(GL_POLYGON); // Render object here glEnd(); } // Done glDisable( GL_BLEND ); glDisable( GL_DITHER ); glDisable( GL_POINT_SMOOTH ); glDisable( GL_LINE_SMOOTH ); glDisable( GL_POLYGON_SMOOTH ); glHint( GL_POINT_SMOOTH_HINT, GL_FASTEST ); glHint( GL_LINE_SMOOTH_HINT, GL_FASTEST ); glHint( GL_POLYGON_SMOOTH_HINT, GL_FASTEST ); glDepthMask(GL_TRUE); 

##### Share on other sites
I think that you missunderstand something about GL_POLYGON_SMOOTH. It is interpolating between the vertices on the same polygon not between different polygons. From the glShadeModel man page:
GL primitives can have either flat or smooth shading. Smooth shading, the default, causes the computed colors of ver­
tices to be interpolated as the primitive is rasterized, typically assigning different colors to each resulting pixel
fragment. Flat shading selects the computed color of just one vertex and assigns it to all the pixel fragments gener­
ated by rasterizing a single primitive. In either case, the computed color of a vertex is the result of lighting if
lighting is enabled, or it is the current color at the time the vertex was specified if lighting is disabled.

Compare with some of the first NeHe tutorials. You want to blend different polygons and if I remember right is that covered in lesson 8.

##### Share on other sites
Hi,

On My site, you''l find a example who use AA.

========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/

##### Share on other sites
Leyder Dylan:

Do you have an example that uses AA polygons?
Your example only uses AA lines.

Obelix:

So, you're saying that GL_POLYGON_SMOOTH is not used for
full-screen AA?

Then how do I get full-screen AA in OpenGL?

All I really want is the object's edges to blend into the
background. Without AA, I'm getting a crappy pixelated

Edited by - jtech on December 26, 2001 12:47:48 PM

##### Share on other sites
My previous post was about glShadeModel but for some reason did I wrote GL_POLYGON_SMOOTH instead of GL_SMOOTH. I guess I was reading too fast. The glShadeModel call in your code example is not needed anyway.

Your color buffer must store alpha values for polygon antialiasing so make sure that you have GLUT_ALPHA if you are using GLUT. I suspect that the color depth can also affect the result. I tried the aapoly.c example from the old red book and I had to add
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
to see any changes.

This is not full-screen AA (FSAA). In the red book do they talk about FSAA and the accumulation buffer but the accumulation buffer do not have hardware support on consumer cards. With the recent multisample extension can you do it if you have a fast card:
http://developer.nvidia.com/view.asp?IO=ogl_multisample

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
14
5. 5

• 14
• 9
• 23
• 9
• 32
• ### Forum Statistics

• Total Topics
632626
• Total Posts
3007509
• ### Who's Online (See full list)

There are no registered users currently online

×