Esempio n. 1
0
 private static function detect_graphics()
 {
     if (self::$graphics_detected == true) {
         return;
     }
     // OpenGL / graphics detection
     $graphics_detection = array('NVIDIA', array('ATI', 'AMD', 'fglrx'), array('Mesa', 'SGI'));
     $opengl_driver = phodevi::read_property('system', 'opengl-vendor') . ' ' . phodevi::read_property('system', 'opengl-driver') . ' ' . phodevi::read_property('system', 'dri-display-driver');
     $opengl_driver = trim(str_replace('Corporation', null, $opengl_driver));
     // Prevents a possible false positive for ATI being in CorporATIon
     foreach ($graphics_detection as $gpu_check) {
         if (!is_array($gpu_check)) {
             $gpu_check = array($gpu_check);
         }
         for ($i = 0; $i < count($gpu_check); $i++) {
             if (stripos($opengl_driver, $gpu_check[$i]) !== false) {
                 self::$graphics[strtolower($gpu_check[0])] = true;
                 break;
             }
         }
     }
     self::$graphics_detected = true;
 }