Bug 2140 - OpenGL Depth Buffer is always off
Summary: OpenGL Depth Buffer is always off
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 2.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Andreia Gaita
Depends on:
Reported: 2011-11-21 17:40 UTC by Jonathan Pobst
Modified: 2012-03-22 20:02 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jonathan Pobst 2011-11-21 17:40:52 UTC
From https://bugzilla.novell.com/show_bug.cgi?id=662079.


Tested in Preview 7, 8, 9, and 10. They all have the problem that the
CreateFramebuffer method does not use a GraphicsMode with DepthBuffer on, but
even if we write our own CreateFramebuffer and use a own GraphicsMode, it is
totally ignored in the AndroidGraphicsContext constructor.

There it only sets new int[] { 0x3038 }; (ES1.1) or new int[] { 0x3040, num,
0x3038 }; (ES 2.0), which both do not have the Depth Buffer flag set (0x3038 is
just the end flag and 0x3040 is the ES20 flag).

Without this no depth buffer works on devices that will return a context
without depth buffer (all of our devices we have tested). This is also easy to
test with any OpenGL Sample (GLCube, TexturedCube) from MonoDroid if you just
disable culling (for a cube with culling you don't need depth buffer, so you
will never notice it is missing, but with culling off you can clearly see the
missing depth buffer):

            //GL.Enable (All.CullFace);
            //GL.CullFace (All.Back);

Reproducible: Always

Steps to Reproduce:
1. Try to use Depth Buffer
2. Does not work, not even overwriting CreateFramebuffer helps
3. because the problem is in the AndroidGraphicsContext method
Actual Results:  
All depth buffer testing fails on devices that return a non-depth buffer

Expected Results:  
Depth Buffer should work, without it 3D OpenGL rendering is kinda useless.

We are trying to fix this on our own for now by providing our own
CreateFrameBuffer, GraphicsMode and AndroidGraphicContext classes and correctly
implementing all the flags. If you are interested in our solution, I can post
it once we have it working.
Comment 1 Andreia Gaita 2012-03-22 20:02:55 UTC
Fixed in MfA 4.0.6