tags:

views:

825

answers:

4

When objects from a CallList intersect the near plane I get a flicker..., what can I do?

Im using OpenGL and SDL.

Yes it is double buffered.

+1  A: 

Try to put the near clipping plane a little bit further : for example with gluPerspective -> third parameter zNear http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/perspective.html

TiTi
A: 

Ah, you meant the near plane. :)

Well...another thing when drawing polygons in the same plane is to use glPolygonOffset

From the description

  glPolygonOffset is useful for rendering hidden-line images,
  for applying decals to surfaces, and for rendering solids
  with highlighted edges.
epatel
+3  A: 

It sounds like you're getting z-fighting.

"Z-fighting is a phenomenon in 3D rendering that occurs when two or more primitives have similar values in the z-buffer, and is particularly prevalent with coplanar polygons. The effect causes pseudo-random pixels to be rendered with the color of one polygon or another in a non-deterministic manner, varying as the scene is animated, causing one polygon to "win" the z test, then another, and so on." (From wikipedia)

You can get more information about the problem in the OpenGL FAQ.

glPolygonOffset might help, but you can also get yourself into trouble with it. Tom Forsyth has a good explanation in his FAQ Note: It talks about ZBIAS, but that's just the DirectX equivilent.

Nerfboy
+1  A: 

The problem was that my rotation function had some floating point errors which screwed up my model_view matrix.

None of you could of guest it, sorry for the wast of your time.

Although I don't think that moving the near plane should be even considered a solution to any kind of problem usually something else is wrong, because openGL does support polygon intersection with the near plane.

Haim Bender