
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
webgl-stats
Advanced tools
If you are looking for a UI representation of this stats you should take a look at: https://github.com/fernandojsg/webg-stats-ui
Keep tracks of the number of WebGL calls on your application by hooking the WebGL1 and WebGL2 APIs:
Install via NPM:
npm install --save webgl-stats
Then import to use it:
import WEBGLSTATS from 'webgl-stats';
or
WEBGLSTATS = require('webgl-stats');
<script src="unpkg.com/webgl-stats@0.2.0/dist/webgl-stats.js"></script>
webgl-stats
will hook the WebGL1 and WebGL2 automatically, but you should provide your context once you have created it in your app, and before you start using it:
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
WEBGLSTATS.setupExtensions(ctx);
On every frame you should call frameStart
before your render call and frameEnd
after that.
function animate() {
requestAnimationFrame( animate );
WEBGLSTATS.frameStart();
render();
WEBGLSTATS.frameEnd();
showStats();
}
After that you could query the current frame data or the accumulated stats:
getCurrentData()
:{
"numDrawCalls": 0,
"numDrawArraysCalls": 0,
"numDrawArraysInstancedCalls": 0,
"numDrawElementsCalls": 0,
"numDrawElementsInstancedCalls": 0,
"numUseProgramCalls": 0,
"numFaces": 0,
"numVertices": 0,
"numPoints": 0,
"numBindTextures": 0
}
getSummary()
:{
"drawCalls": {
"min": 0,
"max": 0,
"avg": 0,
"standard_deviation": 0
},
"useProgramCalls": {
"min": 0,
"max": 0,
"avg": 0,
"standard_deviation": 0
},
"faces": {
"min": 0,
"max": 0,
"avg": 0,
"standard_deviation": 0
},
"vertices": {
"min": 0,
"max": 0,
"avg": 0,
"standard_deviation": 0
},
"bindTextures": {
"min": 0,
"max": 0,
"avg": 0,
"standard_deviation": 0
}
}
FAQs
WebGL stats
The npm package webgl-stats receives a total of 8 weekly downloads. As such, webgl-stats popularity was classified as not popular.
We found that webgl-stats demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.