fsleyes.gl.textures.rendertexturestack
¶
This module provides the RenderTextureStack
class, which is used
by the SliceCanvas
class to store a collection of off-screen
RenderTexture
instances containing rendered slices of
GLObject
instances.
-
class
fsleyes.gl.textures.rendertexturestack.
RenderTextureStack
(globj)¶ Bases:
object
The
RenderTextureStack
class creates and maintains a collection ofRenderTexture
instances, each of which is used to display a single slice of aGLObject
along a specific display axis.The purpose of the
RenderTextureStack
is to pre-generate 2D slices of aGLObject
so that they do not have to be rendered on-demand. Rendering aGLObject
slices from a pre-generated off-screen texture provides better performance than rendering theGLObject
slice in real time.The
RenderTexture
textures are updated in an idle loop, via theidle.idle()
function.Note
A
RenderTextureStack
instance must be manually updated whenever itsGLObject
changes, via theonGLObjectUpdate()
method.RenderTextureStack
instances do not explicitly listen forGLObject
changes themselves, because there is no guarantee that the textures will be refreshed before they need to be drawn.-
__init__
(globj)¶ Create a
RenderTextureStack
. An update listener is registered on theGLObject
, so that the textures can be refreshed whenever it changes.Parameters: globj – The GLObject
instance.
-
__del__
()¶ Prints a log message.
-
destroy
()¶ Must be called when this
RenderTextureStack
is no longer needed. Calls the__destroyTextures()
method.
-
draw
(zpos, xform=None)¶ Draws the pre-generated
RenderTexture
which corresponds to the specified Z position.Parameters: - zpos – Position of slice to render.
- xform – Transformation matrix to apply to rendered slice vertices.
-
setAxes
(xax, yax)¶ This method must be called when the display orientation of the
GLObject
changes. It destroys and re-creates allRenderTexture
instances.
-
onGLObjectUpdate
()¶ Must be called called when the
GLObject
display is updated. Re-calculates the display space Z-axis range, and marks all render textures as dirty.
-
_RenderTextureStack__destroyTextures
()¶ Destroys all
RenderTexture
instances. This is performed asynchronously, via theidle.idle
function.
-
_RenderTextureStack__indexToZpos
(index)¶ Converts a
RenderTexture
index into a Z location in the display coordinate system.
-
_RenderTextureStack__refreshAllTextures
(*a)¶ Marks all
RenderTexture
instances as dirty, so that they will be refreshed by the__textureUpdateLoop()
.
-
_RenderTextureStack__refreshTexture
(tex, idx)¶ Refreshes the given
RenderTexture
.Parameters: - tex – The
RenderTexture
to refresh. - idx – Index of the
RenderTexture
.
- tex – The
-
_RenderTextureStack__textureUpdateLoop
()¶ This method is called via the
idle.idle()
function. It loops through allRenderTexture
instances, and refreshes any that have been marked as dirty.Each call to this method causes one
RenderTexture
to be refreshed. After aRenderTexture
has been refreshed, if there are dirty moreRenderTexture
instances, this method re-schedules itself to be called again viaidle.idle()
.
-
_RenderTextureStack__zposToIndex
(zpos)¶ Converts a Z location in the display coordinate system into a
RenderTexture
index.
-
__dict__
= mappingproxy({'__module__': 'fsleyes.gl.textures.rendertexturestack', '__doc__': 'The ``RenderTextureStack`` class creates and maintains a collection of\n :class:`.RenderTexture` instances, each of which is used to display a\n single slice of a :class:`.GLObject` along a specific display axis.\n\n The purpose of the ``RenderTextureStack`` is to pre-generate 2D slices of\n a :class:`.GLObject` so that they do not have to be rendered on-demand.\n Rendering a ``GLObject`` slices from a pre-generated off-screen texture\n provides better performance than rendering the ``GLObject`` slice\n in real time.\n\n The :class:`.RenderTexture` textures are updated in an idle loop, via the\n :func:`.idle.idle` function.\n\n\n .. note:: A ``RenderTextureStack`` instance must be manually updated\n whenever its ``GLObject`` changes, via the\n :meth:`onGLObjectUpdate` method. ``RenderTextureStack``\n instances do not explicitly listen for ``GLObject`` changes\n themselves, because there is no guarantee that the textures\n will be refreshed before they need to be drawn.\n ', '__init__': <function RenderTextureStack.__init__>, '__del__': <function RenderTextureStack.__del__>, 'destroy': <function RenderTextureStack.destroy>, 'getGLObject': <function RenderTextureStack.getGLObject>, 'draw': <function RenderTextureStack.draw>, 'setAxes': <function RenderTextureStack.setAxes>, '_RenderTextureStack__destroyTextures': <function RenderTextureStack.__destroyTextures>, 'onGLObjectUpdate': <function RenderTextureStack.onGLObjectUpdate>, '_RenderTextureStack__refreshAllTextures': <function RenderTextureStack.__refreshAllTextures>, '_RenderTextureStack__textureUpdateLoop': <function RenderTextureStack.__textureUpdateLoop>, '_RenderTextureStack__refreshTexture': <function RenderTextureStack.__refreshTexture>, '_RenderTextureStack__zposToIndex': <function RenderTextureStack.__zposToIndex>, '_RenderTextureStack__indexToZpos': <function RenderTextureStack.__indexToZpos>, '__dict__': <attribute '__dict__' of 'RenderTextureStack' objects>, '__weakref__': <attribute '__weakref__' of 'RenderTextureStack' objects>})¶
-
__module__
= 'fsleyes.gl.textures.rendertexturestack'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-