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,231
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 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SLOW performance drawing multiple polygons per frame with stencil buffer clam61 7 798 Apr 27, 2013 11:53 AM
Last Post: clam61
  Create Aquaria-like terrain- texturing edges AndyKorth 3 5,417 Jul 31, 2011 08:13 PM
Last Post: FlamingHairball
  [SOLVED]OpenGL edges of textures mk12 2 3,679 Sep 2, 2010 08:07 PM
Last Post: mk12
  Replacing edges with degenerate quads (for shadow volumes) Coyote 9 6,462 Jan 15, 2010 07:08 PM
Last Post: Coyote
  antialiasing polygons honkFactory 37 14,368 Apr 3, 2006 09:19 AM
Last Post: akb825