Zigzag Boundary

Hello Friend,
In my application one cube rotate continuously but it’s appear with ZigZag boundray? How I can eliminate this.

With Regards
Rajiv Kumar.

Sounds like bad depthbuffer setup. How do you set your near and far clippingplanes (the two last values you pass to glFrustum/gluPerspective or whatever function you use to setup the projection matrix)?

void COpenGLWindow::OnSize(UINT nType, int cx, int cy )
{

if ( cy == 0 )					// Prevent A Divide By Zero By
{
	cy = 1;						// Making Height Equal One
}

glViewport( 0, 0, cx, cy );		// Reset The Current Viewport

glMatrixMode(GL_PROJECTION);	// Select The Projection Matrix
glLoadIdentity();				// Reset The Projection Matrix

// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(float)cx/(float)cy,0.1f,100.0f);

glMatrixMode(GL_MODELVIEW);		// Select The Modelview Matrix
glLoadIdentity();				

}

Shouldn’t be that much problems with that setup, but who knows. In your gluPerspective-call, change 0.1f to 1.0f and see what happens. If it dissapears, we found the source. If not, I think you must describe the problem more in detail. A screenshot whould be great.

Leave it tell me how I can remove the aliasing on the all 12-edge of that Cube.

Rajiv Kumar

Antialiasing can be done in two ways. Enable fullscene antialiasing, done with GL_ARB_multisample or a driver specific option in some controlpanel. Or you can enable polygon smoothing. If you go for polygon smoothing, all polygons drawn will have smoothed edges.
You enable polygon smooth something like this:

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glEnable(GL_BLEND)
glEnable(GL_POLYGON_SMOOTH)

Note that blending is used, and you must draw your triangles in proper order. Back to front is the order you need.

Replace GL_POLYGON_SMOOTH with GL_LINE_SMOOTH to smooth lines.