'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isWebglAvailable = undefined;

require('luma.gl');

var _globals = require('../utils/globals');

/* eslint-disable quotes, no-console */
/* global console */
var ERR_NO_HEADLESS_GL = 'Failed to dynamically load headless gl. gl not installed or not accessible from this directory.';

var luma = _globals.global.luma;
if (!_globals.isBrowser) {
  try {
    luma.globals.headlessGL = module.require('gl');
    luma.globals.headlessTypes = module.require('gl/wrap');
  } catch (error) {
    console.error(ERR_NO_HEADLESS_GL);
    console.error('Node error: ' + error.message);
  }
  var _luma$globals = luma.globals,
      headlessGL = _luma$globals.headlessGL,
      headlessTypes = _luma$globals.headlessTypes;

  if (headlessGL && !(headlessTypes && headlessTypes.WebGLRenderingContext)) {
    console.error('Could not access headless WebGL type definitions');
  }
}

var isWebglAvailable = exports.isWebglAvailable = _globals.isBrowser || luma.globals.headlessGL;

if (isWebglAvailable) {}
// console.log('WebGL initialized');


// Create context
exports.default = luma.globals.headlessGL;
//# sourceMappingURL=headless.js.map