Skip to content

Commit

Permalink
feat(webgl): add option to throw error if missing GL extension
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 11, 2019
1 parent 05f7164 commit b5da3b2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/webgl/src/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ export const glCanvas = (opts: Partial<WeblGLCanvasOpts> = {}) => {
};
};

export const getExtensions = (gl: WebGLRenderingContext, ids: string[]) => {
export const getExtensions = (
gl: WebGLRenderingContext,
ids: string[],
required = true
) => {
const ext = {};
if (ids) {
for (let id of ids) {
ext[id] = gl.getExtension(id);
required && !ext[id] && error(`extension ${id} not available`);
}
}
return ext;
Expand Down

0 comments on commit b5da3b2

Please sign in to comment.