Polygon doesn't fill up properly


i’m new to OpenGL…and i’m facing this problem.

on the Y-axis, instead of a surface, i get a bee-hive type of structure…
the object looks fine from the other axis though

my source code

please advise.

You don’t ask for a depth buffer when initializing the window.

so, instead of putting it in the init part, where should it be done? before each draw?

you are doing pretty cool stuff, for beeing new to openGL. What book do you use?

Add GL_DEPTH in glutInitDisplayMode. Just like you ask for an RGB color buffer, and just like you ask for a double buffer, you must ask for a depth buffer aswell.

Since you don’t ask for the depth buffer, you don’t get one. And if you don’t have a depth buffer, depth testing doesn’t work.

Managed to figure out the problem already. It was the way i plotted the points for the polygon mesh.

the old way i did, plotted the points from the inside to outer surface resulting in the beehive…