gal: Check maximum framebuffer size (OpenGL).
This commit is contained in:
parent
1855db5493
commit
1f8b77697f
|
@ -55,7 +55,7 @@ void OPENGL_COMPOSITOR::Initialize()
|
||||||
// We need framebuffer objects for drawing the screen contents
|
// We need framebuffer objects for drawing the screen contents
|
||||||
// Generate framebuffer and a depth buffer
|
// Generate framebuffer and a depth buffer
|
||||||
glGenFramebuffersEXT( 1, &m_framebuffer );
|
glGenFramebuffersEXT( 1, &m_framebuffer );
|
||||||
glBindFramebufferEXT( GL_FRAMEBUFFER, m_framebuffer );
|
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_framebuffer );
|
||||||
m_currentFbo = m_framebuffer;
|
m_currentFbo = m_framebuffer;
|
||||||
|
|
||||||
// Allocate memory for the depth buffer
|
// Allocate memory for the depth buffer
|
||||||
|
@ -91,10 +91,12 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
||||||
{
|
{
|
||||||
wxASSERT( m_initialized );
|
wxASSERT( m_initialized );
|
||||||
|
|
||||||
unsigned int maxBuffers;
|
unsigned int maxBuffers, maxWidth, maxHeight;
|
||||||
|
|
||||||
// Get the maximum number of buffers
|
// Get the maximum size & number of buffers
|
||||||
glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, (GLint*) &maxBuffers );
|
glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, (GLint*) &maxBuffers );
|
||||||
|
glGetIntegerv( GL_MAX_FRAMEBUFFER_WIDTH, (GLint*) &maxWidth );
|
||||||
|
glGetIntegerv( GL_MAX_FRAMEBUFFER_HEIGHT, (GLint*) &maxHeight );
|
||||||
|
|
||||||
if( usedBuffers() >= maxBuffers )
|
if( usedBuffers() >= maxBuffers )
|
||||||
{
|
{
|
||||||
|
@ -104,6 +106,14 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
||||||
return 0; // Unfortunately we have no more free buffers left
|
return 0; // Unfortunately we have no more free buffers left
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_width > maxWidth || m_height > maxHeight ) {
|
||||||
|
DisplayError( NULL, wxString::Format( wxT( "Max handled framebuffer size is %d x %d,"
|
||||||
|
" but %x x %x is required." ),
|
||||||
|
maxWidth, maxHeight, m_width, m_height ) );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// GL_COLOR_ATTACHMENTn are consecutive integers
|
// GL_COLOR_ATTACHMENTn are consecutive integers
|
||||||
GLuint attachmentPoint = GL_COLOR_ATTACHMENT0 + usedBuffers();
|
GLuint attachmentPoint = GL_COLOR_ATTACHMENT0 + usedBuffers();
|
||||||
GLuint textureTarget;
|
GLuint textureTarget;
|
||||||
|
|
Loading…
Reference in New Issue