Engine API Reference - v2.16.1
    Preparing search index...

    Class QuadRender

    An object that renders a quad using a Shader.

    Note: QuadRender does not modify render states. Before calling QuadRender#render, you should set up the following states as needed, otherwise previously set states will be used:

    Example:

    const shader = pc.ShaderUtils.createShader(app.graphicsDevice, {
    uniqueName: 'MyShader',
    attributes: { aPosition: SEMANTIC_POSITION },
    vertexGLSL: '// vertex shader code',
    fragmentGLSL: '// fragment shader code'
    });
    const quad = new QuadRender(shader);

    // Set up render states before rendering
    app.graphicsDevice.setBlendState(BlendState.NOBLEND);
    app.graphicsDevice.setCullMode(CULLFACE_NONE);
    app.graphicsDevice.setDepthState(DepthState.NODEPTH);
    app.graphicsDevice.setStencilState(null, null);

    quad.render();
    quad.destroy();
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Renders the quad. If the viewport is provided, the original viewport and scissor is restored after the rendering.

      Parameters

      • Optionalviewport: Vec4

        The viewport rectangle of the quad, in pixels. The viewport is not changed if not provided.

      • Optionalscissor: Vec4

        The scissor rectangle of the quad, in pixels. Used only if the viewport is provided.

      Returns void