Last active
August 29, 2015 14:19
-
-
Save xophiix/9f102de46f3d5ed3875d to your computer and use it in GitHub Desktop.
my own android gles bug fix and tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIUI3 not support GL_OES_packed_depth_stencil workaround | |
glGenRenderbuffers(1, &m_pDepthStencil); | |
glBindRenderbuffer(GL_RENDERBUFFER, m_pDepthStencil); | |
static bool supportedPackedDepthStencil = strstr((const char*)glGetString(GL_EXTENSIONS), "GL_OES_packed_depth_stencil") != NULL; | |
GLenum internalFormat = supportedPackedDepthStencil ? GL_DEPTH24_STENCIL8 : GL_DEPTH_COMPONENT16; | |
glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, nWidth, nHeight); | |
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_pDepthStencil); | |
if (supportedPackedDepthStencil) { | |
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_pDepthStencil); | |
checkGLError("create render target"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment