com.jme.system.dummy
Class DummyRenderer

java.lang.Object
  extended by com.jme.renderer.Renderer
      extended by com.jme.system.dummy.DummyRenderer

public final class DummyRenderer
extends Renderer

This class makes up a shell renderer with no functionality. It is here to allow the easy creation of renderer-agnostic jME objects (like various RenderState and Spatial) so that they can be used by conversion utilities to read/write jME. It is NOT to be used for rendering as it won't do anything at all.

Version:
$Id: DummyRenderer.java 4189 2009-03-26 00:33:51Z mulova $

Nested Class Summary
(package private)  class DummyRenderer.TextureStateN
           
 
Field Summary
 
Fields inherited from class com.jme.renderer.Renderer
backgroundColor, camera, defaultStateList, height, processingQueue, queue, QUEUE_INHERIT, QUEUE_OPAQUE, QUEUE_ORTHO, QUEUE_SKIP, QUEUE_TRANSPARENT, width
 
Constructor Summary
DummyRenderer()
           
 
Method Summary
 boolean checkAndAdd(Spatial s)
          Check a given Spatial to see if it should be queued.
 void checkCardError()
          Check the underlying rendering system (opengl, etc.) for exceptions.
 void cleanup()
          Perform any necessary cleanup operations such as deleting VBOs, etc.
 void clearBuffers()
          clearBuffers clears both the depth buffer and the back buffer.
 void clearColorBuffer()
          clearBackBuffer clears the back buffer of the renderer.
 void clearPolygonOffset()
          Removes any previously set offset from the renderer.
 void clearStencilBuffer()
          clearStencilBuffer clears the stencil buffer of the renderer.
 void clearStrictBuffers()
          clearBuffers clears both the depth buffer and the back buffer restricting the clear to the rectangle defined by the width and height of the renderer.
 void clearVBOCache()
          Clears all entries from the VBO cache.
 void clearZBuffer()
          clearZBuffer clears the depth buffer of the renderer.
 BlendState createBlendState()
          createBlendState retrieves the blend state object for the proper renderer.
 Camera createCamera(int width, int height)
          createCamera retrieves a default camera for this renderer.
 ClipState createClipState()
          Retrieves the clip state object for the proper renderer.
 ColorMaskState createColorMaskState()
          Retrieves the color mask state object for the proper renderer.
 CullState createCullState()
          createCullState retrieves the cull state object for the proper renderer.
 int createDisplayList(Geometry g)
          Generate a DisplayList for drawing the given Geometry.
 FogState createFogState()
          createFogState retrieves the fog state object for the proper renderer.
 FragmentProgramState createFragmentProgramState()
          Retrieves the fragment program state object for the proper renderer.
 GLSLShaderObjectsState createGLSLShaderObjectsState()
          createShaderObjectsState retrieves the shader object state object for the proper renderer.
 LightState createLightState()
          createLightState retrieves the light state object for the proper renderer.
 StateRecord createLineRecord()
           
 MaterialState createMaterialState()
          createMaterialState retrieves the material state object for the proper renderer.
 StateRecord createRendererRecord()
           
 ShadeState createShadeState()
          createShadeState retrieves the shade state object for the proper renderer.
 StencilState createStencilState()
          Retrieves the stencil state object for the proper renderer.
 StippleState createStippleState()
          Retrieves the stipple state object for the proper renderer.
 TextureState createTextureState()
          createTextureState retrieves the texture state object for the proper renderer.
 VertexProgramState createVertexProgramState()
          Retrieves the vertex program state object for the proper renderer.
 WireframeState createWireframeState()
          createWireframeState retrieves the wireframe state object for the proper renderer.
 ZBufferState createZBufferState()
          Retrieves the Z buffer state object for the proper renderer.
 void deleteVBO(java.nio.Buffer buffer)
          Checks the VBO cache to see if this Buffer is mapped to a VBO-id.
 void deleteVBO(int vboid)
          Attempts to delete the VBO with this VBO id.
 void displayBackBuffer()
          displayBackBuffer swaps the back buffer with the currently displayed buffer.
 void draw(Curve c)
          draw renders a curve to the back buffer.
 void draw(Line line)
          draw renders a single Line collection to the back buffer.
 void draw(Point point)
          draw renders a single Point collection to the back buffer.
 void draw(QuadMesh qMesh)
          draw renders a single QuadMesh to the back buffer.
 void draw(Spatial s)
          draw renders a scene.
 void draw(Text t)
          draw renders text to the back buffer.
 void draw(TriMesh tMesh)
          draw renders a single TriMesh to the back buffer.
 void finish()
          finish is similar to flush, however it blocks until all waiting OpenGL commands have been finished.
 void flush()
          flush tells opengl to send through all currently waiting commands in the buffer.
 ColorRGBA getBackgroundColor()
          getBackgroundColor retrieves the clear color of the current OpenGL context.
 int getHeight()
          Retrieve the height set on this renderer.
 RenderQueue getQueue()
          Get the render queue associated with this Renderer.
 int getWidth()
          Retrieve the width set on this renderer.
 void grabScreenContents(java.nio.ByteBuffer buff, Image.Format format, int x, int y, int w, int h)
          grabScreenContents reads a block of data as bytes from the current framebuffer.
 boolean isHeadless()
          See Renderer.isHeadless()
 boolean isInOrthoMode()
           
 boolean isProcessingQueue()
          Return true if this renderer is in the middle of processing its RenderQueue.
 void reinit(int width, int height)
          Reinitialize the renderer with the given width/height.
 void releaseDisplayList(int listId)
          Releases a DisplayList from the card.
 java.lang.Integer removeFromVBOCache(java.nio.Buffer buffer)
          Removes the mapping between this Buffer and it's VBO-id.
 void setBackgroundColor(ColorRGBA c)
          setBackgroundColor sets the color of window.
 void setCamera(Camera camera)
          setCamera sets the reference to the applications camera object.
 void setHeadless(boolean headless)
          See Renderer.setHeadless()
 void setOrtho()
          setOrtho sets the display system to be in orthographic mode.
 void setOrthoCenter()
          setOrthoCenter sets the display system to be in orthographic mode.
 void setPolygonOffset(float factor, float offset)
          Sets an offset to the zbuffer to be used when comparing an incoming polygon for depth buffer pass/fail.
 boolean supportsVBO()
          Return true if the system running this supports VBO
 boolean takeScreenShot(java.lang.String filename)
          takeScreenShot saves the current buffer to a png file.
 void unsetOrtho()
          unsetOrhto unsets the display system from orthographic mode back into regular projection mode.
 void updateTextureSubImage(Texture dstTexture, int dstX, int dstY, Image srcImage, int srcX, int srcY, int width, int height)
          Updates a region of the content area of the provided texture using the specified region of the given data.
 
