iOS window now handles ContextSettings with stencil bits correctly

This commit is contained in:
Sebastian Kohl 2014-12-09 20:36:38 +01:00 committed by Lukas Dürrenberger
parent 9b0ce8888e
commit 2cab5789af
2 changed files with 8 additions and 2 deletions

View File

@ -58,6 +58,8 @@
#define GLEXT_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
#define GLEXT_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
#define GLEXT_GL_RENDERBUFFER GL_RENDERBUFFER_OES
#define GLEXT_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#define GLEXT_GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_OES
#define GLEXT_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
#define GLEXT_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
#define GLEXT_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES

View File

@ -138,7 +138,9 @@ void EaglContext::recreateRenderBuffers(SFView* glView)
if (m_settings.depthBits > 0)
{
// Find the best internal format
GLenum format = m_settings.depthBits > 16 ? GL_DEPTH_COMPONENT24_OES : GL_DEPTH_COMPONENT16_OES;
GLenum format = m_settings.depthBits > 16
? (m_settings.stencilBits == 0 ? GL_DEPTH_COMPONENT24_OES : GL_DEPTH24_STENCIL8_OES)
: GL_DEPTH_COMPONENT16_OES;
// Get the size of the color-buffer (which fits the current size of the GL view)
GLint width, height;
@ -150,6 +152,8 @@ void EaglContext::recreateRenderBuffers(SFView* glView)
glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_depthbuffer);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, format, width, height);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, m_depthbuffer);
if (m_settings.stencilBits > 0)
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, m_depthbuffer);
}
// Make sure that everything's ok