com.jme.renderer
Interface TextureRenderer

All Known Implementing Classes:
JOGLTextureRenderer, LWJGLPbufferTextureRenderer, LWJGLTextureRenderer

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 typically handled via a call to a DisplaySystem subclass. Example Usage:
NOTE: This example uses the DisplaySystem class to obtain the TextureRenderer. DisplaySystem.getDisplaySystem().createTextureRenderer(...)

Version:
$Id: TextureRenderer.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Joshua Slack
See Also:
DisplaySystem

Nested Class Summary
static class TextureRenderer.Target
           
 
Method Summary
 void cleanup()
          Any wrapping up and cleaning up of TextureRenderer information is performed here.
 void copyToTexture(Texture tex, int width, int height)
          copyToTexture copies the current frame buffer contents to the given Texture.
 ColorRGBA getBackgroundColor()
          getBackgroundColor retrieves the color used for the window background.
 Camera getCamera()
          getCamera retrieves the camera this renderer is using.
 int getHeight()
           
 int getWidth()
           
 boolean isSupported()
          isSupported obtains the capability of the graphics card.
 void render(java.util.ArrayList<? extends Spatial> spats, java.util.ArrayList<Texture> tex)
          render renders a scene.
 void render(java.util.ArrayList<? extends Spatial> spats, java.util.ArrayList<Texture> tex, boolean doClear)
          render renders a scene.
 void render(Spatial spat, Texture tex)
          render renders a scene.
 void render(Spatial spat, Texture tex, boolean doClear)
          render renders a scene.
 void setBackgroundColor(ColorRGBA c)
          setBackgroundColor sets the color of window.
 void setCamera(Camera camera)
          setCamera sets the camera this renderer should use.
 void setMultipleTargets(boolean multi)
          Set up this textureRenderer for use with multiple targets.
 void setupTexture(Texture2D tex)
          setupTexture initializes a Texture object for use with TextureRenderer.
 

Method Detail

isSupported

boolean isSupported()
isSupported obtains the capability of the graphics card. If the graphics card does not have pbuffer support, false is returned, otherwise, true is returned. TextureRenderer will not process any scene elements if pbuffer is not supported.

Returns:
if this graphics card supports pbuffers or not.

getCamera

Camera getCamera()
getCamera retrieves the camera this renderer is using.

Returns:
the camera this renderer is using.

setCamera

void setCamera(Camera camera)
setCamera sets the camera this renderer should use.

Parameters:
camera - the camera this renderer should use.

render

void render(Spatial spat,
            Texture tex)
render renders a scene. As it recieves a base class of Spatial the renderer hands off management of the scene to spatial for it to determine when a Geometry leaf is reached. The result of the rendering is then copied into the given texture(s). What is copied is based on the Texture object's rttSource field. 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.
tex - the Texture to render it to.

render

void render(Spatial spat,
            Texture tex,
            boolean doClear)
render renders a scene. As it recieves a base class of Spatial the renderer hands off management of the scene to spatial for it to determine when a Geometry leaf is reached. The result of the rendering is then copied into the given texture(s). What is copied is based on the Texture object's rttSource field. 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.
tex - the Texture to render it to.

render

void render(java.util.ArrayList<? extends Spatial> spats,
            java.util.ArrayList<Texture> tex)
render renders a scene. As it recieves a base class of Spatial the renderer hands off management of the scene to spatial for it to determine when a Geometry leaf is reached. The result of the rendering is then copied into the given textures. What is copied is based on the Texture object's rttSource field. 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 it to.

render

void render(java.util.ArrayList<? extends Spatial> spats,
            java.util.ArrayList<Texture> tex,
            boolean doClear)
render renders a scene. As it recieves a base class of Spatial the renderer hands off management of the scene to spatial for it to determine when a Geometry leaf is reached. The result of the rendering is then copied into the given textures. What is copied is based on the Texture object's rttSource field. 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 it to.

setBackgroundColor

void setBackgroundColor(ColorRGBA 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

ColorRGBA getBackgroundColor()
getBackgroundColor retrieves the color used for the window background.

Returns:
the background color that is currently set to the background.

setupTexture

void setupTexture(Texture2D 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 pbuffer size. Note that the pbuffer size is not necessarily what is specified in the constructor.

Parameters:
tex - The texture to setup for use in Texture Rendering.

copyToTexture

void copyToTexture(Texture tex,
                   int width,
                   int height)
copyToTexture copies the current frame buffer contents to the given Texture. What is copied is up to the Texture object's rttSource field.

Parameters:
tex - The Texture to copy into.
width - the width of the texture image
height - the height of the texture image

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()