brotherofken / opengles-book-samples

Automatically exported from code.google.com/p/opengles-book-samples
0 stars 0 forks source link

esUtil.c mistakes? #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
   // Get configs
   if ( !eglGetConfigs(display, NULL, 0, &numConfigs) )
   {
      return EGL_FALSE;
   }

   // Choose config
   if ( !eglChooseConfig(display, attribList, &config, 1, &numConfigs) )
   {
      return EGL_FALSE;
   }

eglGetConfigs only fail if display is invalid or not initialize or &numConfigs 
is NULL.  Since none of this will happen and numConfigs is not used for 
anything later eglConfigs can be removed.

eglChooseConfig will fail if display is invalid or it is passed invalid 
parameters, but it will NOT fail if it finds zero configurations.  So, if 
numConfigs is zero eglChooseConfig will "succeed" and config will remain 
uninitialized.

Original issue reported on code.google.com by Jason.A....@gmail.com on 30 Jul 2013 at 9:49