UNPKG

physics-glass-effects

Version:

Physics-based glass effects using WebGL with real optical science - works with React, Vue, Next.js, and vanilla JS

41 lines 1.68 kB
/** * Check if WebGL is supported in the current browser */ export declare function isWebGLSupported(): boolean; /** * Get WebGL context with proper fallbacks */ export declare function getWebGLContext(canvas: HTMLCanvasElement): WebGLRenderingContext; /** * Compile a shader from source code */ export declare function createShader(gl: WebGLRenderingContext, type: number, source: string): WebGLShader; /** * Create and link a WebGL program */ export declare function createProgram(gl: WebGLRenderingContext, vertexShader: WebGLShader, fragmentShader: WebGLShader): WebGLProgram; /** * Create a texture from an image or canvas element */ export declare function createTextureFromElement(gl: WebGLRenderingContext, element: HTMLImageElement | HTMLCanvasElement): WebGLTexture; /** * Load an image and create a texture from it */ export declare function loadImageTexture(gl: WebGLRenderingContext, url: string): Promise<WebGLTexture>; /** * Create a default fallback texture with a gradient */ export declare function createDefaultTexture(gl: WebGLRenderingContext): WebGLTexture; /** * Get all uniform locations for a program */ export declare function getUniformLocations(gl: WebGLRenderingContext, program: WebGLProgram, uniforms: string[]): Record<string, WebGLUniformLocation | null>; /** * Set up vertex buffer for a fullscreen quad */ export declare function createQuadBuffer(gl: WebGLRenderingContext): WebGLBuffer; /** * Handle WebGL context loss and restoration */ export declare function setupContextLossHandling(canvas: HTMLCanvasElement, onContextLost: () => void, onContextRestored: () => void): () => void; //# sourceMappingURL=webgl.d.ts.map