Esempio n. 1
0
/// Query the system for all supported configs
int
EGLDevice::queryEGLConfig(EGLDisplay display)
{
     GNASH_REPORT_FUNCTION;
     EGLConfig *configs = 0;
     EGLint max_num_config = 0;

     // Get the number of supported configurations
     if ( EGL_FALSE == eglGetConfigs(display, 0, 0, &max_num_config) ) {
         log_error("eglGetConfigs() failed to retrive the number of configs (error %s)",
                   getErrorString(eglGetError()));
         return 0;
     }
     if(max_num_config <= 0) {
         printf( "No EGLconfigs found\n" );
         return 0;
     }
     log_debug("Max number of EGL Configs is %d", max_num_config);     
     
     configs = new EGLConfig[max_num_config];
     if (0 == configs) {
         log_error( "Out of memory\n" );
         return 0;
     }

     if ( EGL_FALSE == eglGetConfigs(display, configs, max_num_config, &max_num_config)) {
         log_error("eglGetConfigs() failed to retrive the configs (error %s)",
                   getErrorString(eglGetError()));
         return 0;
     }
     
#if 0
     // This prints out all the configurations, so it can be quite large
     for (int i=0; i<max_num_config; i++ ) {
         std::cerr << "Config[" << i << "] is:" << std::endl;
         printEGLConfig(configs[i]);
     }
#endif
     
     return max_num_config;
}
Esempio n. 2
-2
/// Query the system for all supported configs
int
GtkOvgGlue::queryEGLConfig(EGLDisplay display)
{
     GNASH_REPORT_FUNCTION;
     EGLConfig *configs = 0;
     EGLint max_num_config = 0;

     // Get the number of supported configurations
     if ( EGL_FALSE == eglGetConfigs(display, 0, 0, &max_num_config) ) {
         log_error(_("eglGetConfigs() failed to retrieve the number of configs (error %s)"),
                   getErrorString(eglGetError()));
         return 0;
     }
     if(max_num_config <= 0) {
         log_error(_("No EGLconfigs found\n"));
         return 0;
     }
     log_debug("Max number of EGL Configs is %d", max_num_config);
     
     configs = new EGLConfig[max_num_config];
     if (0 == configs) {
         log_error(_("Out of memory\n"));
         return 0;
     }

     if ( EGL_FALSE == eglGetConfigs(display, configs, max_num_config, &max_num_config)) {
         log_error(_("eglGetConfigs() failed to retrive the configs (error %s)"),
                   getErrorString(eglGetError()));
         return 0;
     }
     for (int i=0; i<max_num_config; i++ ) {
         log_debug("Config[%d] is:", i);
         printEGLConfig(configs[i]);
     }

     return max_num_config;
}