Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stats-webgl

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stats-webgl

A pure webgl stats.

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

stats-webgl

npm version

A pure webgl stats. now only support webgl2.

Features:

  • draw calls
  • shader compiling and texture uploading collecting
  • use EXT_disjoint_timer_query to collect gpu cost

Install

Npm:

npm install --save stats-webgl

CDN:

  • unpkg.com/stats-webgl/dist/stats-webgl.js

Usage

Call stats.begin(gl) before your render code, and call stats.end(gl) after your render code. Use stats.getCurrent() to get current stats info.

function animation() {
  stats.begin(gl);
  // do some render thing
  stats.end(gl);

  // get current stats info
  const currentStatsInfo = stats.getCurrent();

  requestAnimationFrame(animation);
}

Here is the stats info looks like:

{
    drawCalls: 0,

    drawArrayCalls: 0,
    drawElementsCalls: 0,
    drawArrayInstancedCalls: 0,
    drawElementsInstancedCalls: 0,

    faces: 0,
    vertices: 0,
    points: 0,

    useProgramCalls: 0,
    bindTextureCalls: 0,

    compileShaderCalls: 0,
    uploadTextureCalls: 0,

    cpuCost: 0,
    // if gpuCost is 0, 
    // it means your browser doesn't support EXT_disjoint_timer_query
    gpuCost: 0, 
}

Keywords

FAQs

Package last updated on 19 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc