9 lines
214 B
TypeScript
9 lines
214 B
TypeScript
export const getWebGl2Context = (canvas: HTMLCanvasElement): WebGL2RenderingContext => {
|
|
const gl = canvas.getContext('webgl2');
|
|
|
|
if (!gl) {
|
|
throw new Error('WebGl2 is not supported');
|
|
}
|
|
|
|
return gl;
|
|
};
|