Created
November 10, 2017 06:24
-
-
Save vaalentin/1e8702b7035c9fff0f9e801ab3785572 to your computer and use it in GitHub Desktop.
Nano gl ts definitions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'nanogl' { | |
type uint = number | |
type TypedArray = Int8Array | Int16Array | Int32Array | |
| Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | |
| Float32Array | Float64Array | |
type Image = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | |
class Drawable { | |
public drawLineLoop(count?: uint, offset?: uint): void | |
public drawLines(count?: uint, offset?: uint): void | |
public drawLineStrip(count?: uint, offset?: uint): void | |
public drawPoints(count?: uint, offset?: uint): void | |
public drawTriangleFan(count?: uint, offset?: uint): void | |
public drawTriangles(count?: uint, offset?: uint): void | |
public drawTriangleStrip(count?: uint, offset?: uint): void | |
} | |
export class ArrayBuffer extends Drawable { | |
constructor(gl: WebGLRenderingContext, data?: TypedArray | uint, usage?: GLenum) | |
public attrib(name: string, size: uint, type: GLenum, normalize?: boolean): void | |
public attribPointer(program: Program): void | |
public bind(): void | |
public data(array: TypedArray | uint): void | |
public dispose(): void | |
public draw(mode: GLenum, count?: uint, offset?: uint): void | |
public subData(array: TypedArray, offset: uint): void | |
} | |
export class IndexBuffer extends Drawable { | |
constructor(gl: WebGLRenderingContext, type?: GLenum, data?: TypedArray | uint, usage?: GLenum) | |
public bind(): void | |
public data(array: TypedArray | uint): void | |
public dispose(): void | |
public draw(mode: GLenum, count?: uint, offset?: uint): void | |
public subData(array: TypedArray, offset: uint): void | |
} | |
export class Program { | |
public static verbose: boolean | |
constructor(gl: WebGLRenderingContext, vert?: string, frag?: string, defs?: string) | |
public compile(vert: string, frag: string, prefix?: string): void | |
public dispose(): void | |
public use(): void | |
} | |
export class Fbo { | |
constructor(gl: WebGLRenderingContext, width: uint, height: uint, opts: { | |
depth?: boolean | |
stencil?: boolean | |
type?: GLenum | GLenum[] | |
format?: GLenum | |
}) | |
public bind(): void | |
public bindColor(location: WebGLUniformLocation, unit: uint): void | |
public clear(): void | |
public dispose(): void | |
public getActualType(): GLenum | |
public isValid(): boolean | |
public resize(w: uint, h: uint): void | |
} | |
export class Texture { | |
constructor(gl: WebGLRenderingContext, format?: GLenum) | |
public bind(unit?: uint): void | |
public clamp(): void | |
public dispose(): void | |
public fromData(width: number, height: number, data?: TypedArray, dataType?: GLenum): void | |
public fromImage(img: Image): void | |
public mirror(): void | |
public repeat(): void | |
public setFilter(smooth?: boolean, mipmap?: boolean, miplinear?: boolean): void | |
public wrap(wrap: GLenum): void | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment