Skip to content
Snippets Groups Projects
Commit 2795af8c authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Fixed overlay flickering issue on movie mode (and on any other image

texture changes).
parent aeeaac98
No related branches found
No related tags found
No related merge requests found
......@@ -741,6 +741,15 @@ class LightBoxCanvas(slicecanvas.SliceCanvas):
if not self._setGLContext():
return
overlays = self.displayCtx.getOrderedOverlays()
globjs = [self._glObjects.get(o, None) for o in overlays]
globjs = [g for g in globjs if g is not None]
# Skip the render if any GLObjects are not
# ready - see comments in SliceCanvas._draw.
if any([not g.ready() for g in globjs]):
return
if self.renderMode == 'offscreen':
log.debug('Rendering to off-screen texture')
......@@ -770,12 +779,12 @@ class LightBoxCanvas(slicecanvas.SliceCanvas):
endSlice = self._nslices
# Draw all the slices for all the overlays.
for overlay in self.displayCtx.getOrderedOverlays():
for overlay, globj in zip(overlays, globjs):
display = self.displayCtx.getDisplay(overlay)
globj = self._glObjects.get(overlay, None)
if (globj is None) or (not globj.ready()) or (not display.enabled):
if not display.enabled:
continue
log.debug('Drawing {} slices ({} - {}) for '
......
......@@ -1202,31 +1202,38 @@ class SliceCanvas(props.HasProperties):
if not self._setGLContext():
return
overlays = self.displayCtx.getOrderedOverlays()
globjs = [self._glObjects.get(o, None) for o in overlays]
# If an overlay does not yet have a corresponding
# GLObject, we presume that it hasn't been created
# yet (and that the __genGLObject method is on the
# case).
globjs = [g for g in globjs if g is not None]
# Do not draw anything if some globjects
# are not ready. This is because, if a
# GLObject was drawn, but is now temporarily
# not ready (e.g. it has an image texture
# that is being asynchronously refreshed),
# drawing the scene now would cause
# flickering of that GLObject.
if any([not g.ready() for g in globjs]):
return
# Set the viewport to match the current
# display bounds and canvas size
if self.renderMode is not 'offscreen':
self._setViewport()
glroutines.clear(self.bgColour)
for overlay in self.displayCtx.getOrderedOverlays():
for overlay, globj in zip(overlays, globjs):
display = self.displayCtx.getDisplay(overlay)
opts = display.getDisplayOpts()
globj = self._glObjects.get(overlay, None)
if not display.enabled:
continue
if globj is None:
# The GLObject has not been created
# yet - we assume here that the
# __genGLObject method is on the case
continue
# The GLObject is not ready
# to be drawn yet.
if not globj.ready():
continue
# On-screen rendering - the globject is
# rendered directly to the screen canvas
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment