question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scene.capture() does not include labels

See original GitHub issue

The function scene.capture(filename) does not consider labels.

Execute the following code in a jupyter notebook:

from vpython import *
sphere()
label(text='TEXT')
scene.capture('image.png')
Expected output Actually saved
image.png image.png

I noticed that there are two canvas elements in the HTML, one containing the labels, and the other being a placeholder for the 3D objects:

<div class="glowscript-canvas-wrapper ui-resizable" style="display: inline-block; position: relative; float: none;">
    <canvas style="position: absolute;" width="640" height="400"></canvas>
    <canvas style="position: relative; background-color: transparent;" width="640" height="400"></canvas>
    <div class="ui-resizable-handle ui-resizable-e" style="z-index: 90;"></div>
    <div class="ui-resizable-handle ui-resizable-s" style="z-index: 90;"></div>
    <div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 90;"></div>
</div>

It seems that the capturing function here only considers one of them.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
BruceSherwoodcommented, May 15, 2021

I tried your code with GlowScript VPython 3.2dev, and it hangs for me on this statement:

await new Promise(r => img.onload=r); // wait for image to be loaded

??

0reactions
eltoscommented, May 15, 2021

You can replace the line with await img.decode();, which is essentially the same (it returns a promise) but should handle either case. I added a second commit to the merge request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to capture an output image generated by the box function ...
I want to capture the output image rendered by the display() function as a .png file. I am using scene.capture('test4312'). But getting an...
Read more >
When using the scenecapture2d to send a texture render ...
When using the scene capture 2d as a spout source the colours are darker as shown in the attached image. I've tried setting...
Read more >
Scene Capture Component not capturing Lumen Global ...
As the title states, I can't seem to get a Scence Capture component to work with Lumen. It seems to only capture Screen...
Read more >
Scene Capture 2D no longer working in 4.27 - Oculus Forum
I recently updated my project from 4.26 to 4.27 and now I cannot get any of my scene capture 2d components to capture...
Read more >
Style point layers—ArcGIS Online Help | Documentation
Choose styles for points in scenes. ... Markers under Icons do not include outline options. Click Outline transparency to set the transparency with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found