Skip to content

Complete capture programmatically? #293

Description

@donmccurdy

Hi! I've used SpectorJS often in interactive contexts where there's a running frameloop, and I click things in the UI to start a capture and reload the page. It's enormously useful!

Today I'm trying to debug failures in a testing scaffold with many WebGL contexts, and having trouble getting SpectorJS to capture events for the correct canvas during the test period. For various reasons I think I need to do this entirely programmatically — no clicking in the UI — and while I've been trying to follow the basic usage I'm having trouble getting results.

My code looks like this:

  const spector = new SPECTOR.Spector();

  const canvas = document.createElement('canvas');
  canvas.id = 'my-canvas';
  canvas.width = canvas.height = 1;
  document.body.appendChild(canvas);

  // <create webgl context>
  
  spector.displayUI();
  spector.startCapture(canvas);

  // <call gl.drawArrays> 

  spector.stopCapture();

Immediately I see this:

please select a canvas

And a few seconds later it updates to:

no frames detected

The canvas I originally captured is listed in the dropdown, but doesn't appear to be selected, and no results are coming up. Am I doing this incorrectly, or is this something where a minimal reproducible example would be helpful?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions