in modules/core/src/lib/deck.js [604:677]
_setGLContext(gl) {
if (this.layerManager) {
return;
}
// if external context...
if (!this.canvas) {
this.canvas = gl.canvas;
instrumentGLContext(gl, {enable: true, copyState: true});
}
this.tooltip = new Tooltip(this.canvas);
setParameters(gl, {
blend: true,
blendFunc: [GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA, GL.ONE, GL.ONE_MINUS_SRC_ALPHA],
polygonOffsetFill: true,
depthTest: true,
depthFunc: GL.LEQUAL
});
this.props.onWebGLInitialized(gl);
// timeline for transitions
const timeline = new Timeline();
timeline.play();
this.animationLoop.attachTimeline(timeline);
this.eventManager = new EventManager(this.props.parent || gl.canvas, {
touchAction: this.props.touchAction,
events: {
pointerdown: this._onPointerDown,
pointermove: this._onPointerMove,
pointerleave: this._onPointerMove
}
});
for (const eventType in EVENTS) {
this.eventManager.on(eventType, this._onEvent);
}
this.viewManager = new ViewManager({
timeline,
eventManager: this.eventManager,
onViewStateChange: this._onViewStateChange,
onInteractiveStateChange: this._onInteractiveStateChange,
views: this._getViews(),
viewState: this._getViewState(),
width: this.width,
height: this.height
});
// viewManager must be initialized before layerManager
// layerManager depends on viewport created by viewManager.
const viewport = this.viewManager.getViewports()[0];
// Note: avoid React setState due GL animation loop / setState timing issue
this.layerManager = new LayerManager(gl, {
deck: this,
stats: this.stats,
viewport,
timeline
});
this.effectManager = new EffectManager();
this.deckRenderer = new DeckRenderer(gl);
this.deckPicker = new DeckPicker(gl);
this.setProps(this.props);
this._updateCanvasSize();
this.props.onLoad();
}