OpenGL step pit record

OpenGL pit record
The 3D model is loaded with OpenGL RBO texture cache

3D model loading
When working with 3D models, we often create an FBO first, and the FBO is associated with Texture and RBO. The first time we rendered it, we rendered it directly to the FBO associated texture, then went through the other texture filters and displayed it again.
There are a couple of caveats here.
Rendering must be associated with an RBO. Turn Depth Test on before rendering off-screen and always turn it off after rendering off-screen. Do another render operation, otherwise render black screen texture will appear.

OpenGL RBO
Sometimes when OpenGL uses the depth buffer, the rendering effect disappears completely, and that’s probably because the depth buffer has been turned off.
The name of the
GLDepthMask – Enables or disables write depth buffers
C specification
void glDepthMask( GLboolean flag);
parameter
flag
Specifies whether the enabled depth buffer can be written. If flag is GL_FALSE, the depth buffer write is disabled. Otherwise, it can be enabled. The initial state is to enable deep buffer writes.
describe
GLDepthMask specifies whether the enabled depth buffer can be written. If flag is GL_FALSE, the depth buffer write is disabled. Otherwise, it can be enabled. The initial state is to enable deep buffer writes.
Related Gets
GL_DEPTH_WRITEMASK glGet parameters
See also
GLColorMask, GLDepthFunc, GLDepThrangef, GLStencilMask
copyright
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glDepthMask.xml
https://blog.csdn.net/flycatdeng
Texture cache
To create a texture cache, you must specify the size of memory for the texture.

public static int createTextureObject(int textureTarget, int width, int height) {
        int[] textures = new int[1];
        GLES20.glGenTextures(1, textures, 0);
        GlUtil.checkGlError("glGenTextures");

        int texId = textures[0];
        GLES20.glBindTexture(textureTarget, texId);
        GlUtil.checkGlError("glBindTexture " + texId);

        GLES20.glTexParameterf(textureTarget, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(textureTarget, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameteri(textureTarget, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameteri(textureTarget, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
        GlUtil.checkGlError("glTexParameter");
        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
        return texId;
    }


Read More: