|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.renderer.Renderer
public abstract class Renderer
Renderer
defines an abstract class that handles displaying of
graphics data to the context. Creation of this object is typically handled
via a call to a DisplaySystem
subclass.
All rendering state and tasks can be handled through this class.
Example Usage:
NOTE: This example uses the DisplaySystem
class to obtain the
Renderer
.
DisplaySystem ds = new LWJGLDisplaySystem();
ds.createWindow(640,480,16,60,false);
Renderer r = ds.getRenderer();
r.draw(point);
DisplaySystem
Field Summary | |
---|---|
protected ColorRGBA |
backgroundColor
|
protected AbstractCamera |
camera
|
static RenderState[] |
defaultStateList
List of default states all spatials take if none is set. |
protected int |
height
|
protected boolean |
processingQueue
|
protected RenderQueue |
queue
|
static int |
QUEUE_INHERIT
The Spatial will inherit its render queue state from its parent. |
static int |
QUEUE_OPAQUE
The Spatial will render in the opaque bucket. |
static int |
QUEUE_ORTHO
The Spatial will render in the ortho bucket. |
static int |
QUEUE_SKIP
The Spatial will skip render queueing. |
static int |
QUEUE_TRANSPARENT
The Spatial will render in the transparent bucket. |
protected int |
width
|
Constructor Summary | |
---|---|
Renderer()
|
Method Summary | |
---|---|
abstract boolean |
checkAndAdd(Spatial s)
Check a given Spatial to see if it should be queued. |
abstract void |
checkCardError()
Check the underlying rendering system (opengl, etc.) for exceptions. |
abstract void |
cleanup()
Perform any necessary cleanup operations such as deleting VBOs, etc. |
abstract void |
clearBuffers()
clearBuffers clears both the depth buffer and the back
buffer. |
abstract void |
clearColorBuffer()
clearBackBuffer clears the back buffer of the renderer. |
abstract void |
clearPolygonOffset()
Removes any previously set offset from the renderer. |
void |
clearQueue()
clear the render queue |
abstract void |
clearStencilBuffer()
clearStencilBuffer clears the stencil buffer of the renderer. |
abstract 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. |
abstract void |
clearVBOCache()
Clears all entries from the VBO cache. |
abstract void |
clearZBuffer()
clearZBuffer clears the depth buffer of the renderer. |
abstract BlendState |
createBlendState()
createBlendState retrieves the blend state object for the
proper renderer. |
abstract Camera |
createCamera(int width,
int height)
createCamera retrieves a default camera for this renderer. |
abstract ClipState |
createClipState()
Retrieves the clip state object for the proper renderer. |
abstract ColorMaskState |
createColorMaskState()
Retrieves the color mask state object for the proper renderer. |
abstract CullState |
createCullState()
createCullState retrieves the cull state object for the
proper renderer. |
abstract int |
createDisplayList(Geometry geom)
Generate a DisplayList for drawing the given Geometry. |
abstract FogState |
createFogState()
createFogState retrieves the fog state object for the
proper renderer. |
abstract FragmentProgramState |
createFragmentProgramState()
Retrieves the fragment program state object for the proper renderer. |
abstract GLSLShaderObjectsState |
createGLSLShaderObjectsState()
createShaderObjectsState retrieves the shader object state
object for the proper renderer. |
abstract LightState |
createLightState()
createLightState retrieves the light state object for the
proper renderer. |
abstract StateRecord |
createLineRecord()
|
abstract MaterialState |
createMaterialState()
createMaterialState retrieves the material state object
for the proper renderer. |
abstract StateRecord |
createRendererRecord()
|
abstract ShadeState |
createShadeState()
createShadeState retrieves the shade state object for the
proper renderer. |
RenderState |
createState(int type)
Deprecated. As of 2.0, use createState(com.jme.scene.state.RenderState.StateType) instead. |
RenderState |
createState(RenderState.StateType type)
Create a RenderState via a given RenderState.StateType type. |
abstract StencilState |
createStencilState()
Retrieves the stencil state object for the proper renderer. |
abstract StippleState |
createStippleState()
Retrieves the stipple state object for the proper renderer. |
abstract TextureState |
createTextureState()
createTextureState retrieves the texture state object for
the proper renderer. |
abstract VertexProgramState |
createVertexProgramState()
Retrieves the vertex program state object for the proper renderer. |
abstract WireframeState |
createWireframeState()
createWireframeState retrieves the wireframe state object
for the proper renderer. |
abstract ZBufferState |
createZBufferState()
Retrieves the Z buffer state object for the proper renderer. |
abstract void |
deleteVBO(java.nio.Buffer buffer)
Checks the VBO cache to see if this Buffer is mapped to a VBO-id. |
abstract void |
deleteVBO(int vboid)
Attempts to delete the VBO with this VBO id. |
abstract void |
displayBackBuffer()
displayBackBuffer swaps the back buffer with the currently
displayed buffer. |
abstract void |
draw(Curve c)
draw renders a curve to the back buffer. |
abstract void |
draw(Line line)
draw renders a single Line collection to the back buffer. |
abstract void |
draw(Point point)
draw renders a single Point collection to the back buffer. |
abstract void |
draw(QuadMesh mesh)
draw renders a single QuadMesh to the back buffer. |
abstract void |
draw(Spatial s)
draw renders a scene. |
abstract void |
draw(Text t)
draw renders text to the back buffer. |
abstract void |
draw(TriMesh mesh)
draw renders a single TriMesh to the back buffer. |
abstract void |
finish()
finish is similar to flush, however it blocks until all
waiting OpenGL commands have been finished. |
abstract 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. |
Camera |
getCamera()
getCamera returns the camera used by this renderer. |
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. |
abstract 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() |
abstract boolean |
isInOrthoMode()
|
boolean |
isProcessingQueue()
Return true if this renderer is in the middle of processing its RenderQueue. |
abstract void |
reinit(int width,
int height)
Reinitialize the renderer with the given width/height. |
abstract void |
releaseDisplayList(int listId)
Releases a DisplayList from the card. |
abstract java.lang.Integer |
removeFromVBOCache(java.nio.Buffer buffer)
Removes the mapping between this Buffer and it's VBO-id. |
void |
renderQueue()
render queue if needed |
abstract void |
setBackgroundColor(ColorRGBA c)
setBackgroundColor sets the color of window. |
abstract void |
setCamera(Camera camera)
setCamera sets the reference to the applications camera
object. |
void |
setHeadless(boolean headless)
See Renderer.setHeadless() |
abstract void |
setOrtho()
setOrtho sets the display system to be in orthographic
mode. |
abstract void |
setOrthoCenter()
setOrthoCenter sets the display system to be in
orthographic mode. |
abstract 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. |
abstract boolean |
supportsVBO()
Return true if the system running this supports VBO |
abstract boolean |
takeScreenShot(java.lang.String filename)
takeScreenShot saves the current buffer to a png file. |
abstract void |
unsetOrtho()
unsetOrhto unsets the display system from orthographic
mode back into regular projection mode. |
abstract 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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int QUEUE_INHERIT
public static final int QUEUE_SKIP
public static final int QUEUE_OPAQUE
public static final int QUEUE_TRANSPARENT
public static final int QUEUE_ORTHO
protected AbstractCamera camera
protected ColorRGBA backgroundColor
protected boolean processingQueue
protected RenderQueue queue
protected int width
protected int height
public static final RenderState[] defaultStateList
Constructor Detail |
---|
public Renderer()
Method Detail |
---|
public abstract void setCamera(Camera camera)
setCamera
sets the reference to the applications camera
object.
camera
- the camera object to use with this Renderer
.public Camera getCamera()
getCamera
returns the camera used by this renderer.
getCamera()
public abstract Camera createCamera(int width, int height)
createCamera
retrieves a default camera for this renderer.
width
- the width of the frame.height
- the height of the frame.
public abstract BlendState createBlendState()
createBlendState
retrieves the blend state object for the
proper renderer.
BlendState
object that can make use of the
proper renderer.public abstract CullState createCullState()
createCullState
retrieves the cull state object for the
proper renderer.
CullState
object that can make use of the
proper renderer.public abstract FogState createFogState()
createFogState
retrieves the fog state object for the
proper renderer.
FogState
object that can make use of the
proper renderer.public abstract LightState createLightState()
createLightState
retrieves the light state object for the
proper renderer.
LightState
object that can make use of the
proper renderer.public abstract MaterialState createMaterialState()
createMaterialState
retrieves the material state object
for the proper renderer.
MaterialState
object that can make use of the
proper renderer.public abstract ShadeState createShadeState()
createShadeState
retrieves the shade state object for the
proper renderer.
ShadeState
object that can make use of the
proper renderer.public abstract TextureState createTextureState()
createTextureState
retrieves the texture state object for
the proper renderer.
TextureState
object that can make use of the
proper renderer.public abstract WireframeState createWireframeState()
createWireframeState
retrieves the wireframe state object
for the proper renderer.
WireframeState
object that can make use of the
proper renderer.public abstract ZBufferState createZBufferState()
ZBufferState
object that can make use of the
proper renderer.public abstract VertexProgramState createVertexProgramState()
VertexProgramState
object that can make use of
the proper renderer.public abstract FragmentProgramState createFragmentProgramState()
VertexProgramState
object that can make use of
the proper renderer.public abstract GLSLShaderObjectsState createGLSLShaderObjectsState()
createShaderObjectsState
retrieves the shader object state
object for the proper renderer.
ShaderObjectsState
object that can make use of
the proper renderer.public abstract StencilState createStencilState()
StencilState
object that can make use of the
proper renderer.public abstract ClipState createClipState()
ClipState
object that can make use of the
proper renderer.public abstract ColorMaskState createColorMaskState()
ColorMaskState
object that can make use of the
proper renderer.public abstract StippleState createStippleState()
StippleState
object that can make use of the
proper renderer.public abstract 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.
c
- the color to set the background to.public ColorRGBA getBackgroundColor()
getBackgroundColor
retrieves the clear color of the
current OpenGL context.
getBackgroundColor()
public abstract void clearZBuffer()
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.
public abstract void clearColorBuffer()
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.
public abstract void clearStencilBuffer()
clearStencilBuffer
clears the stencil buffer of the renderer.
public abstract void clearBuffers()
clearBuffers
clears both the depth buffer and the back
buffer.
public abstract 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.
public abstract void displayBackBuffer()
displayBackBuffer
swaps the back buffer with the currently
displayed buffer. Swapping (page flipping) allows the renderer to display
a prerenderer display without any flickering.
public abstract void setOrtho()
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.
public abstract boolean isInOrthoMode()
public void renderQueue()
public void clearQueue()
public abstract void setOrthoCenter()
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.
public abstract void unsetOrtho()
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.
public abstract boolean takeScreenShot(java.lang.String filename)
takeScreenShot
saves the current buffer to a png file. The
filename is provided, .png will be appended to the end of the name.
filename
- the name of the screenshot file.
public abstract 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. The format determines how many bytes per pixel are
read and thus how big the buffer must be that you pass in.
buff
- a buffer to store contents in.format
- the format to read in bytes for.x
- -
x starting point of blocky
- -
y starting point of blockw
- -
width of blockh
- -
height of blockpublic abstract void draw(Spatial s)
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.
s
- the scene to render.public abstract void draw(TriMesh mesh)
draw
renders a single TriMesh to the back buffer.
mesh
- the mesh to be rendered.public abstract void draw(QuadMesh mesh)
draw
renders a single QuadMesh to the back buffer.
mesh
- the mesh to be rendered.public abstract void draw(Point point)
draw
renders a single Point collection to the back buffer.
point
- the points to be rendered.public abstract void draw(Line line)
draw
renders a single Line collection to the back buffer.
line
- the line to be rendered.public abstract void draw(Curve c)
draw
renders a curve to the back buffer.
c
- the curve to be rendered.public abstract void draw(Text t)
draw
renders text to the back buffer.
t
- the text object to be rendered.public abstract void flush()
flush
tells opengl to send through all currently waiting
commands in the buffer.
public abstract void finish()
finish
is similar to flush, however it blocks until all
waiting OpenGL commands have been finished.
public RenderQueue getQueue()
public boolean isProcessingQueue()
public abstract boolean checkAndAdd(Spatial s)
s
- Spatial to check
public abstract boolean supportsVBO()
public boolean isHeadless()
public void setHeadless(boolean headless)
public int getWidth()
public int getHeight()
public abstract void reinit(int width, int height)
width
- intheight
- intpublic abstract int createDisplayList(Geometry geom)
geom
- the geometry to make a display list for
public abstract void releaseDisplayList(int listId)
listId
- the id of the display list to releasepublic abstract void setPolygonOffset(float factor, float offset)
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.public abstract void clearPolygonOffset()
public abstract void deleteVBO(java.nio.Buffer buffer)
buffer
- The Buffer who's associated VBO should be deleted.public abstract void deleteVBO(int vboid)
vboid
- public abstract void clearVBOCache()
public abstract java.lang.Integer removeFromVBOCache(java.nio.Buffer buffer)
buffer
- The nio Buffer whose associated VBO should be deleted.
public RenderState createState(int type)
createState(com.jme.scene.state.RenderState.StateType)
instead.
type
- one of RenderState.RS_****
public RenderState createState(RenderState.StateType type)
RenderState
via a given RenderState.StateType
type.
types
- one of RenderState.StateType
types
RenderState
or null if an invalid type is given.public abstract StateRecord createLineRecord()
public abstract StateRecord createRendererRecord()
public abstract void updateTextureSubImage(Texture dstTexture, int dstX, int dstY, Image srcImage, int srcX, int srcY, int width, int height) throws JmeException, java.lang.UnsupportedOperationException
dstTexture
- the texture to be updateddstX
- the x offset relative to the lower-left corner of this texture
where the update will be applieddstY
- the y offset relative to the lower-left corner of this texture
where the update will be appliedsrcImage
- the image data to be uploaded to the texturesrcX
- the x offset relative to the lower-left corner of the supplied
buffer from which to fetch the update rectanglesrcY
- the y offset relative to the lower-left corner of the supplied
buffer from which to fetch the update rectanglewidth
- the width of the region to be updatedheight
- the height of the region to be updated
JmeException
- if unable to update the texture
java.lang.UnsupportedOperationException
- if updating for the provided texture type is unsupportedcom.sun.opengl.util.texture.Texture#updateSubImage(com.sun.opengl.util.texture.TextureData,
int, int, int, int, int, int, int)
public abstract void checkCardError() throws JmeException
JmeException
- if an error is found.public abstract void cleanup()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |