pbfy0 / visvis

Automatically exported from code.google.com/p/visvis
Other
0 stars 0 forks source link

getframe() returns image from most recently drawn figure #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
getframe() copies pixels from gl.GL_FRONT, which apparently refers to the last 
buffer drawn into.  Thus, getframe always returns images from the last figure 
drawn into, even if another figure is specified by its argument.  (This is 
easily seen by calling screenshot() on different figures.)

This can be fixed by adding the line "ob.getFigure()._widget.set_current()" to 
the beginning of getframe().  If this is the best solution, I can push a patch. 
 But maybe there's a better way to handle this through GL.

Original issue reported on code.google.com by rschr...@gmail.com on 25 Jul 2011 at 3:54

GoogleCodeExporter commented 9 years ago
Wow, weird that this was not detected earlier. The code to select the right 
figure is really simply missing from the function.

Make that:

# Get figure
fig = ob.GetFigure()
if not fig:
  raise ValueError('Object is not present in any alive figures.')

# Select the figure
fig._SetCurrent() # works on all backends

Original comment by almar.klein@gmail.com on 25 Jul 2011 at 9:20

GoogleCodeExporter commented 9 years ago
Let me just push this.

Original comment by almar.klein@gmail.com on 25 Jul 2011 at 9:40