expo-gl
Version:
Provides GLView that acts as OpenGL ES render target and gives GL context object implementing WebGL 2.0 specification.
36 lines (35 loc) • 1.53 kB
TypeScript
import * as React from 'react';
import { BaseGLViewProps, ComponentOrHandle, GLSnapshot, SnapshotOptions } from './GLView.types';
export interface GLViewProps extends BaseGLViewProps {
onContextCreate: (gl: WebGLRenderingContext) => void;
onContextRestored?: (gl?: WebGLRenderingContext) => void;
onContextLost?: () => void;
webglContextAttributes?: WebGLContextAttributes;
/**
* [iOS only] Number of samples for Apple's built-in multisampling.
*/
msaaSamples: number;
/**
* A ref callback for the native GLView
*/
nativeRef_EXPERIMENTAL?(callback: ComponentOrHandle | HTMLCanvasElement | null): any;
}
export declare class GLView extends React.Component<GLViewProps> {
canvas?: HTMLCanvasElement;
gl?: WebGLRenderingContext;
static createContextAsync(): Promise<WebGLRenderingContext | null>;
static destroyContextAsync(exgl?: WebGLRenderingContext | number): Promise<boolean>;
static takeSnapshotAsync(gl: WebGLRenderingContext, options?: SnapshotOptions): Promise<GLSnapshot>;
componentWillUnmount(): void;
render(): JSX.Element;
componentDidUpdate(prevProps: GLViewProps): void;
private getGLContextOrReject;
private onContextLost;
private onContextRestored;
private getGLContext;
private setCanvasRef;
takeSnapshotAsync(options?: SnapshotOptions): Promise<GLSnapshot>;
startARSessionAsync(): Promise<void>;
createCameraTextureAsync(): Promise<void>;
destroyObjectAsync(glObject: WebGLObject): Promise<void>;
}