iOS window now handles ContextSettings with stencil bits correctly
This commit is contained in:
parent
9b0ce8888e
commit
2cab5789af
@ -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
|
||||
|
@ -132,13 +132,15 @@ void EaglContext::recreateRenderBuffers(SFView* glView)
|
||||
glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_colorbuffer);
|
||||
if (glView)
|
||||
[m_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)glView.layer];
|
||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorbuffer);
|
||||
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorbuffer);
|
||||
|
||||
// Create a depth buffer if requested
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user