From 4f7bb4c0f762b23fbbfd93039b8665d2162ac057 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 3 Jun 2016 15:46:11 +0200 Subject: [PATCH] Simplified error checking in OPENGL_GAL test. --- common/gal/opengl/opengl_gal.cpp | 35 +++++++------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 0b220b9347..be8ac24b20 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -1501,53 +1501,32 @@ void OPENGL_GAL::OPENGL_TEST::Render( wxPaintEvent& WXUNUSED( aEvent ) ) GLenum err = glewInit(); if( GLEW_OK != err ) - { error( (const char*) glewGetErrorString( err ) ); - return; - } // Check the OpenGL version (minimum 2.1 is required) - if( !GLEW_VERSION_2_1 ) - { + else if( !GLEW_VERSION_2_1 ) error( "OpenGL 2.1 or higher is required!" ); - return; - } // Framebuffers have to be supported - if( !GLEW_EXT_framebuffer_object ) - { + else if( !GLEW_EXT_framebuffer_object ) error( "Framebuffer objects are not supported!" ); - return; - } // Vertex buffer has to be supported - if( !GLEW_ARB_vertex_buffer_object ) - { + else if( !GLEW_ARB_vertex_buffer_object ) error( "Vertex buffer objects are not supported!" ); - return; - } // Prepare shaders - if( !m_gal->shader.LoadBuiltinShader( 0, SHADER_TYPE_VERTEX ) ) - { + else if( !m_gal->shader.LoadBuiltinShader( 0, SHADER_TYPE_VERTEX ) ) error( "Cannot compile vertex shader!" ); - return; - } - if( !m_gal->shader.LoadBuiltinShader( 1, SHADER_TYPE_FRAGMENT ) ) - { + else if( !m_gal->shader.LoadBuiltinShader( 1, SHADER_TYPE_FRAGMENT ) ) error( "Cannot compile fragment shader!" ); - return; - } - if( !m_gal->shader.Link() ) - { + else if( !m_gal->shader.Link() ) error( "Cannot link the shaders!" ); - return; - } + // Check if video card supports textures big enough to fit font atlas int maxTextureSize; - glGetIntegerv( GL_MAX_TEXTURE_SIZE, &maxTextureSize ); if( maxTextureSize < (int) bitmap_font.width || maxTextureSize < (int) bitmap_font.height )