xl-pano
Version:
一个基于 Typescript 的,同时支持立方体和球体场景的轻量开源库。
32 lines (31 loc) • 1.38 kB
TypeScript
import { WebGLRenderingContextWithProgram } from "../types/index";
/**
* 初始化着色器程序,并挂载到 gl 上
* @param {WebGLRenderingContextWithProgram} gl WebGL 上下文
* @param {string} vshader 顶点着色器代码字符串
* @param {string} fshader 片元着色器代码字符串
* @return void
*/
export declare function initShaders(gl: WebGLRenderingContextWithProgram, vshader: string, fshader: string): void;
/**
* 切换程序对象
* @param {WebGLRenderingContextWithProgram} gl WebGL 上下文
* @param {WebGLProgram} program 程序对象
* @return void
* */
export declare function useProgram(gl: WebGLRenderingContextWithProgram, program: WebGLProgram): void;
/**
* 创建 program 程序对象
* @param {WebGLRenderingContextWithProgram} gl WebGL 上下文
* @param {string} vshader 顶点着色器代码字符串
* @param {string} fshader 片元着色器代码字符串
* @return WebGLProgram
*/
export declare function createProgram(gl: WebGLRenderingContextWithProgram, vshader: string, fshader: string): WebGLProgram;
/**
* 初始化WebGL,并返回上下文
* @param {HTMLCanvasElement} canvas canvas 节点
* @param {boolean} [debug] 是否开启 debug
* @return WebGLRenderingContextWithProgram 上下文
*/
export declare function getWebGLContext(canvas: HTMLCanvasElement, debug?: boolean): WebGLRenderingContextWithProgram;