n00b question: getting rid of lines along edges of polygons

Member
Posts: 208
Joined: 2005.04
Post: #1
So I decided to try my hand at OpenGL this morning...

I'm trying to display a cube and make it look as nice as possible (antialiasing == good). Unfortunately, I can't seem to get rid of some annoying artifacts. Here's a screenshot:

[Image: glcube.gif]

Why are those lines showing up?

Here's my code to set up the environment:

Code:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);

glEnable(GL_COLOR_MATERIAL);  
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);


And here's the code for drawing the cube:

Code:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

gluLookAt(1,1,1,
          0,0,0,
          0,1,0);
    
glRotatef(20, 0, 1, 0);
glutSolidCube(0.5);
glFinish();

I'm doing this in Cocoa. In IB, I've set my NSOpenGLView subclass' attributes as follows:

Renderer: Best
Color/Alpha Buffer: Default
Depth Buffer: 16bit
Stencil Buffer: None
Accum. Buffer: None

My graphics card is an ATI Mobility Radeon 9200 (on an iBook G4).


Thanks Smile

Andrew
Quote this message in a reply
Sage
Posts: 1,234
Joined: 2002.10
Post: #2
Polygon smoothing relies on blending, and blending is incompatible with the depth buffer.

Read my earlier explanation. Also see this and this.
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #3
Thanks arekkusu! Grin
Quote this message in a reply
Post Reply