Methods inherited from class com.jme.renderer.Renderer
clearQueue, createState, createState, getCamera, renderQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyRenderer

public DummyRenderer()
Method Detail

setCamera

public void setCamera(Camera camera)
Description copied from class: Renderer
setCamera sets the reference to the applications camera object.

Specified by:
setCamera in class Renderer
Parameters:
camera - the camera object to use with this Renderer.

createCamera

public Camera createCamera(int width,
                           int height)
Description copied from class: Renderer
createCamera retrieves a default camera for this renderer.

Specified by:
createCamera in class Renderer
Parameters:
width - the width of the frame.
height - the height of the frame.
Returns:
a default camera for this renderer.

createBlendState

public BlendState createBlendState()
Description copied from class: Renderer
createBlendState retrieves the blend state object for the proper renderer.

Specified by:
createBlendState in class Renderer
Returns:
the BlendState object that can make use of the proper renderer.

flush

public void flush()
Description copied from class: Renderer
flush tells opengl to send through all currently waiting commands in the buffer.

Specified by:
flush in class Renderer

finish

public void finish()
Description copied from class: Renderer
finish is similar to flush, however it blocks until all waiting OpenGL commands have been finished.

Specified by:
finish in class Renderer

createCullState

public CullState createCullState()
Description copied from class: Renderer
createCullState retrieves the cull state object for the proper renderer.

