MCPcopy Create free account
hub / github.com/botbotrobotics/BotBrain / createShader

Function createShader

frontend/src/utils/webgl/mapShaders.ts:117–131  ·  view source on GitHub ↗
(gl: WebGLRenderingContext, type: number, source: string)

Source from the content-addressed store, hash-verified

115`;
116
117export function createShader(gl: WebGLRenderingContext, type: number, source: string): WebGLShader | null {
118 const shader = gl.createShader(type);
119 if (!shader) return null;
120
121 gl.shaderSource(shader, source);
122 gl.compileShader(shader);
123
124 if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
125 console.error('Shader compilation error:', gl.getShaderInfoLog(shader));
126 gl.deleteShader(shader);
127 return null;
128 }
129
130 return shader;
131}
132
133export function createProgram(gl: WebGLRenderingContext, vertexShader: WebGLShader, fragmentShader: WebGLShader): WebGLProgram | null {
134 const program = gl.createProgram();

Callers 1

setupWebGLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected