bobzhang/p5/gl does not have a README file

    Buffer

    #external
    pub type Buffer

    FBO

    #external
    pub type FBO

    A p5 framebuffer's GL objects: color/depth textures, and multisampled renderbuffers when antialiased.

    Framebuffer

    #external
    pub type Framebuffer

    #external
    pub type GL

    A WebGL rendering context.

    Program

    #external
    pub type Program

    A linked shader program with its uniform and attribute tables.

    Texture

    #external
    pub type Texture

    apply_blend_mode

    fn apply_blend_mode(gl : GL, mode : String) -> Unit

    Applies a p5 blend mode by name (_applyBlendMode).

    apply_clip

    fn apply_clip(gl : GL) -> Unit

    Starts drawing a clip mask into the stencil buffer (p5's _applyClip).

    array_buffer_data

    fn array_buffer_data(gl : GL, b : Buffer, data : FixedArray[Double]) -> Unit

    Uploads float data to an ARRAY_BUFFER.

    attrib_pointer

    fn attrib_pointer(gl : GL, b : Buffer, loc : Int, size : Int) -> Unit

    Binds b as the source of attribute loc with size floats per vertex.

    attribute_location

    fn attribute_location(p : Program, name : String) -> Int

    The location of an active attribute, or -1.

    bind_fbo

    fn bind_fbo(gl : GL, fb : FBO?) -> Unit

    Binds a framebuffer for drawing (its multisampled one when antialiased), or the canvas.

    bind_textures

    fn bind_textures(p : Program, empty : Texture) -> Unit

    Binds every sampler's texture to its unit (bindTextures), using empty for samplers without one.

    clear

    fn clear(gl : GL, r : Double, g : Double, b : Double, a : Double) -> Unit

    Clears color (premultiplied by p5's clear) and depth.

    clear_clip_buffer

    fn clear_clip_buffer(gl : GL) -> Unit

    Removes the clip (p5's _clearClipBuffer).

    clear_depth

    fn clear_depth(gl : GL, depth : Double) -> Unit

    clear_sampler

    fn clear_sampler(p : Program, name : String) -> Unit

    Clears the texture assigned to a sampler uniform.

    compile_program

    fn compile_program(gl : GL, vert : String, frag : String) -> Result[Program, String]

    Compiles and links a program.

    compile_program_js

    fn compile_program_js(gl : GL, vert : String, frag : String, ok : (Program) -> Unit, err : (String) -> Unit) -> Unit

    Compiles and links a program; raises the compile/link log on failure.

    context_canvas

    The canvas element of a context, as an image source.

    create_buffer

    fn create_buffer(gl : GL) -> Buffer

    create_context

    fn create_context(canvas :
    Canvas
    , alpha : Bool, depth : Bool, stencil : Bool, antialias : Bool, premultiplied_alpha : Bool, preserve_drawing_buffer : Bool, version? : Int) -> GL

    Creates a context for canvas with p5's default attributes (WebGL 2 when available).

    create_fbo

    fn create_fbo(gl : GL, w : Int, h : Int, samples : Int, use_depth : Bool, use_stencil : Bool, depth_float : Bool, alpha : Bool, linear : Bool, wrap_s : String, wrap_t : String) -> FBO

    Creates (or recreates, when old is given) a framebuffer's GL objects like p5's createFramebufferResources + recreateFramebufferTextures.

    create_plain_context

    fn create_plain_context(canvas :
    Canvas
    ) -> GL

    A plain WebGL context with default attributes for a helper canvas (p5's FilterRenderer2D): only premultiplied uploads are set.

    create_white_texture

    fn create_white_texture(gl : GL) -> Texture

    A 1x1 texture holding opaque white... p5's empty texture is an image with pixel (0,0) set to 255 gray: (255, 255, 255, 255).

    data_texture

    fn data_texture(gl : GL, data : FixedArray[Double], w : Int, h : Int, dirty : Bool) -> Texture

    A texture holding data (RGBA values stored through a Uint8ClampedArray, as p5's ImageData) of w × h, re-uploaded when dirty. Uploaded without premultiplied alpha (p5's text path).

    default_antialias

    fn default_antialias() -> Bool

    p5's antialias default: on when the user agent mentions Safari.

    delete_buffer

    fn delete_buffer(gl : GL, b : Buffer) -> Unit

    delete_fbo

    fn delete_fbo(fb : FBO) -> Unit

    Deletes a framebuffer's GL objects.

    disable_attrib

    fn disable_attrib(gl : GL, loc : Int) -> Unit

    disable_other_attribs

    fn disable_other_attribs(p : Program) -> Unit

    Disables attribute arrays that p does not use (_disableRemainingAttributes), and loc when given (>= 0).

    draw_arrays

    fn draw_arrays(gl : GL, mode : Int, count : Int, instances : Int) -> Unit

    Draws count vertices: mode 0 triangles, 1 triangle strip, 2 triangle fan.

    draw_elements

    fn draw_elements(gl : GL, b : Buffer, count : Int, wide : Bool, instances : Int) -> Unit

    drawing_buffer_height

    fn drawing_buffer_height(gl : GL) -> Int

    drawing_buffer_width

    fn drawing_buffer_width(gl : GL) -> Int

    fbo_mark_dirty

    fn fbo_mark_dirty(fb : FBO) -> Unit

    Marks an antialiased framebuffer's textures as needing a resolve.

    fbo_read_pixels

    fn fbo_read_pixels(fb : FBO, x : Int, y : Int, w : Int, h : Int, active : FBO?) -> FixedArray[Byte]

    Reads a framebuffer's RGBA pixels, top row first.

    fbo_resolve

    fn fbo_resolve(fb : FBO, depth : Bool, linear : Bool, active : FBO?) -> Unit

    Resolves multisampled contents into the textures (blit) when needed, then rebinds active for drawing. depth picks the depth texture.

    fbo_texture

    fn fbo_texture(fb : FBO, depth : Bool) -> Texture

    The color (or depth) texture of a framebuffer.

    has_attribute

    fn has_attribute(p : Program, name : String) -> Bool

    has_sampler

    fn has_sampler(p : Program, name : String) -> Bool

    Whether p has a sampler uniform named name.

    has_uniform

    fn has_uniform(p : Program, name : String) -> Bool

    index_buffer_data

    fn index_buffer_data(gl : GL, b : Buffer, data : FixedArray[Int], wide : Bool) -> Unit

    Uploads indices to an ELEMENT_ARRAY_BUFFER (32-bit when wide).

    max_texture_size

    fn max_texture_size(gl : GL) -> Int

    mipmap_texture

    fn mipmap_texture(gl : GL, levels : FixedArray[FixedArray[Byte]], sizes : FixedArray[Int]) -> Texture

    A mipmapped texture from RGBA levels (top row first), each sizes[i] pixels square, with trilinear filtering (p5's createMipmapTextureHandle).

    read_pixels

    fn read_pixels(gl : GL, x : Int, y : Int, w : Int, h : Int) -> FixedArray[Byte]

    Reads RGBA pixels of the drawing buffer, top row first.

    reset_depth_stencil

    fn reset_depth_stencil(gl : GL) -> Unit

    p5's _resetBuffersBeforeDraw: clears depth and stencil.

    set_all_wrap

    fn set_all_wrap(gl : GL, wrap_s : String, wrap_t : String) -> Unit

    Sets the wrap mode of every texture created so far (p5's textureWrap updates all existing textures).

    set_blending

    fn set_blending(gl : GL, on : Bool) -> Unit

    Enables or disables blending (_applyColorBlend's toggle).

    set_stencil_test

    fn set_stencil_test(gl : GL, on : Bool) -> Unit

    Turns the stencil test on or off.

    set_texture_filter

    fn set_texture_filter(gl : GL, source :
    ImageElement
    , min : String, mag : String) -> Unit

    Sets the minification and magnification filters ("nearest" or "linear") of the texture made for an image element.

    set_uniform

    fn set_uniform(p : Program, name : String, data : FixedArray[Double]) -> Unit

    Sets a uniform from numbers (booleans as 0/1), skipping unchanged values, with p5's per-type dispatch.

    set_uniform_floats

    fn set_uniform_floats(p : Program, name : String, data : FixedArray[Float]) -> Unit

    Sets a matrix uniform from 32-bit float entries.

    set_uniform_texture

    fn set_uniform_texture(p : Program, name : String, tex : Texture) -> Unit

    Assigns a texture to a sampler uniform (bound by bind_textures).

    texture_for

    fn texture_for(gl : GL, source :
    ImageElement
    , wrap_s : String, wrap_t : String, filter : String) -> Texture

    The texture for an image source (canvas, image, video), created on first use and re-uploaded on each use (sources may change between frames). wrap_s/wrap_t ("clamp", "repeat" or "mirror") and filter ("linear" or "nearest") apply when the texture is created.

    unapply_clip

    fn unapply_clip(gl : GL, invert : Bool) -> Unit

    Finishes the mask: later drawing passes only inside it, or only outside with invert (p5's _unapplyClip).

    use_program

    fn use_program(p : Program) -> Unit

    Makes p the current program (skipped when it already is).

    version

    fn version(gl : GL) -> Int

    2 for WebGL 2, 1 for WebGL 1.

    viewport

    fn viewport(gl : GL, x : Int, y : Int, w : Int, h : Int) -> Unit

    Source Files