Specified by:
createCullState in class Renderer
Returns:
the CullState object that can make use of the proper renderer.

createFogState

public FogState createFogState()
Description copied from class: Renderer
createFogState retrieves the fog state object for the proper renderer.

Specified by:
createFogState in class Renderer
Returns:
the FogState object that can make use of the proper renderer.

createLightState

public LightState createLightState()
Description copied from class: Renderer
createLightState retrieves the light state object for the proper renderer.

Specified by:
createLightState in class Renderer
Returns:
the LightState object that can make use of the proper renderer.

createMaterialState

public MaterialState createMaterialState()
Description copied from class: Renderer
createMaterialState retrieves the material state object for the proper renderer.

Specified by:
createMaterialState in class Renderer
Returns:
the MaterialState object that can make use of the proper renderer.

createShadeState

public ShadeState createShadeState()
Description copied from class: Renderer
createShadeState retrieves the shade state object for the proper renderer.

Specified by:
createShadeState in class Renderer
Returns:
the ShadeState object that can make use of the proper renderer.

createTextureState

public TextureState createTextureState()
Description copied from class: Renderer
createTextureState retrieves the texture state object for the proper renderer.

Specified by:
createTextureState in class Renderer
Returns:
the TextureState object that can make use of the proper renderer.

createWireframeState

public WireframeState createWireframeState()
Description copied from class: Renderer
createWireframeState retrieves the wireframe state object for the proper renderer.

Specified by:
createWireframeState in class Renderer
Returns:
the WireframeState object that can make use of the proper renderer.

createZBufferState

public ZBufferState createZBufferState()
Description copied from class: Renderer
Retrieves the Z buffer state object for the proper renderer.

Specified by:
createZBufferState in class Renderer
Returns:
The ZBufferState object that can make use of the proper renderer.

createVertexProgramState

public VertexProgramState createVertexProgramState()
Description copied from class: Renderer
Retrieves the vertex program state object for the proper renderer.

Specified by:
createVertexProgramState in class Renderer
Returns:
The VertexProgramState object that can make use of the proper renderer.

createFragmentProgramState

public FragmentProgramState createFragmentProgramState()
Description copied from class: Renderer
Retrieves the fragment program state object for the proper renderer.

Specified by:
createFragmentProgramState in class Renderer
Returns:
The VertexProgramState object that can make use of the proper renderer.

createGLSLShaderObjectsState

public GLSLShaderObjectsState createGLSLShaderObjectsState()
Description copied from class: Renderer
createShaderObjectsState retrieves the shader object state object for the proper renderer.

Specified by:
createGLSLShaderObjectsState in class Renderer
Returns:
the ShaderObjectsState object that can make use of the proper renderer.

createStencilState

public StencilState createStencilState()
Description copied from class: Renderer
Retrieves the stencil state object for the proper renderer.

Specified by:
createStencilState in class Renderer
Returns:
The StencilState object that can make use of the proper renderer.

createClipState

public ClipState createClipState()
Description copied from class: Renderer
Retrieves the clip state object for the proper renderer.

Specified by:
createClipState in class Renderer
Returns:
The ClipState object that can make use of the proper renderer.

createColorMaskState

public ColorMaskState createColorMaskState()
Description copied from class: Renderer
Retrieves the color mask state object for the proper renderer.

Specified by:
createColorMaskState in class Renderer
Returns:
The ColorMaskState object that can make use of the proper renderer.

createStippleState

public StippleState createStippleState()
Description copied from class: Renderer
Retrieves the stipple state object for the proper renderer.

Specified by:
createStippleState in class Renderer
Returns:
The StippleState object that can make use of the proper renderer.

setBackgroundColor

