new App(gl)
Primary entry point to PicoGL. An app will store all parts of the WebGL
state.
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext |
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
canvas |
HTMLElement | The canvas on which this app drawing. | ||||||||||||
gl |
WebGLRenderingContext | The WebGL context. | ||||||||||||
width |
number | The width of the drawing surface. | ||||||||||||
height |
number | The height of the drawing surface. | ||||||||||||
state |
Object | Tracked GL state.
Properties
|
||||||||||||
clearBits |
GLenum | Current clear mask to use with clear(). |
Methods
blendEquation(mode) → {App}
Set the blend equation. E.g. app.blendEquation(PicoGL.MIN).
Parameters:
Name | Type | Description |
---|---|---|
mode |
GLenum | The operation to use in combining source and destination channels. |
Returns:
The App object.
- Type
- App
blendFunc(src, dest) → {App}
Set the blend function. E.g. app.blendFunc(PicoGL.ONE, PicoGL.ONE_MINUS_SRC_ALPHA).
Parameters:
Name | Type | Description |
---|---|---|
src |
GLenum | The source blending weight. |
dest |
GLenum | The destination blending weight. |
Returns:
The App object.
- Type
- App
blendFuncSeparate(csrc, cdest, asrc, adest) → {App}
Set the blend function, with separate weighting for color and alpha channels.
E.g. app.blendFuncSeparate(PicoGL.ONE, PicoGL.ONE_MINUS_SRC_ALPHA, PicoGL.ONE, PicoGL.ONE).
Parameters:
Name | Type | Description |
---|---|---|
csrc |
GLenum | The source blending weight for the RGB channels. |
cdest |
GLenum | The destination blending weight for the RGB channels. |
asrc |
GLenum | The source blending weight for the alpha channel. |
adest |
GLenum | The destination blending weight for the alpha channel. |
Returns:
The App object.
- Type
- App
blitFramebuffer(mask, optionsopt) → {App}
Copy data from framebuffer attached to READ_FRAMEBUFFER to framebuffer attached to DRAW_FRAMEBUFFER.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mask |
GLenum | Write mask (e.g. PicoGL.COLOR_BUFFER_BIT). | |||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Blit options.
Properties
|
Returns:
The App object.
- Type
- App
clear() → {App}
Clear the canvas
Returns:
The App object.
- Type
- App
clearColor(r, g, b, a) → {App}
Set the clear color.
Parameters:
Name | Type | Description |
---|---|---|
r |
number | Red channel. |
g |
number | Green channel. |
b |
number | Blue channel. |
a |
number | Alpha channel. |
Returns:
The App object.
- Type
- App
clearMask(mask) → {App}
Set the clear mask bits to use when calling clear().
E.g. app.clearMask(PicoGL.COLOR_BUFFER_BIT).
Parameters:
Name | Type | Description |
---|---|---|
mask |
GLenum | Bit mask of buffers to clear. |
Returns:
The App object.
- Type
- App
colorMask(r, g, b, a) → {App}
Set the color mask to selectively enable or disable particular
color channels while rendering.
Parameters:
Name | Type | Description |
---|---|---|
r |
boolean | Red channel. |
g |
boolean | Green channel. |
b |
boolean | Blue channel. |
a |
boolean | Alpha channel. |
Returns:
The App object.
- Type
- App
createCubemap(options) → {Cubemap}
Create a cubemap.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Texture options.
Properties
|
Returns:
New Cubemap object.
- Type
- Cubemap
createDrawCall(program, vertexArrayopt) → {DrawCall}
Create a DrawCall. A DrawCall manages the state associated with
a WebGL draw call including a program and associated vertex data, textures,
uniforms and uniform blocks.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
program |
Program | The program to use for this DrawCall. | ||
vertexArray |
VertexArray |
<optional> |
null | Vertex data to use for drawing. |
Returns:
New DrawCall object.
- Type
- DrawCall
createFramebuffer() → {Framebuffer}
Create a framebuffer.
Returns:
New Framebuffer object.
- Type
- Framebuffer
createIndexBuffer(type, data, usageopt) → {VertexBuffer}
Create an index buffer. If the `itemSize` is not specified, it defaults to 3
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
GLenum | The data type stored in the index buffer. | ||
data |
ArrayBufferView | Index buffer data. | ||
usage |
GLenum |
<optional> |
STATIC_DRAW | Buffer usage. |
Returns:
New VertexBuffer object.
- Type
- VertexBuffer
createIndexBuffer(type, itemSize, data, usageopt) → {VertexBuffer}
Create an index buffer.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
GLenum | The data type stored in the index buffer. | ||
itemSize |
number | Number of elements per primitive. | ||
data |
ArrayBufferView | Index buffer data. | ||
usage |
GLenum |
<optional> |
STATIC_DRAW | Buffer usage. |
Returns:
New VertexBuffer object.
- Type
- VertexBuffer
createInterleavedBuffer(bytesPerVertex, data, usageopt) → {VertexBuffer}
Create an buffer without any structure information. Structure
must be fully specified when binding to a VertexArray.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
bytesPerVertex |
number | Number of bytes per vertex. | ||
data |
ArrayBufferView | number | Buffer data itself or the total number of bytes to be allocated. | ||
usage |
GLenum |
<optional> |
STATIC_DRAW | Buffer usage. |
Returns:
New VertexBuffer object.
- Type
- VertexBuffer
createMatrixBuffer(type, data, usageopt) → {VertexBuffer}
Create a per-vertex matrix buffer. Matrix buffers ensure that columns
are correctly split across attribute locations.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
GLenum | The data type stored in the matrix buffer. Valid types are FLOAT_MAT4, FLOAT_MAT4x2, FLOAT_MAT4x3, FLOAT_MAT3, FLOAT_MAT3x2, FLOAT_MAT3x4, FLOAT_MAT2, FLOAT_MAT2x3, FLOAT_MAT2x4. | ||
data |
ArrayBufferView | Matrix buffer data. | ||
usage |
GLenum |
<optional> |
STATIC_DRAW | Buffer usage. |
Returns:
New VertexBuffer object.
- Type
- VertexBuffer
createProgram(vertexShader, fragmentShader, optionsopt) → {Program}
Create a program synchronously. It is highly recommended to use createPrograms instead as
that method will compile shaders in parallel where possible.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vertexShader |
Shader | string | Vertex shader object or source code. | |||||||||||||||||
fragmentShader |
Shader | string | Fragment shader object or source code. | |||||||||||||||||
options |
Object |
<optional> |
Texture options.
Properties
|
Returns:
New Program object.
- Type
- Program
createPrograms(…sources) → {Promise.<Array.<Program>>}
Create several programs. Preferred method for program creation as it will compile shaders
in parallel where possible.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
sources |
Array |
<repeatable> |
Variable number of 2 or 3 element arrays, each containing:
|
Returns:
Promise that will resolve to an array of Programs when compilation and
linking are complete for all programs.
- Type
- Promise.<Array.<Program>>
createQuery(target) → {Query}
Create a query.
Parameters:
Name | Type | Description |
---|---|---|
target |
GLenum | Information to query. |
Returns:
New Query object.
- Type
- Query
createRenderbuffer(width, height, internalFormat, samplesopt) → {Renderbuffer}
Create a renderbuffer.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
width |
number | Renderbuffer width. | ||
height |
number | Renderbuffer height. | ||
internalFormat |
GLenum | Internal arrangement of the renderbuffer data. | ||
samples |
number |
<optional> |
0 | Number of MSAA samples. |
Returns:
New Renderbuffer object.
- Type
- Renderbuffer
createShader(type, source) → {Shader}
Create a shader. Creating a shader separately from a program allows for
shader reuse.
Parameters:
Name | Type | Description |
---|---|---|
type |
GLenum | Shader type. |
source |
string | Shader source. |
Returns:
New Shader object.
- Type
- Shader
createTexture2D(width, height, optionsopt) → {Texture}
Create empty 2D texture.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
width |
number | Texture width. Required for array or empty data. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height |
number | Texture height. Required for array or empty data. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Texture options.
Properties
|
Returns:
New Texture object.
- Type
- Texture
createTexture2D(image, optionsopt) → {Texture}
Create a 2D texture from a DOM image element.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
image |
HTMLImageElement | Array.<HTMLImageElement> | Image data. An array can be passed to manually set all levels of the mipmap chain. If a single level is passed and mipmap filtering is being used, generateMipmap() will be called to produce the remaining levels. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Texture options.
Properties
|
Returns:
New Texture object.
- Type
- Texture
createTexture2D(image, width, height, optionsopt) → {Texture}
Create 2D texture from a typed array.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
image |
ArrayBufferView | Array.<ArrayBufferView> | Image data. An array can be passed to manually set all levels of the mipmap chain. If a single level is passed and mipmap filtering is being used, generateMipmap() will be called to produce the remaining levels. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
width |
number | Texture width. Required for array or empty data. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height |
number | Texture height. Required for array or empty data. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Texture options.
Properties
|
Returns:
New Texture object.
- Type
- Texture
createTexture3D(image, width, height, depth, optionsopt) → {Texture}
Create a 3D texture.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
image |
ArrayBufferView | Array | Pixel data. An array can be passed to manually set all levels of the mipmap chain. If a single level is passed and mipmap filtering is being used, generateMipmap() will be called to produce the remaining levels. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
width |
number | Texture width. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height |
number | Texture height. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
depth |
number | Texture depth. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Texture options.
Properties
|
Returns:
New Texture object.
- Type
- Texture
createTextureArray(image, width, height, size, optionsopt) → {Texture}
Create a 2D texture array.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
image |
ArrayBufferView | Array | Pixel data. An array can be passed to manually set all levels of the mipmap chain. If a single level is passed and mipmap filtering is being used, generateMipmap() will be called to produce the remaining levels. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
width |
number | Texture width. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
height |
number | Texture height. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
size |
number | Number of images in the array. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Texture options.
Properties
|
Returns:
New Texture object.
- Type
- Texture
createTimer() → {Timer}
Create a timer.
Returns:
New Timer object.
- Type
- Timer
createTransformFeedback() → {TransformFeedback}
Create a transform feedback object.
Returns:
New TransformFeedback object.
- Type
- TransformFeedback
createUniformBuffer(layout, usageopt) → {UniformBuffer}
Create a uniform buffer in std140 layout. NOTE: FLOAT_MAT2, FLOAT_MAT3x2, FLOAT_MAT4x2,
FLOAT_MAT3, FLOAT_MAT2x3, FLOAT_MAT4x3 are supported, but must be manually padded to
4-float column alignment by the application!
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
layout |
Array | Array indicating the order and types of items to be stored in the buffer. | ||
usage |
GLenum |
<optional> |
DYNAMIC_DRAW | Buffer usage. |
Returns:
New UniformBuffer object.
- Type
- UniformBuffer
createVertexArray() → {VertexArray}
Create a vertex array.
Returns:
New VertexArray object.
- Type
- VertexArray
createVertexBuffer(type, itemSize, data, usageopt) → {VertexBuffer}
Create a vertex buffer.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
GLenum | The data type stored in the vertex buffer. | ||
itemSize |
number | Number of elements per vertex. | ||
data |
ArrayBufferView | number | Buffer data itself or the total number of elements to be allocated. | ||
usage |
GLenum |
<optional> |
STATIC_DRAW | Buffer usage. |
Returns:
New VertexBuffer object.
- Type
- VertexBuffer
defaultDrawFramebuffer() → {App}
Switch back to the default framebuffer for drawing (i.e. draw to the screen).
Note that this method resets the viewport to match the default framebuffer.
Returns:
The App object.
- Type
- App
defaultReadFramebuffer() → {App}
Switch back to the default framebuffer for reading (i.e. read from the screen).
Returns:
The App object.
- Type
- App
defaultViewport() → {App}
Set the viewport to the full canvas.
Returns:
The App object.
- Type
- App
depthFunc(func) → {App}
Set the depth test function. E.g. app.depthFunc(PicoGL.LEQUAL).
Parameters:
Name | Type | Description |
---|---|---|
func |
GLenum | The depth testing function to use. |
Returns:
The App object.
- Type
- App
depthMask(mask) → {App}
Enable or disable writing to the depth buffer.
Parameters:
Name | Type | Description |
---|---|---|
mask |
Boolean | The depth mask. |
Returns:
The App object.
- Type
- App
depthRange(near, far) → {App}
Set the depth range.
Parameters:
Name | Type | Description |
---|---|---|
near |
number | Minimum depth value. |
far |
number | Maximum depth value. |
Returns:
The App object.
- Type
- App
disable(cap) → {App}
Disable WebGL capability (e.g. depth testing, blending, etc.).
Parameters:
Name | Type | Description |
---|---|---|
cap |
GLenum | Capability to disable. |
Returns:
The App object.
- Type
- App
drawFramebuffer(framebuffer) → {App}
Bind a draw framebuffer to the WebGL context.
Parameters:
Name | Type | Description |
---|---|---|
framebuffer |
Framebuffer | The Framebuffer object to bind. |
- Source:
- See:
Returns:
The App object.
- Type
- App
enable(cap) → {App}
Enable WebGL capability (e.g. depth testing, blending, etc.).
Parameters:
Name | Type | Description |
---|---|---|
cap |
GLenum | Capability to enable. |
Returns:
The App object.
- Type
- App
loseContext() → {App}
Simulate context loss.
Returns:
The App object.
- Type
- App
onContextRestored(fn) → {App}
Set function to handle context restoration after loss.
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | Context restored handler. |
Returns:
The App object.
- Type
- App
polygonOffset(factor, units) → {App}
Set the scale and units used.
Parameters:
Name | Type | Description |
---|---|---|
factor |
Number | Scale factor used to create a variable depth offset for each polygon. |
units |
Number | Constant depth offset. |
Returns:
The App object.
- Type
- App
readFramebuffer(framebuffer) → {App}
Bind a read framebuffer to the WebGL context.
Parameters:
Name | Type | Description |
---|---|---|
framebuffer |
Framebuffer | The Framebuffer object to bind. |
- Source:
- See:
Returns:
The App object.
- Type
- App
readPixel(x, y, outColor, optionsopt) → {App}
Read a pixel's color value from the currently-bound framebuffer.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
number | The x coordinate of the pixel. | ||||||||||||||||
y |
number | The y coordinate of the pixel. | ||||||||||||||||
outColor |
ArrayBufferView | Typed array to store the pixel's color. | ||||||||||||||||
options |
object |
<optional> |
Options.
Properties
|
Returns:
The App object.
- Type
- App
resize(width, height) → {App}
Resize the drawing surface.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | The new canvas width. |
height |
number | The new canvas height. |
Returns:
The App object.
- Type
- App
restoreContext() → {App}
Simulate context restoration.
Returns:
The App object.
- Type
- App
restorePrograms(…sources) → {Promise.<void>}
Restore several programs after a context loss. Will do so in parallel where available.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
sources |
Program |
<repeatable> |
Variable number of programs to restore. |
Returns:
Promise that will resolve once all programs have been restored.
- Type
- Promise.<void>
scissor(x, y, width, height) → {App}
Define the scissor box.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | Horizontal position of the scissor box. |
y |
Number | Vertical position of the scissor box. |
width |
Number | Width of the scissor box. |
height |
Number | Height of the scissor box. |
Returns:
The App object.
- Type
- App
stencilFunc(func, ref, mask) → {App}
Set the stencil function and reference value.
E.g. app.stencilFunc(PicoGL.EQUAL, 1, 0xFF).
NOTE: Only works if { stencil: true } passed as a
context attribute when creating the App!
Parameters:
Name | Type | Description |
---|---|---|
func |
GLenum | The testing function. |
ref |
number | The reference value. |
mask |
GLenum | The bitmask to use against tested values before applying the stencil function. |
Returns:
The App object.
- Type
- App
stencilFuncSeparate(face, func, ref, mask) → {App}
Set the stencil function and reference value for a particular face orientation.
E.g. app.stencilFuncSeparate(PicoGL.FRONT, PicoGL.EQUAL, 1, 0xFF).
NOTE: Only works if { stencil: true } passed as a
context attribute when creating the App!
Parameters:
Name | Type | Description |
---|---|---|
face |
GLenum | The face orientation to apply the function to. |
func |
GLenum | The testing function. |
ref |
number | The reference value. |
mask |
GLenum | The bitmask to use against tested values before applying the stencil function. |
Returns:
The App object.
- Type
- App
stencilMask(mask) → {App}
Set the bitmask to use for tested stencil values.
E.g. app.stencilMask(0xFF).
NOTE: Only works if { stencil: true } passed as a
context attribute when creating the App!
Parameters:
Name | Type | Description |
---|---|---|
mask |
number | The mask value. |
Returns:
The App object.
- Type
- App
stencilMaskSeparate(face, mask) → {App}
Set the bitmask to use for tested stencil values for a particular face orientation.
E.g. app.stencilMaskSeparate(PicoGL.FRONT, 0xFF).
NOTE: Only works if { stencil: true } passed as a
context attribute when creating the App!
Parameters:
Name | Type | Description |
---|---|---|
face |
GLenum | The face orientation to apply the mask to. |
mask |
number | The mask value. |
Returns:
The App object.
- Type
- App
stencilOp(stencilFail, depthFail, pass) → {App}
Set the operations for updating stencil buffer values.
E.g. app.stencilOp(PicoGL.KEEP, PicoGL.KEEP, PicoGL.REPLACE).
NOTE: Only works if { stencil: true } passed as a
context attribute when creating the App!
Parameters:
Name | Type | Description |
---|---|---|
stencilFail |
GLenum | Operation to apply if the stencil test fails. |
depthFail |
GLenum | Operation to apply if the depth test fails. |
pass |
GLenum | Operation to apply if the both the depth and stencil tests pass. |
Returns:
The App object.
- Type
- App
stencilOpSeparate(face, stencilFail, depthFail, pass) → {App}
Set the operations for updating stencil buffer values for a particular face orientation.
E.g. app.stencilOpSeparate(PicoGL.FRONT, PicoGL.KEEP, PicoGL.KEEP, PicoGL.REPLACE).
NOTE: Only works if { stencil: true } passed as a
context attribute when creating the App!
Parameters:
Name | Type | Description |
---|---|---|
face |
GLenum | The face orientation to apply the operations to. |
stencilFail |
GLenum | Operation to apply if the stencil test fails. |
depthFail |
GLenum | Operation to apply if the depth test fails. |
pass |
GLenum | Operation to apply if the both the depth and stencil tests pass. |
Returns:
The App object.
- Type
- App
viewport(x, y, width, height) → {App}
Set the viewport.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | Left bound of the viewport rectangle. |
y |
number | Lower bound of the viewport rectangle. |
width |
number | Width of the viewport rectangle. |
height |
number | Height of the viewport rectangle. |
Returns:
The App object.
- Type
- App