Interface TextureRenderer

All Known Implementing Classes:
AbstractFBOTextureRenderer, AbstractPbufferTextureRenderer, JoglPbufferTextureRenderer, JoglTextureRenderer

public interface TextureRenderer
TextureRenderer defines an abstract class that handles rendering a scene to a buffer and copying it to a texture. Creation of this object is usually handled via a TextureRendererFactory. Note that currently, only Texture2D is supported by Pbuffer versions of this class. Texture2D and TextureCubeMap are supported in FBO mode.
  • Method Details

    • getCamera

      Camera getCamera()
      getCamera retrieves the camera this renderer is using.
      Returns:
      the camera this renderer is using.
    • render

      void render(Scene scene, Texture tex, int clear)
      Parameters:
      scene - the scene to render.
      tex - the Texture to render to. This should be a Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.
      clear - which buffers to clear before rendering, if any.
      See Also:
    • render

      void render(Scene scene, List<Texture> texs, int clear)
      NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.
      Parameters:
      scene - the scene to render.
      texs - a list of Textures to render to. These should be of type Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.
      clear - which buffers to clear before rendering, if any.
      See Also:
    • render

      void render(Spatial spat, Texture tex, int clear)
      Parameters:
      spat - the scene to render.
      tex - the Texture to render to. This should be a Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.
      clear - which buffers to clear before rendering, if any.
      See Also:
    • render

      void render(Spatial spat, List<Texture> texs, int clear)
      NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.
      Parameters:
      spat - the scene to render.
      texs - a list of Textures to render to. These should be of type Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.
      clear - which buffers to clear before rendering, if any.
      See Also:
    • render

      void render(List<? extends Spatial> spats, Texture tex, int clear)
      NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.
      Parameters:
      spats - an array of Spatials to render.
      tex - the Texture to render to. This should be a Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.
      clear - which buffers to clear before rendering, if any.
      See Also:
    • render

      void render(List<? extends Spatial> spats, List<Texture> texs, int clear)
      NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.
      Parameters:
      spats - an array of Spatials to render.
      texs - a list of Textures to render to. These should be of type Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.
      clear - which buffers to clear before rendering, if any.
      See Also:
    • setBackgroundColor

      void setBackgroundColor(ReadOnlyColorRGBA c)
      setBackgroundColor sets the color of window. This color will be shown for any pixel that is not set via typical rendering operations.
      Parameters:
      c - the color to set the background to.
    • getBackgroundColor

      ReadOnlyColorRGBA getBackgroundColor()
      getBackgroundColor retrieves the color used for the window background.
      Returns:
      the background color that is currently set to the background.
    • setupTexture

      void setupTexture(Texture tex)
      setupTexture initializes a Texture object for use with TextureRenderer. Generates a valid gl texture id for this texture and sets up data storage for it. The texture will be equal to the texture renderer's size. Note that the texture renderer's size is not necessarily what is specified in the constructor.
      Parameters:
      tex - The texture to setup for use in Texture Rendering. This should be of type Texture2D or TextureCubeMap.
    • copyToTexture

      void copyToTexture(Texture tex, int x, int y, int width, int height, int xoffset, int yoffset)
      copyToTexture copies the current frame buffer contents to the given Texture. What is copied is based on the rttFormat of the texture object when it was setup. Note that the contents are copied with no scaling applied, so the texture must be big enough such that xoffset + width <= texture's width and yoffset + height <= texture's height.
      Parameters:
      tex - The Texture to copy into. This should be a Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.
      x - the x offset into the framebuffer
      y - the y offset into the framebuffer
      width - the width of the rectangle to read from the framebuffer and copy 1:1 to the texture
      height - the width of the rectangle to read from the framebuffer and copy 1:1 to the texture
      xoffset - the x offset into the texture to draw at
      yoffset - the y offset into the texture to draw at
    • cleanup

      void cleanup()
      Any wrapping up and cleaning up of TextureRenderer information is performed here.
    • setMultipleTargets

      void setMultipleTargets(boolean multi)
      Set up this textureRenderer for use with multiple targets. If you are going to use this texture renderer to render to more than one texture, call this with true.
      Parameters:
      multi - true if you plan to use this texture renderer to render different content to more than one texture.
    • getWidth

      int getWidth()
    • getHeight

      int getHeight()
    • enforceState

      void enforceState(RenderState state)
      Enforce a particular state whenever this texture renderer is used. In other words, the given state will override any state of the same type set on a scene object rendered with this texture renderer.
      Parameters:
      state - state to enforce
    • enforceStates

      void enforceStates(EnumMap<RenderState.StateType,RenderState> states)
    • clearEnforcedState

      void clearEnforcedState(RenderState.StateType type)
      Parameters:
      type - state type to clear
    • clearEnforcedStates

      void clearEnforcedStates()
      Clear all enforced states on this texture renderer.