public void setBackgroundColor(ColorRGBA c)
Description copied from class: Renderer
setBackgroundColor sets the color of window. This color will be shown for any pixel that is not set via typical rendering operations.

Specified by:
setBackgroundColor in class Renderer
Parameters:
c - the color to set the background to.

getBackgroundColor

public ColorRGBA getBackgroundColor()
Description copied from class: Renderer
getBackgroundColor retrieves the clear color of the current OpenGL context.

Overrides:
getBackgroundColor in class Renderer
Returns:
the current clear color.
See Also:
Renderer.getBackgroundColor()

clearZBuffer

public void clearZBuffer()
Description copied from class: Renderer
clearZBuffer clears the depth buffer of the renderer. The Z buffer allows sorting of pixels by depth or distance from the view port. Clearing this buffer prepares it for the next frame.

Specified by:
clearZBuffer in class Renderer

clearColorBuffer

public void clearColorBuffer()
Description copied from class: Renderer
clearBackBuffer clears the back buffer of the renderer. The backbuffer is the buffer being rendered to before it is displayed to the screen. Clearing this buffer frees it for rendering the next frame.

Specified by:
clearColorBuffer in class Renderer

clearStencilBuffer

public void clearStencilBuffer()
Description copied from class: Renderer
clearStencilBuffer clears the stencil buffer of the renderer.

Specified by:
clearStencilBuffer in class Renderer

clearBuffers

public void clearBuffers()
Description copied from class: Renderer
clearBuffers clears both the depth buffer and the back buffer.

Specified by:
clearBuffers in class Renderer

clearStrictBuffers

public void clearStrictBuffers()
Description copied from class: Renderer
clearBuffers clears both the depth buffer and the back buffer restricting the clear to the rectangle defined by the width and height of the renderer.

Specified by:
clearStrictBuffers in class Renderer

displayBackBuffer

public void displayBackBuffer()
Description copied from class: Renderer
displayBackBuffer swaps the back buffer with the currently displayed buffer. Swapping (page flipping) allows the renderer to display a prerenderer display without any flickering.

Specified by:
displayBackBuffer in class Renderer

setOrtho

public void setOrtho()
Description copied from class: Renderer
setOrtho sets the display system to be in orthographic mode. If the system has already been set to orthographic mode a JmeException is thrown. The origin (0,0) is the bottom left of the screen.

Specified by:
setOrtho in class Renderer

setOrthoCenter

public void setOrthoCenter()
Description copied from class: Renderer
setOrthoCenter sets the display system to be in orthographic mode. If the system has already been set to orthographic mode a JmeException is thrown. The origin (0,0) is the center of the screen.

Specified by:
setOrthoCenter in class Renderer

unsetOrtho

public void unsetOrtho()
Description copied from class: Renderer
unsetOrhto unsets the display system from orthographic mode back into regular projection mode. If the system is not in orthographic mode a JmeException is thrown.

Specified by:
unsetOrtho in class Renderer

takeScreenShot

public boolean takeScreenShot(java.lang.String filename)
Description copied from class: Renderer
takeScreenShot saves the current buffer to a png file. The filename is provided, .png will be appended to the end of the name.

Specified by:
takeScreenShot in class Renderer
Parameters:
filename - the name of the screenshot file.
Returns:
true if the screen capture was successful, false otherwise.

grabScreenContents

public void grabScreenContents(java.nio.ByteBuffer buff,
                               Image.Format format,
                               int x,
                               int y,
                               int w,
                               int h)
Description copied from class: Renderer
grabScreenContents reads a block of data as bytes from the current framebuffer. The format determines how many bytes per pixel are read and thus how big the buffer must be that you pass in.

Specified by:
grabScreenContents in class Renderer
Parameters:
buff - a buffer to store contents in.
format - the format to read in bytes for.
x - - x starting point of block
y - - y starting point of block
w - - width of block
h - - height of block

draw

public void draw(Spatial s)
Description copied from class: Renderer
draw 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.

Specified by:
draw in class Renderer
Parameters:
s - the scene to render.

