View Full Version : Visual Glitches
06-20-2004, 02:47 AM
I have a sample openGL program that diplsays an object of several thousand triangles. On some machines it is OK, but on other visual glithes appear on the surface of the object when it is moved - colors on some triangles change form what it should be to black, other triangles have random black lines that appear and dissapear, other triangles have strange glittering. How to write openGL code that works fine on any computer? I define my surface properties using glColor, glMaterial anf GL_LIGHT0.
06-20-2004, 09:04 AM
It is hard to say what your problem is wothout seeing a screen shot, but my guess is you're seeing z fighting. Push your near plane out (increase the near value in your call to gluPerspective if there is one, if you set up your frustum using glFrusutm, you should know what I'm talking about).
06-20-2004, 10:20 PM
you are right. Thank you :)
I've tried different values in glPerspective, the problem is with Z buffer. But why is it working in different ways on different computers? The fulcrum that is OK on my computer is catastrophe for another and vice versa. How to make it universal for all computers??
06-21-2004, 05:01 AM
How soon you get z-fighting depends on the number of bits available for the depth buffer pixels. Generally you ask for a certain number of bits
(e.g 16 or 24 bits are common) when creating your OpenGL window. Exactly how this is done depends on which windowing toolkit you use.
What settings for near and far to use to get sufficient precision really depends on the scene displayed, but as a rule of thumb i use a factor of 1000 difference between near and far, if near is at 0.1 far is 100 and so on. This tends to work well with 16-bit detph buffers which are fairly common. If you need more precision, make sure you ask for it.
In general pushing the near plane out gives you more precision than pulling the far plane in .
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.