mirror of
https://github.com/visgl/luma.gl.git
synced 2026-02-01 14:33:49 +00:00
This commit is contained in:
parent
4df467b52f
commit
eccb6b1ca1
@ -50,7 +50,7 @@ export class WebGLAdapter extends Adapter {
|
||||
* @param gl
|
||||
* @returns
|
||||
*/
|
||||
async attach(gl: Device | WebGL2RenderingContext): Promise<WebGLDevice> {
|
||||
async attach(gl: Device | WebGL2RenderingContext, props: DeviceProps = {}): Promise<WebGLDevice> {
|
||||
const {WebGLDevice} = await import('./webgl-device');
|
||||
if (gl instanceof WebGLDevice) {
|
||||
return gl;
|
||||
@ -64,11 +64,14 @@ export class WebGLAdapter extends Adapter {
|
||||
throw new Error('Invalid WebGL2RenderingContext');
|
||||
}
|
||||
|
||||
const createCanvasContext = props.createCanvasContext === true ? {} : props.createCanvasContext;
|
||||
|
||||
// We create a new device using the provided WebGL context and its canvas
|
||||
// Assume that whoever created the external context will be handling resizes.
|
||||
return new WebGLDevice({
|
||||
...props,
|
||||
_handle: gl,
|
||||
createCanvasContext: {canvas: gl.canvas, autoResize: false}
|
||||
createCanvasContext: {canvas: gl.canvas, autoResize: false, ...createCanvasContext}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user