draw

public void draw(Point point)
Description copied from class: Renderer
draw renders a single Point collection to the back buffer.

Specified by:
draw in class Renderer
Parameters:
point - the points to be rendered.

draw

public void draw(Line line)
Description copied from class: Renderer
draw renders a single Line collection to the back buffer.

Specified by:
draw in class Renderer
Parameters:
line - the line to be rendered.

draw

public void draw(Curve c)
Description copied from class: Renderer
draw renders a curve to the back buffer.

Specified by:
draw in class Renderer
Parameters:
c - the curve to be rendered.

draw

public void draw(Text t)
Description copied from class: Renderer
draw renders text to the back buffer.

Specified by:
draw in class Renderer
Parameters:
t - the text object to be rendered.

getQueue

public RenderQueue getQueue()
Description copied from class: Renderer
Get the render queue associated with this Renderer.

Overrides:
getQueue in class Renderer
Returns:
RenderQueue

isProcessingQueue

public boolean isProcessingQueue()
Description copied from class: Renderer
Return true if this renderer is in the middle of processing its RenderQueue.

Overrides:
isProcessingQueue in class Renderer
Returns:
boolean

checkAndAdd

public boolean checkAndAdd(Spatial s)
Description copied from class: Renderer
Check a given Spatial to see if it should be queued. return true if it was queued.

Specified by:
checkAndAdd in class Renderer
Parameters:
s - Spatial to check
Returns:
true if it was queued.

supportsVBO

public boolean supportsVBO()
Description copied from class: Renderer
Return true if the system running this supports VBO

Specified by:
supportsVBO in class Renderer
Returns:
boolean

isHeadless

public boolean isHeadless()
Description copied from class: Renderer
See Renderer.isHeadless()

Overrides:
isHeadless in class Renderer
Returns:
boolean

setHeadless

public void setHeadless(boolean headless)
Description copied from class: Renderer
See Renderer.setHeadless()

Overrides:
setHeadless in class Renderer

getWidth

public int getWidth()
Description copied from class: Renderer
Retrieve the width set on this renderer.

Overrides:
getWidth in class Renderer
Returns:
width

getHeight

public int getHeight()
Description copied from class: Renderer
Retrieve the height set on this renderer.

Overrides:
getHeight in class Renderer
Returns:
height

reinit

public void reinit(int width,
                   int height)
Description copied from class: Renderer
Reinitialize the renderer with the given width/height. Also calls resize on the attached camera if present.

Specified by:
reinit in class Renderer
Parameters:
width - int
height - int

createDisplayList

public int createDisplayList(Geometry g)
Description copied from class: Renderer
Generate a DisplayList for drawing the given Geometry.

Specified by:
createDisplayList in class Renderer
Parameters:
g - the geometry to make a display list for
Returns:
the id of the list

releaseDisplayList

public void releaseDisplayList(int listId)
Description copied from class: Renderer
Releases a DisplayList from the card.

Specified by:
releaseDisplayList in class Renderer
Parameters:
listId - the id of the display list to release

setPolygonOffset

public void setPolygonOffset(float factor,
                             float offset)
Description copied from class: Renderer
Sets an offset to the zbuffer to be used when comparing an incoming polygon for depth buffer pass/fail.

Specified by:
setPolygonOffset in class Renderer
Parameters:
factor - Specifies a scale factor that is used to create a variable depth offset for each polygon. The initial value is 0.
offset - Is multiplied by an implementation-specific value to create a constant depth offset. The initial value is 0.

clearPolygonOffset

public void clearPolygonOffset()
Description copied from class: Renderer
Removes any previously set offset from the renderer.

Specified by:
clearPolygonOffset in class Renderer

deleteVBO

public void deleteVBO(java.nio.Buffer buffer)
Description copied from class: Renderer
Checks the VBO cache to see if this Buffer is mapped to a VBO-id. If it does the mapping will be removed from the cache and the VBO with the VBO-id found will be deleted. If no mapped VBO-id is found, this method does not do anything else.

Specified by:
deleteVBO in class Renderer
Parameters:
buffer - The Buffer who's associated VBO should be deleted.

deleteVBO

public void deleteVBO(int vboid)
Description copied from class: Renderer
Attempts to delete the VBO with this VBO id. Ignores ids < 1.

Specified by:
deleteVBO in class Renderer

clearVBOCache

public void clearVBOCache()
Description copied from class: Renderer
Clears all entries from the VBO cache. Does not actually delete any VBO buffer, only all mappings between Buffers and VBO-ids.

Specified by:
clearVBOCache in class Renderer

removeFromVBOCache

public java.lang.Integer removeFromVBOCache(java.nio.Buffer buffer)
Description copied from class: Renderer
Removes the mapping between this Buffer and it's VBO-id. Does not actually delete the VBO.
This method is usefull if you want to use the same Buffer to create several VBOs. After a VBO is created for this Buffer, update the Buffer and remove it from the VBO cache. You can now reuse the same buffer with another Geometry object.
If no association is found, this method does nothing.

Specified by:
removeFromVBOCache in class Renderer
Parameters:
buffer - The nio Buffer whose associated VBO should be deleted.
Returns:
An int wrapped in an Integer object that's the VBO-id of the VBO previously mapped to this Buffer, or null is no mapping existed.

draw

public void draw(TriMesh tMesh)
Description copied from class: Renderer
draw renders a single TriMesh to the back buffer.

Specified by:
draw in class Renderer
Parameters:
tMesh - the mesh to be rendered.

draw

public void draw(QuadMesh qMesh)
Description copied from class: Renderer
draw renders a single QuadMesh to the back buffer.

Specified by:
draw in class Renderer
Parameters:
qMesh - the mesh to be rendered.

createLineRecord

public StateRecord createLineRecord()
Specified by:
createLineRecord in class Renderer
Returns:
a generated StateRecord representing gl line values for a gl context.

createRendererRecord

public StateRecord createRendererRecord()
Specified by:
createRendererRecord in class Renderer
Returns:
a generated StateRecord representing basic values for this renderer context.

checkCardError

public void checkCardError()
                    throws JmeException
Description copied from class: Renderer
Check the underlying rendering system (opengl, etc.) for exceptions.

Specified by:
checkCardError in class Renderer
Throws:
JmeException - if an error is found.

cleanup

public void cleanup()
Description copied from class: Renderer
Perform any necessary cleanup operations such as deleting VBOs, etc.

Specified by:
cleanup in class Renderer

isInOrthoMode

public boolean isInOrthoMode()
Specified by:
isInOrthoMode in class Renderer
Returns:
true if the renderer is currently in ortho mode.

updateTextureSubImage

public void updateTextureSubImage(Texture dstTexture,
                                  int dstX,
                                  int dstY,
                                  Image srcImage,
                                  int srcX,
                                  int srcY,
                                  int width,
                                  int height)
                           throws JmeException,
                                  java.lang.UnsupportedOperationException
Description copied from class: Renderer
Updates a region of the content area of the provided texture using the specified region of the given data.

Specified by:
updateTextureSubImage in class Renderer
Parameters:
dstTexture - the texture to be updated
dstX - the x offset relative to the lower-left corner of this texture where the update will be applied
dstY - the y offset relative to the lower-left corner of this texture where the update will be applied
srcImage - the image data to be uploaded to the texture
srcX - the x offset relative to the lower-left corner of the supplied buffer from which to fetch the update rectangle
srcY - the y offset relative to the lower-left corner of the supplied buffer from which to fetch the update rectangle
width - the width of the region to be updated
height - the height of the region to be updated
Throws:
JmeException - if unable to update the texture
java.lang.UnsupportedOperationException - if updating for the provided texture type is unsupported
See Also:
com.sun.opengl.util.texture.Texture#updateSubImage(com.sun.opengl.util.texture.TextureData, int, int, int, int, int, int, int)