|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jme.renderer.Renderer
com.jme.renderer.lwjgl.LWJGLRenderer
public class LWJGLRenderer
LWJGLRenderer provides an implementation of the
Renderer interface using the LWJGL API.
Renderer| Field Summary | |
|---|---|
protected ContextCapabilities |
capabilities
|
protected WeakIdentityCache<java.nio.Buffer,java.lang.Integer> |
vboMap
|
| 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 | |
|---|---|
LWJGLRenderer(int width,
int height)
Constructor instantiates a new LWJGLRenderer object. |
|
| Method Summary | |
|---|---|
void |
applyStates(RenderState[] states,
Geometry geom)
setStates applies the given states if and only if they are
different from the currently set states. |
boolean |
checkAndAdd(Spatial s)
checkAndAdd is used to process the Spatial for the render queue. |
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 color and the depth buffer. |
void |
clearColorBuffer()
clearBackBuffer clears the OpenGL color buffer. |
void |
clearPolygonOffset()
Removes any previously set offset from the renderer. |
void |
clearStencilBuffer()
clearStencilBuffer |
void |
clearStrictBuffers()
clearBuffers clears both the color and the depth buffer
for only the part of the buffer defined by the renderer width/height. |
void |
clearVBOCache()
Clears all entries from the VBO cache. |
void |
clearZBuffer()
clearZBuffer clears the OpenGL depth buffer. |
BlendState |
createBlendState()
createBlendState returns a new LWJGLBlendState object as a
regular BlendState. |
Camera |
createCamera(int width,
int height)
createCamera returns a default camera for use with the
LWJGL renderer. |
ClipState |
createClipState()
createClipState returns a new LWJGLClipState object as a
regular ClipState. |
ColorMaskState |
createColorMaskState()
createColorMaskState returns a new LWJGLColorMaskState
object as a regular ColorMaskState. |
CullState |
createCullState()
createCullState returns a new LWJGLCullState object as a
regular CullState. |
int |
createDisplayList(Geometry g)
Generate a DisplayList for drawing the given Geometry. |
FogState |
createFogState()
createFogState returns a new LWJGLFogState object as a
regular FogState. |
FragmentProgramState |
createFragmentProgramState()
createFragmentProgramState returns a new
LWJGLFragmentProgramState object as a regular FragmentProgramState. |
GLSLShaderObjectsState |
createGLSLShaderObjectsState()
createShaderObjectsState returns a new
LWJGLShaderObjectsState object as a regular ShaderObjectsState. |
LightState |
createLightState()
createLightState returns a new LWJGLLightState object as a
regular LightState. |
StateRecord |
createLineRecord()
|
MaterialState |
createMaterialState()
createMaterialState returns a new LWJGLMaterialState
object as a regular MaterialState. |
StateRecord |
createRendererRecord()
|
ShadeState |
createShadeState()
createShadeState returns a new LWJGLShadeState object as a
regular ShadeState. |
StencilState |
createStencilState()
createStencilState returns a new LWJGLStencilState object
as a regular StencilState. |
StippleState |
createStippleState()
createStippleState returns a new LWJGLStippleState
object as a regular StippleState. |
TextureState |
createTextureState()
createTextureState returns a new LWJGLTextureState object
as a regular TextureState. |
VertexProgramState |
createVertexProgramState()
createVertexProgramState returns a new
LWJGLVertexProgramState object as a regular VertexProgramState. |
WireframeState |
createWireframeState()
createWireframeState returns a new LWJGLWireframeState
object as a regular WireframeState. |
ZBufferState |
createZBufferState()
createZBufferState returns a new LWJGLZBufferState object
as a regular ZBufferState. |
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 renders any queued items then flips the
rendered buffer (back) with the currently displayed buffer. |
protected boolean |
doTransforms(Spatial t)
|
void |
draw(Curve curve)
draw renders a curve object. |
void |
draw(Line lines)
draw renders a Line object including it's
normals, colors, textures and vertices. |
void |
draw(Point points)
draw renders a Point object including it's
normals, colors, textures and vertices. |
void |
draw(QuadMesh quads)
draw renders a QuadMesh object including
it's normals, colors, textures and vertices. |
void |
draw(Spatial s)
draw renders a scene by calling the nodes
onDraw method. |
void |
draw(Text t)
draw renders a text object using a predefined font. |
void |
draw(TriMesh tris)
draw renders a TriMesh object including
it's normals, colors, textures and vertices. |
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. |
void |
grabScreenContents(java.nio.ByteBuffer buff,
Image.Format format,
int x,
int y,
int w,
int h)
grabScreenContents reads a block of pixels from the
current framebuffer. |
boolean |
isInOrthoMode()
|
protected void |
postdrawGeometry(Geometry g)
re-initializes the GL context for rendering of another piece of geometry. |
protected boolean |
predrawGeometry(Geometry g)
Prepares the GL Context for rendering this geometry. |
protected void |
prepVBO(Geometry g)
prepVBO binds the geometry data to a vbo buffer and sends
it to the GPU if necessary. |
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 |
reset()
|
void |
setBackgroundColor(ColorRGBA c)
setBackgroundColor sets the OpenGL clear color to the
color specified. |
void |
setCamera(Camera camera)
setCamera sets the camera this renderer is using. |
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 |
void |
takeScreenShot(java.lang.String filename)
takeScreenShot saves the current buffer to a file. |
protected void |
undoTransforms(Spatial t)
|
void |
unsetOrtho()
setOrthoCenter sets the display system to be in
orthographic 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, getBackgroundColor, getCamera, getHeight, getQueue, getWidth, isHeadless, isProcessingQueue, renderQueue, setHeadless |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ContextCapabilities capabilities
protected WeakIdentityCache<java.nio.Buffer,java.lang.Integer> vboMap
| Constructor Detail |
|---|
public LWJGLRenderer(int width,
int height)
LWJGLRenderer object. The
size of the rendering window is passed during construction.
width - the width of the rendering context.height - the height of the rendering context.| Method Detail |
|---|
public void reinit(int width,
int height)
reinit in class Rendererwidth - intheight - intpublic void setCamera(Camera camera)
setCamera sets the camera this renderer is using. It
asserts that the camera is of type LWJGLCamera.
setCamera in class Renderercamera - the camera object to use with this Renderer.Renderer.setCamera(com.jme.renderer.Camera)
public Camera createCamera(int width,
int height)
createCamera returns a default camera for use with the
LWJGL renderer.
createCamera in class Rendererwidth - the width of the frame.height - the height of the frame.
public BlendState createBlendState()
createBlendState returns a new LWJGLBlendState object as a
regular BlendState.
createBlendState in class Rendererpublic CullState createCullState()
createCullState returns a new LWJGLCullState object as a
regular CullState.
createCullState in class RendererRenderer.createCullState()public FogState createFogState()
createFogState returns a new LWJGLFogState object as a
regular FogState.
createFogState in class Rendererpublic LightState createLightState()
createLightState returns a new LWJGLLightState object as a
regular LightState.
createLightState in class Rendererpublic MaterialState createMaterialState()
createMaterialState returns a new LWJGLMaterialState
object as a regular MaterialState.
createMaterialState in class Rendererpublic ShadeState createShadeState()
createShadeState returns a new LWJGLShadeState object as a
regular ShadeState.
createShadeState in class Rendererpublic TextureState createTextureState()
createTextureState returns a new LWJGLTextureState object
as a regular TextureState.
createTextureState in class Rendererpublic WireframeState createWireframeState()
createWireframeState returns a new LWJGLWireframeState
object as a regular WireframeState.
createWireframeState in class Rendererpublic ZBufferState createZBufferState()
createZBufferState returns a new LWJGLZBufferState object
as a regular ZBufferState.
createZBufferState in class Rendererpublic VertexProgramState createVertexProgramState()
createVertexProgramState returns a new
LWJGLVertexProgramState object as a regular VertexProgramState.
createVertexProgramState in class Rendererpublic FragmentProgramState createFragmentProgramState()
createFragmentProgramState returns a new
LWJGLFragmentProgramState object as a regular FragmentProgramState.
createFragmentProgramState in class Rendererpublic GLSLShaderObjectsState createGLSLShaderObjectsState()
createShaderObjectsState returns a new
LWJGLShaderObjectsState object as a regular ShaderObjectsState.
createGLSLShaderObjectsState in class Rendererpublic StencilState createStencilState()
createStencilState returns a new LWJGLStencilState object
as a regular StencilState.
createStencilState in class Rendererpublic ClipState createClipState()
createClipState returns a new LWJGLClipState object as a
regular ClipState.
createClipState in class RendererRenderer.createClipState()public ColorMaskState createColorMaskState()
createColorMaskState returns a new LWJGLColorMaskState
object as a regular ColorMaskState.
createColorMaskState in class Rendererpublic StippleState createStippleState()
createStippleState returns a new LWJGLStippleState
object as a regular StippleState.
createStippleState in class Rendererpublic void setBackgroundColor(ColorRGBA c)
setBackgroundColor sets the OpenGL clear color to the
color specified.
setBackgroundColor in class Rendererc - the color to set the background color to.Renderer.setBackgroundColor(com.jme.renderer.ColorRGBA)public void clearZBuffer()
clearZBuffer clears the OpenGL depth buffer.
clearZBuffer in class RendererRenderer.clearZBuffer()public void clearColorBuffer()
clearBackBuffer clears the OpenGL color buffer.
clearColorBuffer in class RendererRenderer.clearColorBuffer()public void clearStencilBuffer()
clearStencilBuffer
clearStencilBuffer in class RendererRenderer.clearStencilBuffer()public void clearBuffers()
clearBuffers clears both the color and the depth buffer.
clearBuffers in class RendererRenderer.clearBuffers()public void clearStrictBuffers()
clearBuffers clears both the color and the depth buffer
for only the part of the buffer defined by the renderer width/height.
clearStrictBuffers in class RendererRenderer.clearBuffers()public void displayBackBuffer()
displayBackBuffer renders any queued items then flips the
rendered buffer (back) with the currently displayed buffer.
displayBackBuffer in class RendererRenderer.displayBackBuffer()public void reset()
public boolean isInOrthoMode()
isInOrthoMode in class Rendererpublic 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.
setOrtho in class Rendererpublic void setOrthoCenter()
RenderersetOrthoCenter 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.
setOrthoCenter in class Rendererpublic void unsetOrtho()
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.
unsetOrtho in class Rendererpublic void takeScreenShot(java.lang.String filename)
takeScreenShot saves the current buffer to a file. The
file name is provided, and .png will be appended. True is returned if the
capture was successful, false otherwise.
takeScreenShot in class Rendererfilename - the name of the file to save.
public void grabScreenContents(java.nio.ByteBuffer buff,
Image.Format format,
int x,
int y,
int w,
int h)
grabScreenContents reads a block of pixels from the
current framebuffer.
grabScreenContents in class Rendererbuff - a buffer to store contents in.format - the format to readx - -
x starting point of blocky - -
y starting point of blockw - -
width of blockh - -
height of blockpublic void draw(Curve curve)
draw renders a curve object.
draw in class Renderercurve - the curve object to render.public void draw(Line lines)
draw renders a Line object including it's
normals, colors, textures and vertices.
draw in class Rendererlines - the lines to render.Renderer.draw(Line)public void draw(Point points)
draw renders a Point object including it's
normals, colors, textures and vertices.
draw in class Rendererpoints - the points to render.Renderer.draw(Point)public void draw(QuadMesh quads)
draw renders a QuadMesh object including
it's normals, colors, textures and vertices.
draw in class Rendererquads - the mesh to render.Renderer.draw(QuadMesh)public void draw(TriMesh tris)
draw renders a TriMesh object including
it's normals, colors, textures and vertices.
draw in class Renderertris - the mesh to render.Renderer.draw(TriMesh)protected void prepVBO(Geometry g)
prepVBO binds the geometry data to a vbo buffer and sends
it to the GPU if necessary. The vbo id is stored in the geometry's
VBOInfo class. If a new vbo id is created, the VBO is also stored in a
cache. Before creating a new VBO this cache will be checked to see if a
VBO is already created for that Buffer.
g - the geometry to initialize VBO for.public void draw(Spatial s)
draw renders a scene by calling the nodes
onDraw method.
draw in class Renderers - the scene to render.Renderer.draw(com.jme.scene.Spatial)public void draw(Text t)
draw renders a text object using a predefined font.
draw in class Renderert - the text object to be rendered.Renderer.draw(com.jme.scene.Text)public boolean checkAndAdd(Spatial s)
checkAndAdd in class Renderers - Spatial to check
public boolean supportsVBO()
supportsVBO in class Rendererprotected void postdrawGeometry(Geometry g)
public void flush()
flush tells opengl to send through all currently waiting
commands in the buffer.
flush in class Rendererpublic void finish()
finish is similar to flush, however it blocks until all
waiting OpenGL commands have been finished.
finish in class Rendererprotected boolean predrawGeometry(Geometry g)
g - the geometry to process.
protected boolean doTransforms(Spatial t)
protected void undoTransforms(Spatial t)
public int createDisplayList(Geometry g)
Renderer
createDisplayList in class Rendererg - the geometry to make a display list for
public void releaseDisplayList(int listId)
Renderer
releaseDisplayList in class RendererlistId - the id of the display list to release
public void setPolygonOffset(float factor,
float offset)
Renderer
setPolygonOffset in class Rendererfactor - 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 void clearPolygonOffset()
Renderer
clearPolygonOffset in class Rendererpublic void deleteVBO(java.nio.Buffer buffer)
Renderer
deleteVBO in class Rendererbuffer - The Buffer who's associated VBO should be deleted.Renderer.deleteVBO(Buffer)public void deleteVBO(int vboid)
Renderer
deleteVBO in class RendererRenderer.deleteVBO(int)public void clearVBOCache()
Renderer
clearVBOCache in class RendererRenderer.clearVBOCache()public java.lang.Integer removeFromVBOCache(java.nio.Buffer buffer)
Renderer
removeFromVBOCache in class Rendererbuffer - The nio Buffer whose associated VBO should be deleted.
Renderer.removeFromVBOCache(Buffer)
public void applyStates(RenderState[] states,
Geometry geom)
setStates applies the given states if and only if they are
different from the currently set states.
public StateRecord createLineRecord()
createLineRecord in class Rendererpublic StateRecord createRendererRecord()
createRendererRecord in class Renderer
public void updateTextureSubImage(Texture dstTexture,
int dstX,
int dstY,
Image srcImage,
int srcX,
int srcY,
int width,
int height)
throws JmeException,
java.lang.UnsupportedOperationException
Renderer
updateTextureSubImage in class RendererdstTexture - 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 void checkCardError()
throws JmeException
Renderer
checkCardError in class RendererJmeException - if an error is found.public void cleanup()
Renderer
cleanup in class Renderer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||