a problem in rendering

hi all,
Im a beginner in openGL. I wrote a flight simulator with OpenGL. but I have a great problem with my objects in far distance. when my plane go away from my objects then OpenGL can’t recogonize their depth and my objects begin to flickering. What’s the reason and how can solve this problem.

thanks for ur attention
shafa

You should push the near clip plane as far out as you can possibly accept. The precision of the depth buffer is linked to the values of the near and far clip planes.

thanks, but I know it. my problem is different. my clip plane is far. Problem is happend when two objects is near to each other. (for example when the aeroplane go up and away from then earth, take off bands and earth cant be recogonized and in one frame band rendered and in the next eath is rendered or any pert of both)

So how is your problem different? It sounds to me like z-fighting. Bob’s suggestion of moving the near plane out as far as possible will reduce the precision needed for the depth buffer and reduce z-fighting.

Also, how many bits is the depth buffer you’re using?

thank you very much for your response.
I find it know and test it. But I dont know how can I find my precision bits. please tell me how can I know it.

thanks a lot

As I remember, U must define far & near clipping plane, when U write such:
glViewPort(…) (sorry for my bad english, i’m Russian
Mail me for more (I’ll find it, i think…)
RTFM

If you use glut, I don’t think you can set the depth buffer precision. At least, I’m not sure how you would do so offhand. There may be a way.

If you are using Windows and initializing the window with the SetPixelFormat stuff, you specify the precision of the depth buffer using one of the fields of the PIXELFORMATDESCRIPTOR struct.

As far as I know, depth buffer precision is gotten from a ratio of near clip distance to far clip distance. I am just a VERY new beginner, but I’m learning fast.

I’m talking about 16 vs. 24 vs. 32 bit depth buffers. Higher number of bits provides for more precision simply because there is a greater range of numbers that can be stored.

These can be set by using a pixel format with the appropriate value in the cDepthBits field of the PIXELFORMATDESCRIPTOR struct.