Commit ebc2a426 authored by Maciej Suminski's avatar Maciej Suminski

Modified way of handling OpenGL framebuffer errors.

Now it is more verbose and the status is checked at the right moment (previously it was fine with Linux, but on Windows it showed errors).
parent 8d7054a5
......@@ -73,14 +73,6 @@ void OPENGL_COMPOSITOR::Initialize()
glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, m_depthBuffer );
// Check the status, exit if the framebuffer can't be created
GLenum status = glCheckFramebufferStatus( GL_FRAMEBUFFER );
if( status != GL_FRAMEBUFFER_COMPLETE )
{
wxLogFatalError( wxT( "Cannot create the framebuffer." ) );
}
// Unbind the framebuffer, so by default all the rendering goes directly to the display
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
m_currentFbo = 0;
......@@ -125,6 +117,57 @@ unsigned int OPENGL_COMPOSITOR::GetBuffer()
glBindFramebuffer( GL_FRAMEBUFFER, m_framebuffer );
m_currentFbo = m_framebuffer;
glFramebufferTexture2D( GL_FRAMEBUFFER, attachmentPoint, GL_TEXTURE_2D, textureTarget, 0 );
// Check the status, exit if the framebuffer can't be created
GLenum status = glCheckFramebufferStatus( GL_FRAMEBUFFER );
if( status != GL_FRAMEBUFFER_COMPLETE )
{
switch( status )
{
case GL_FRAMEBUFFER_UNDEFINED:
wxLogFatalError( wxT( "Target is the default framebuffer, "
"but the default framebuffer does not exist." ) );
break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
wxLogFatalError( wxT( "Cannot create the framebuffer." ) );
break;
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
wxLogFatalError( wxT( "The framebuffer attachment points are incomplete." ) );
break;
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
wxLogFatalError( wxT( "The framebuffer does not have at least "
"one image attached to it." ) );
break;
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
wxLogFatalError( wxT( "The framebuffer read buffer is incomplete." ) );
break;
case GL_FRAMEBUFFER_UNSUPPORTED:
wxLogFatalError( wxT( "The combination of internal formats of the attached images "
"violates an implementation-dependent set of restrictions." ) );
break;
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
wxLogFatalError( wxT( "GL_RENDERBUFFER_SAMPLES is not the same "
"for all attached renderbuffers" ) );
break;
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
wxLogFatalError( wxT( "Framebuffer incomplete layer targets errors." ) );
break;
default:
wxLogFatalError( wxT( "Cannot create the framebuffer." ) );
break;
}
}
ClearBuffer();
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
m_currentFbo = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment