com.jme.renderer.lwjgl
Class LWJGLTextureRenderer

java.lang.Object
  extended by com.jme.renderer.lwjgl.LWJGLTextureRenderer
All Implemented Interfaces:
TextureRenderer

public class LWJGLTextureRenderer
extends java.lang.Object
implements TextureRenderer

This class is used by LWJGL to render textures. Users should not create this class directly. Instead, allow DisplaySystem to create it for you.

Version:
$Id: LWJGLTextureRenderer.java,v 1.50 2007/11/05 01:51:54 renanse Exp $
Author:
Joshua Slack, Mark Powell
See Also:
DisplaySystem.createTextureRenderer(int, int, com.jme.renderer.TextureRenderer.Target)

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.jme.renderer.TextureRenderer
TextureRenderer.Target
 
Constructor Summary
LWJGLTextureRenderer(int width, int height, LWJGLDisplaySystem display, LWJGLRenderer parentRenderer)
           
 
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 FBO contents to the given Texture.
 ColorRGBA getBackgroundColor()
          getBackgroundColor retrieves the clear color of the current OpenGL context.
 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> toDraw, java.util.ArrayList<Texture> texs)
          render renders a scene.
 void render(java.util.ArrayList<? extends Spatial> toDraw, java.util.ArrayList<Texture> texs, boolean doClear)
          render renders a scene.
 void render(Spatial toDraw, Texture tex)
          render renders a scene.
 void render(Spatial toDraw, Texture tex, boolean doClear)
          render renders a scene.
 void setBackgroundColor(ColorRGBA c)
          setBackgroundColor sets the OpenGL clear color to the color specified.
 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 new Texture object for use with TextureRenderer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LWJGLTextureRenderer

public LWJGLTextureRenderer(int width,
                            int height,
                            LWJGLDisplaySystem display,
                            LWJGLRenderer parentRenderer)
Method Detail

isSupported

public 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.

Specified by:
isSupported in interface TextureRenderer
Returns:
if this graphics card supports pbuffers or not.

getCamera

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

Specified by:
getCamera in interface TextureRenderer
Returns:
the camera this renderer is using.

setCamera

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

Specified by:
setCamera in interface TextureRenderer
Parameters:
camera - the camera this renderer should use.

setBackgroundColor

public void setBackgroundColor(ColorRGBA c)
setBackgroundColor sets the OpenGL clear color to the color specified.

Specified by:
setBackgroundColor in interface TextureRenderer
Parameters:
c - the color to set the background color to.
See Also:
TextureRenderer.setBackgroundColor(com.jme.renderer.ColorRGBA)

getBackgroundColor

public ColorRGBA getBackgroundColor()
getBackgroundColor retrieves the clear color of the current OpenGL context.

Specified by:
getBackgroundColor in interface TextureRenderer
Returns:
the current clear color.
See Also:
Renderer.getBackgroundColor()

setupTexture

public void setupTexture(Texture2D tex)
setupTexture initializes a new Texture object for use with TextureRenderer. Generates a valid OpenGL texture id for this texture and initializes the data type for the texture.

Specified by:
setupTexture in interface TextureRenderer
Parameters:
tex - The texture to setup for use in Texture Rendering.

render

public void render(Spatial toDraw,
                   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.

Specified by:
render in interface TextureRenderer
Parameters:
toDraw - the scene to render.
tex - the Texture(s) to render it to.

render

public void render(Spatial toDraw,
                   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.

Specified by:
render in interface TextureRenderer
Parameters:
toDraw - the scene to render.
tex - the Texture(s) to render it to.

render

public void render(java.util.ArrayList<? extends Spatial> toDraw,
                   java.util.ArrayList<Texture> texs)
Description copied from interface: TextureRenderer
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.

Specified by:
render in interface TextureRenderer
Parameters:
toDraw - an array of Spatials to render.
texs - the Texture to render it to.

render

public void render(java.util.ArrayList<? extends Spatial> toDraw,
                   java.util.ArrayList<Texture> texs,
                   boolean doClear)
Description copied from interface: TextureRenderer
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.

Specified by:
render in interface TextureRenderer
Parameters:
toDraw - an array of Spatials to render.
texs - the Texture to render it to.

copyToTexture

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

Specified by:
copyToTexture in interface TextureRenderer
Parameters:
tex - The Texture to copy into.
width - the width of the texture image
height - the height of the texture image

cleanup

public void cleanup()
Description copied from interface: TextureRenderer
Any wrapping up and cleaning up of TextureRenderer information is performed here.

Specified by:
cleanup in interface TextureRenderer

getWidth

public int getWidth()
Specified by:
getWidth in interface TextureRenderer

getHeight

public int getHeight()
Specified by:
getHeight in interface TextureRenderer

setMultipleTargets

public void setMultipleTargets(boolean multi)
Description copied from interface: TextureRenderer
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.

Specified by:
setMultipleTargets in interface TextureRenderer
Parameters:
multi - true if you plan to use this texture renderer to render different content to more than one texture.