PDA

View Full Version : a problem in rendering



shafa_hn
07-14-2002, 12:24 PM
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

Bob
07-14-2002, 12:36 PM
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.

shafa_hn
07-14-2002, 01:10 PM
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)

Deiussum
07-15-2002, 04:14 AM
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?

shafa_hn
07-22-2002, 08:37 PM
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

E$h@
07-24-2002, 05:28 AM
As I remember, U must define far & near clipping plane, when U write such:
glViewPort(...) (sorry for my bad english, i'm Russian http://www.opengl.org/discussion_boards/ubb/smile.gif
Mail me for more (I'll find it, i think...)
RTFM http://www.opengl.org/discussion_boards/ubb/smile.gif

Deiussum
07-24-2002, 08:47 AM
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.

Yertle
07-24-2002, 09:30 AM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

Deiussum
07-24-2002, 10:34 AM
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.