MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / createContext

Function createContext

packages/shader-transitions/src/webgl.ts:6–16  ·  view source on GitHub ↗
(
  canvas: HTMLCanvasElement,
  width: number = DEFAULT_WIDTH,
  height: number = DEFAULT_HEIGHT,
)

Source from the content-addressed store, hash-verified

4export const DEFAULT_HEIGHT = 1080;
5
6export function createContext(
7 canvas: HTMLCanvasElement,
8 width: number = DEFAULT_WIDTH,
9 height: number = DEFAULT_HEIGHT,
10): WebGLRenderingContext | null {
11 const gl = canvas.getContext("webgl", { preserveDrawingBuffer: true });
12 if (!gl) return null;
13 gl.viewport(0, 0, width, height);
14 gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
15 return gl as WebGLRenderingContext;
16}
17
18export function setupQuad(gl: WebGLRenderingContext): WebGLBuffer {
19 const buf = gl.createBuffer();

Callers 9

initFunction · 0.85
StudioContext.tsxFile · 0.85
DomEditContext.tsxFile · 0.85
makeShimContextFunction · 0.85

Calls 1

getContextMethod · 0.80

Tested by 1

makeShimContextFunction · 0.68