Tips for Verge3D devs

From Verge3D Wiki
Jump to navigationJump to search

This page contains random tips and code snippets that Verge3D devs or Verge3D DevKit users may find useful for their work.

Getting v3d namespace from iframe


e.g. to print performance profile from the iframe:


or to enable FPS counter:


Debugging Verge3D render target

Use the following code to create a plane with the output of the given render target:

var texture = renderTarget.texture
var geometry = new v3d.PlaneBufferGeometry(3, 3);
var material = new v3d.MeshBasicMaterial(); = texture;
var planeMesh = new v3d.Mesh(geometry, material);
planeMesh.position.x = 6;

Code Indentation Style

The K&R style, 4 spaces:

function someFun() {
    const someConst = 10;
    const alwaysTrue = true;

    for (let i = 0; i < someConst; i++) {
        if (alwaysTrue) {
            console.log(`Hello ${i}!`);

Key Triplets

There are several key triplets supported by Verge3D which are useful for debugging. To execute a triplet, wait until a Verge3D app finishes its loading, then press the same key thrice very quickly.

  • PPP — print performance profile. See here for more info.
  • FFF — show/hide FPS counter in the upper left corner of the rendered canvas.
  • HHH — halt/continue application rendering.

Short Links

These short links can be very helpful for debugging mobile devices.

App Manager undocumented features

Restoring console functions

const i = document.createElement('iframe'); = 'none';
window.console = i.contentWindow.console;

Downloading Electron builds

gh release download v19.0.4 -D v19.0.4 -p 'electron-*' -p 'electron-*' -p 'SHASUMS256.txt' -R electron/electron

Install Python packages to local directory

pip install --target=dir_name package_name