PDA

View Full Version : Polygon doesn't fill up properly



CJ
03-26-2005, 12:33 PM
Hey

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..
eg. http://www.ntu.edu.sg/home2003/tayc0003/angle.jpg
the object looks fine from the other axis though

my source code (http://http://www.ntu.edu.sg/home2003/tayc0003/sample.c)

please advise.

Bob
03-26-2005, 01:07 PM
You don't ask for a depth buffer when initializing the window.

CJ
03-26-2005, 09:30 PM
so, instead of putting it in the init part, where should it be done? before each draw?

03-26-2005, 11:59 PM
you are doing pretty cool stuff, for beeing new to openGL. What book do you use?

Bob
03-27-2005, 05:18 AM
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.

CJ
03-27-2005, 06:07 AM
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..