Skip to main content

Class: RenderBuffer

渲染缓冲区对象。 由于渲染缓冲区对象是只写的,因此它们通常用作深度和模板关联对象。

实例代码:

const renderBuffer = new RenderBuffer(renderer, {
format: renderer.gl.DEPTH_COMPONENT16,
width: 1920,
height: 1080,
});

renderBuffer.bind();
renderBuffer.unbind();

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new RenderBuffer(renderer, options?): RenderBuffer

Parameters

NameType
rendererRenderer
optionsPartial<RenderBufferOptions>

Returns

RenderBuffer

Overrides

Resource.constructor

Defined in

src/core/RenderBuffer.ts:50

Properties

renderer

renderer: Renderer

Inherited from

Resource.renderer

Defined in

src/core/Base.ts:7


width

width: number

渲染缓冲区宽度

Defined in

src/core/RenderBuffer.ts:41


height

height: number

渲染缓冲区高度

Defined in

src/core/RenderBuffer.ts:46


id

id: string

Inherited from

Resource.id

Defined in

src/core/Resource.ts:21


name

name: WithUndef<string>

Inherited from

Resource.name

Defined in

src/core/Resource.ts:23


userData

userData: any

Inherited from

Resource.userData

Defined in

src/core/Resource.ts:25


byteLength

byteLength: number

Inherited from

Resource.byteLength

Defined in

src/core/Resource.ts:28


options

options: Partial<RenderBufferOptions>

Inherited from

Resource.options

Defined in

src/core/Resource.ts:30

Accessors

gl

get gl(): WebGLRenderingContext | WebGL2RenderingContext

获取 webgl 实例

Returns

WebGLRenderingContext | WebGL2RenderingContext

Inherited from

Resource.gl

Defined in

src/core/Base.ts:16


rendererState

get rendererState(): State

获取渲染状态

Returns

State

Inherited from

Resource.rendererState

Defined in

src/core/Base.ts:23


handle

get handle(): any

Returns

any

Inherited from

Resource.handle

Defined in

src/core/Resource.ts:47

Methods

resize

resize(width, height): void

设置此渲染对象的的大小

Parameters

NameType
widthany
heightany

Returns

void

Defined in

src/core/RenderBuffer.ts:79


bind

bind(): void

绑定渲染缓冲

Returns

void

Overrides

Resource.bind

Defined in

src/core/RenderBuffer.ts:91


unbind

unbind(): void

解绑渲染缓冲

Returns

void

Overrides

Resource.unbind

Defined in

src/core/RenderBuffer.ts:98


removeStats

removeStats(): void

Returns

void

Overrides

Resource.removeStats

Defined in

src/core/RenderBuffer.ts:103


destroy

destroy(): void

销毁此渲染对象

Returns

void

Overrides

Resource.destroy

Defined in

src/core/RenderBuffer.ts:108


createHandle

createHandle(): null | WebGLRenderbuffer

创建 RBO

Returns

null | WebGLRenderbuffer

Overrides

Resource.createHandle

Defined in

src/core/RenderBuffer.ts:116


deleteHandle

deleteHandle(): void

移除 RBO

Returns

void

Overrides

Resource.deleteHandle

Defined in

src/core/RenderBuffer.ts:123


swapHandle

swapHandle(handle): void

交换为新的 handle(一般我们会用在虚拟 webgl 环境中)

Parameters

NameType
handleany

Returns

void

Inherited from

Resource.swapHandle

Defined in

src/core/Resource.ts:55


restoreHandle

restoreHandle(): void

恢复为原有 handle

Returns

void

Inherited from

Resource.restoreHandle

Defined in

src/core/Resource.ts:63


delete

delete(«destructured»?): RenderBuffer

Parameters

NameTypeDefault value
«destructured»Object{}
› deleteChildrenundefined | booleanfalse

Returns

RenderBuffer

Inherited from

Resource.delete

Defined in

src/core/Resource.ts:74


toString

toString(): string

Returns

string

Inherited from

Resource.toString

Defined in

src/core/Resource.ts:111