z buffer problem in mac os x

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

z buffer problem in mac os x

runiter
In my application I draw a wall which consists of an inner quad (plain white) and an outer quad (textured with bricks).

In my camera setup I set the near-far plates to 1-2000 which works great in windows, but in mac when I zoom out the renderer draws the inner quad in front of the outer quad.

If I change the near plate from 1 to 10, it helps but if I zoom farther it does it again.

Why is it that the z buffer seem to be so inaccurate in mac os x but very accurate in windows?
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

gouessej
Administrator
Hi

Which version of Mac OS X and which graphics card do you use?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

runiter
The test laptop is MacBook Pro:

Mac OS X 10.6.8
Graphics card: nvidia Geforce 9400M GT

Although I suspect it behaves this way in any Mac.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

gouessej
Administrator
No it's not possible. Maybe Sven can confirm. I have no Mac.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

Pixelapp
In reply to this post by runiter
If you send me a nice and neat test case for eclipse, I would test it on my mac mini.
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

runiter
Pixelapp, could you please test our executable in your mac?

it can be found free here:

http://energy.concord.org/energy3d/index.html

Both webstart and application versions are available in the above site.

After starting it, try drawing a wall so that the bricks face the camera. Then zoom out with mouse wheel, or the zoom toolbar bottom, until it stops. It shouldn't take long until you see that the white polygon behind the wall is rendered instead of the brick textured polygon in front.
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

Sven Gothel
Administrator
In reply to this post by runiter
On 12/10/2012 05:09 PM, runiter [via jogamp] wrote:

> In my application I draw a wall which consists of an inner quad (plain white)
> and an outer quad (textured with bricks).
>
> In my camera setup I set the near-far plates to 1-2000 which works great in
> windows, but in mac when I zoom out the renderer draws the inner quad in front
> of the outer quad.
>
> If I change the near plate from 1 to 10, it helps but if I zoom farther it
> does it again.
>
> Why is it that the z buffer seem to be so inaccurate in mac os x but very
> accurate in windows?
Please provide a unit test, so we can verify this issue.
(use one of our many unit tests as a template ..)

Thank you.

~Sven



signature.asc (909 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

greatdonking
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

runiter
Thank you all. It turned out that there is nothing wrong with z buffer in mac.
The problem was that polygonOffset was behaving differently in mac os x.

In my project when you draw a wall, some annotation lines are drawn on it. These lines flicker or hide under the wall polygon so I was forced to use PolygonOffset. Unfortunately in OpenGL PolygonOffset doesn't have any effect on lines (am I correct?) so I had to offset the wall mesh. But doing that caused Mac OS X to render the back mesh in front.

So now I went through every single mesh in my scene and offset all of them except the lines. Is this the way to go? or was there an easier way?
Saeid Nourian, Ph.D. Eng. | Graphing Calculator 3D
Reply | Threaded
Open this post in threaded view
|

Re: z buffer problem in mac os x

gouessej
Administrator
Polygon offset (sometimes called depth bias) doesn't work consistently across drivers, I used it in the alpha version of my game and I will have to consider other solutions because it is not satisfying.
Julien Gouesse | Personal blog | Website