How to use depth texture with stencil, OpenGL ES 3.0
问题 I have an application where I want to render depth to a texture using stencil mask. I try GL_DEPTH_STENCIL_OES: Creating texture: glGenFramebuffers(1, fbo); glBindFramebuffer(GL_FRAMEBUFFER, *fbo); glGenTextures(1, depthTexture); glBindTexture(GL_TEXTURE_2D, *depthTexture); // using combined format: depth + stencil glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, w, h, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR