disappearing polygons

I’m working on a MacBook Pro 10.5.7 and polygons will just randomly disappear on certain frames. I reproduced the problem on a mesh. I had to take a video in order to get some stills of the problem.
http://img188.imageshack.us/img188/8691/imageiz.jpg

This problem only occurs if I enable lighting. I thought maybe it was a problem with my normals but even if I just set them all to a single dummy value the problem persists.

Need a bit more info really…

Is it one single polygon?
It looks to me like you have some degenerate geometry of some sort.
But then again with some MacBook Pro’s there are dodgy GPUs…

If you can describe in more detail what you are doing, or post the code, it would be more helpful. :wink:

It’s just a bunch of triangles drawn using glDrawElements and GL_TRIANGLES all using shared vertices so there’s no degenerate geometry.
http://img30.imageshack.us/img30/74/mesh3.jpg

It works fine on Windows I just get the strange behavior on Mac.

Hmm… Still looks like degenerate geometry to me. Are you sure you are not overwriting your vertex data in some way, or getting the length of an array incorrect?
Different platforms may react in different ways to a bug in your code too.

If it is simply a simple mesh then I have never seen any bug in OpenGL on OS X that would produce that kind of blatant error. And it looks very much like the last vertex in that triangle is actually something like (0,0,0), hence the trailing triangle.

Does it happen at different locations in the grid or always the same place?

Are you using shaders? VBOs?

If the triangle mesh you have just shown is from the same data that produced the solid picture from earlier and it only does that when it’s filled and you’re truly confident that there is nothing wrong with your code then I would start looking to see if the GPU has overheating problems. Although generally a failing GPU tends to mess up filling, rather than geometry.

Sorry that was a bad screenshot. It’s just taking a portion of geometry in the center. I just wanted to show how I’m drawing the triangles and that they are shared vertices.

No shaders or VBOs. No overwriting arrays. It only happens when I enable lighting and the locations are always different.

From what I can tell it seems like it just randomly sets a vertex to (0,0,0) so it gets the trailing polygon looks you described.

Best thing to do is post some code. I can’t really comment further on it until then.
My gut tells me it’s a bug in your code to be honest. Especially if “enabling lighting” is the only cause and effect you can see. I just don’t see how lighting calculations would break your geometry…

If it 100% only happens when you enable lighting have a look at what that changes in your codes execution path, or which memory / structures you write to when you setup the values for lighting (for example).

If you can produce a simple reliable project that reproduces it then submit it to Apple as a bug report… if you like. Or send me the project and I’ll take a look. :slight_smile:

Thanks for all your help. Do you know where I could find a couple basic OpenGL cocoa examples? I think it might be something wrong with my NSOpenGLView subclass because the code works fine on other platforms.

Most likely on the Apple Developer website. They have just about everything there in terms of “Hello World” Apps for most things.

If you are not a member already, it’s free to join.

Ok, thanks. I’ll see if I can produce a small project with this bug.

I also found today that if I disable glEnable(GL_COLOR_MATERIAL) it works fine with lighting and the problem disappears.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.