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.

Using show() with multiple renderers

See original GitHub issue

I have a plotter initialized as:

vp1 = vedo.Plotter(shape=(3,5), axes=0)

I’ve added meshes and spheres to these and they display fine. Now, I have a loop where I’m updating the positions of these spheres. At the end of the update, I want to redraw all the renderers. If I try:

vp1.show(interactive=False, at=0, resetcam=False)

the camera control(by mouse) works, but the 0th renderer has ALL the spheres in(ie the ones I created in other renderers):

image

Instead, if I update the show command to:

vp1.show()

Now the number of spheres is correct, but I cannot move the camera. image

I’m running the latest dev build(was trying to follow the examples but it seems some of them conform to the latest build, and some to an older version of the library). Here is the complete source code:

import vedo
from random import random

# this is one instance of the class Plotter with 3 rows and 5 columns
vp1 = vedo.Plotter(shape=(3,5), axes=0)

for i in range(15):
    vp1.show(str(i),at=i)

class Particle:
    def __init__(self, at):
        global vp1
        self.p = vedo.vector((0.0, 0.0, 0.0))
        self.vsphere = vedo.Sphere(self.p, r=0.1, c='red')
        vp1.add(self.vsphere, at=at)
    
    def update(self):
        self.vsphere.pos(self.p)


particles = []
for d in range(15):
    for i in range(5):
        particles.append(Particle(at=d))

while True:
    for particle in particles:
        particle.p[0] += (random()-0.5)*0.2
        particle.update()

    # I can control the camera fine, but the 0-th renderer has ALL the particles, not
    # just the ones that were added to it.
    # vp1.show(interactive=False, at=0, resetcam=False)

    # This version will render correctly, but I cannot control the camera with the mouse
    vp1.show()

Basically, I want to update the positions of spheres in all the renderers, while continuing to be able to interactively adjust the view with the mouse. How do I accomplish this?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
marcomusycommented, Feb 22, 2021

maybe you just missed: vp1 = vedo.Plotter(size=(2000,500), interactive=False)

otherwise your script works fine on my pc…

PS: you can press q otherwise to exit interactivity and let the script continue.

2reactions
medakkcommented, Feb 22, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Rendering multiple scenes same renderer - javascript
Show activity on this post. Adding scene2 to the renderer is overwriting scene1. I believe the renderer can only handle one scene.
Read more >
How to use multiple renderers? — DataTables forums
The primary issue is that you were using $.fn.dataTable.render.colorNegative() , but $.fn.dataTable.render.colorNegative is in fact the renderer ...
Read more >
Three.js Multiple Canvases Multiple Scenes
We make a single Renderer and then one Scene for each virtual canvas. We'll then check the positions of the virtual canvas elements...
Read more >
sliders with multiple windows #527 - marcomusy/vedo - GitHub
I want the slider 'on top' of the two windows like in this sketch. ... In order to choose on which renderer you...
Read more >
vedo.plotter API documentation
Number of sub-render windows inside of the main window. E.g.: specify two across with shape=(2,1) and a two by two grid with shape=(2,...
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