depth buffer on nexus s seems to get cleared automatically for each frame

This topic contains 3 replies, has 2 voices, and was last updated by  Joe Davis 4 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31114

    yottokoga
    Member

    Seems that with the driver for Nexus S the depth buffer is cleared automatically (i.e. does not require glClear(GL_DEPTH_BUFFER_BIT)). As a simple test I took the BasicGLSurfaceView sample from the android sdk, removed the depth bit from the call to glClear and enabled depth test.

    public void onDrawFrame(GL10 glUnused) {
    // Ignore the passed-in GL10 interface, and use the GLES20
    // class’s static methods instead.
    GLES20.glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
    GLES20.glUseProgram(mProgram);
    checkGlError(“glUseProgram”);

    GLES20.glEnable(GLES20.GL_DEPTH_TEST);

    On other android devices I get the expected behavior (the triangle eventually disappear as it rotates in place). With the Nexus S the triangle is happily visible the whole time. Seems like the depth buffer is cleared (or the depth values are not copied) from one frame to the next. Is this a driver bug?

    We need the depth buffer information to be maintained across multiple frames but that doesn’t seem possible with Nexus S.

    thanks for any help,

    yotto

    #36546

    Joe Davis
    Member

    Hi yotto,

    Some driver configurations disable depth buffer preservation between frames. This prevents excess bandwidth being used by applications that don’t need to preserve the data.

    You should be able to workaround the issue by using a depth texture instead of a depth buffer, as this will force the GPU to preserve the data.

    Regards,
    Joe

    #36547

    yottokoga
    Member

    Thanks for the tip Joe! Seems to work.

    #36548

    Joe Davis
    Member

    No problem 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.