@@ -60,7 +60,7 @@ class RenderResourcesPrivate
6060 void initialize_gl ();
6161
6262 // Error checking for GL initialization.
63- void error_check_for_initialize_gl ( std::string);
63+ void initialize_gl_log_error ( const std::string& );
6464
6565 // Query available video memory size.
6666 void query_video_memory_size ();
@@ -93,38 +93,38 @@ class RenderResourcesPrivate
9393
9494};
9595
96- void RenderResourcesPrivate::error_check_for_initialize_gl ( std::string error_string)
96+ void RenderResourcesPrivate::initialize_gl_log_error ( const std::string& error_string)
9797{
98- {
99- this ->gl_capable_ = false ;
98+ this ->gl_capable_ = false ;
10099 CORE_LOG_ERROR (error_string);
101- return ;
102- }
103100}
104-
101+
105102void RenderResourcesPrivate::initialize_gl ()
106103{
107- int err = glewInit ();
108- if ( err != GLEW_OK )
109- {
110- error_check_for_initialize_gl (" glewInit failed with error code " + Core::ExportToString (err));
111- }
112-
113- // Check OpenGL capabilities
114- if ( !GLEW_VERSION_2_0 )
115- {
116- error_check_for_initialize_gl (" OpenGL 2.0 required but not found." );
117- }
118- if ( !GLEW_EXT_framebuffer_object )
119- {
120- error_check_for_initialize_gl (" GL_EXT_framebuffer_object required but not found." );
121- }
122- if ( !GLEW_ARB_pixel_buffer_object )
123- {
124- error_check_for_initialize_gl (" GL_ARB_pixel_buffer_object required but not found." );
125- }
126-
127- this ->gl_capable_ = true ;
104+ // refactor error checks into a function to avoid misuse
105+ int err = glewInit ();
106+ if (err != GLEW_OK )
107+ {
108+ initialize_gl_log_error (" glewInit failed with error code " + Core::ExportToString (err));
109+ }
110+
111+ // Check OpenGL capabilities
112+ else if (!GLEW_VERSION_2_0 )
113+ {
114+ initialize_gl_log_error (" OpenGL 2.0 required but not found." );
115+ }
116+ else if (!GLEW_EXT_framebuffer_object)
117+ {
118+ initialize_gl_log_error (" GL_EXT_framebuffer_object required but not found." );
119+ }
120+ else if (!GLEW_ARB_pixel_buffer_object)
121+ {
122+ initialize_gl_log_error (" GL_ARB_pixel_buffer_object required but not found." );
123+ }
124+ else
125+ {
126+ this ->gl_capable_ = true ;
127+ }
128128}
129129
130130void RenderResourcesPrivate::query_video_memory_size ()
0 commit comments