n00b question: getting rid of lines along edges of polygons
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]](http://www.cs.camosun.bc.ca/~c0262447/non-website-content/glcube.gif)
Why are those lines showing up?
Here's my code to set up the environment:
And here's the code for drawing the cube:
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
Andrew
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]](http://www.cs.camosun.bc.ca/~c0262447/non-website-content/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

Andrew
Polygon smoothing relies on blending, and blending is incompatible with the depth buffer.
Read my earlier explanation. Also see this and this.
Read my earlier explanation. Also see this and this.
Thanks arekkusu!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| SLOW performance drawing multiple polygons per frame with stencil buffer | clam61 | 7 | 575 |
Apr 27, 2013 11:53 AM Last Post: clam61 |
|
| Create Aquaria-like terrain- texturing edges | AndyKorth | 3 | 5,353 |
Jul 31, 2011 08:13 PM Last Post: FlamingHairball |
|
| [SOLVED]OpenGL edges of textures | mk12 | 2 | 3,625 |
Sep 2, 2010 08:07 PM Last Post: mk12 |
|
| Replacing edges with degenerate quads (for shadow volumes) | Coyote | 9 | 6,404 |
Jan 15, 2010 07:08 PM Last Post: Coyote |
|
| antialiasing polygons | honkFactory | 37 | 14,263 |
Apr 3, 2006 09:19 AM Last Post: akb825 |
|

