org.xith3d.render.lwjgl
Class CanvasPeerImplAWT

java.lang.Object
  extended by org.xith3d.render.CanvasPeer
      extended by org.xith3d.render.lwjgl.CanvasPeerImplBase
          extended by org.xith3d.render.lwjgl.CanvasPeerImplAWT
All Implemented Interfaces:
org.jagatoo.input.render.InputSourceWindow

public class CanvasPeerImplAWT
extends CanvasPeerImplBase

The CanvasPeer implementation for the LightWeight Java Game Library (LWJGL)


Field Summary
 
Fields inherited from class org.xith3d.render.lwjgl.CanvasPeerImplBase
DEBUG_GL, renderingThread, vsyncSwitched
 
Fields inherited from class org.xith3d.render.CanvasPeer
isGammaChanged, oglInfo
 
Constructor Summary
CanvasPeerImplAWT(java.lang.Object owner, DisplayMode displayMode, DisplayMode.FullscreenMode fullscreen, boolean vsync, FSAA fsaa, int depthBufferSize)
           
 
Method Summary
protected  void applyVSync()
           
 void beforeThreadChanged()
          This method should be executed by the Thread that starts the actual rendering Thread right before it starts it.
 void destroy()
          Clears the screen (BLACK) and destroys the display.
 org.lwjgl.opengl.AWTGLCanvas getComponent()
          
 org.xith3d.render.lwjgl.CanvasPeerImplAWT.ContextGLCanvas getDrawable()
           
protected  java.lang.Class<?> getExpectedNativeDisplayModeClass()
           
 int getHeight()
          Gets the width in an implementation independant manner
 org.jagatoo.input.impl.mixed.AWTJInputInputDeviceFactory getInputDeviceFactory(org.jagatoo.input.InputSystem inputSystem)
           
 int getLeft()
          Gets the left-location in an implementation independant manner
 java.lang.String getTitle()
          Gets the title in an implementation independant manner
 int getTop()
          Gets the top-location in an implementation independant manner
 OpenGLLayer getType()
          
 int getWidth()
          Gets the width in an implementation independant manner
 java.awt.Frame getWindow()
          
protected  java.lang.Object initRenderingImpl(View view, java.util.List<RenderPass> renderPasses, boolean layeredMode, long frameId, long nanoTime, long nanoStep, PickRequest pickRequest)
          Initializes the rendering.
 boolean isRendering()
          This flag is set by the Rendering system triggered by xith or by the CanvasPeer implementation itself (e.g when the CanvasPeer is auto-redrawn).
protected  java.lang.Thread makeCurrent()
           
 boolean receivesInputEvents()
           
 void refreshCursor(org.jagatoo.input.devices.Mouse mouse)
           
protected  boolean setDisplayModeImpl(DisplayMode displayMode)
          Sets the new DisplayMode in an implementation independant manner.
 void setGamma(float gamma, float brightness, float contrast)
          Changes the gamma-, brightness- and contrast values for this CanvasPeer.
 void setIcon(java.net.URL iconResource)
          Changes the window icon.
 boolean setLocation(int x, int y)
          Sets the location in an implementation independant manner.
 boolean setSize(int width, int height)
          Sets the size in an implementation independant manner.
 void setTitle(java.lang.String title)
          Sets the title in an implementation independant manner.
 void setVSyncEnabled(boolean vsync)
          Enables or disables V-Sync.
 
Methods inherited from class org.xith3d.render.lwjgl.CanvasPeerImplBase
addDestroyableObject, beforeRenderStart, clear, createRenderPeer, doRender, getCurrentViewport, getMaxViewport, getNativeDisplayMode, getRenderedFrames, getRenderPeer, init, isInitialized, updateViewport
 
Methods inherited from class org.xith3d.render.CanvasPeer
addTriangles, addWindowClosingListener, destroyGLNames, fireClosingEvent, getBPP, getBrightness, getCanvas3D, getCanvasID, getContrast, getCursor, getDepthBufferSize, getDisplayMode, getFrequency, getFSAA, getFullscreenSwitchRequest, getGamma, getInputDeviceFactory, getMaxTextureSize, getMaxTextureUnits, getMaxVertexAttributes, getOpenGLCapabilities, getOpenGLInfo, getRenderLock, getTriangles, getViewport, isClosingListenerRegistered, isDestroyed, isFullscreen, isUndecorated, isVSyncEnabled, removeWindowClosingListener, resetFullscreenSwitchRequest, setCanvas3D, setCursor, setCursorImpl, setDepthBufferSize, setDisplayMode, setDisplayModeRef, setFullscreen, setOpenGLCapabilities, setTriangles, setViewport, takeScreenshot, takeScreenshot, takeScreenshot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanvasPeerImplAWT

public CanvasPeerImplAWT(java.lang.Object owner,
                         DisplayMode displayMode,
                         DisplayMode.FullscreenMode fullscreen,
                         boolean vsync,
                         FSAA fsaa,
                         int depthBufferSize)
Method Detail

getInputDeviceFactory

public org.jagatoo.input.impl.mixed.AWTJInputInputDeviceFactory getInputDeviceFactory(org.jagatoo.input.InputSystem inputSystem)

getDrawable

public final org.xith3d.render.lwjgl.CanvasPeerImplAWT.ContextGLCanvas getDrawable()

refreshCursor

public void refreshCursor(org.jagatoo.input.devices.Mouse mouse)

receivesInputEvents

public final boolean receivesInputEvents()

getType

public OpenGLLayer getType()

Specified by:
getType in class CanvasPeer
Returns:
an element of the OpenGLLayer enum.
See Also:
OpenGLLayer

getExpectedNativeDisplayModeClass

protected final java.lang.Class<?> getExpectedNativeDisplayModeClass()
Overrides:
getExpectedNativeDisplayModeClass in class CanvasPeerImplBase

applyVSync

protected void applyVSync()
Specified by:
applyVSync in class CanvasPeerImplBase

setVSyncEnabled

public void setVSyncEnabled(boolean vsync)
Enables or disables V-Sync.

Overrides:
setVSyncEnabled in class CanvasPeer

getWindow

public final java.awt.Frame getWindow()

Specified by:
getWindow in class CanvasPeer
Returns:
the Window holding the Canvas.

getComponent

public final org.lwjgl.opengl.AWTGLCanvas getComponent()

Specified by:
getComponent in class CanvasPeer
Returns:
the Component holding the Canvas.

setIcon

public void setIcon(java.net.URL iconResource)
             throws java.io.IOException
Changes the window icon.

Specified by:
setIcon in class CanvasPeer
Parameters:
iconResource - the resource of the image for the new icon
Throws:
java.io.IOException

setTitle

public final void setTitle(java.lang.String title)
Sets the title in an implementation independant manner.

Specified by:
setTitle in class CanvasPeer

getTitle

public final java.lang.String getTitle()
Gets the title in an implementation independant manner

Specified by:
getTitle in class CanvasPeer

setLocation

public final boolean setLocation(int x,
                                 int y)
Sets the location in an implementation independant manner.

Specified by:
setLocation in class CanvasPeer

getLeft

public final int getLeft()
Gets the left-location in an implementation independant manner

Specified by:
getLeft in class CanvasPeer

getTop

public final int getTop()
Gets the top-location in an implementation independant manner

Specified by:
getTop in class CanvasPeer

setSize

public final boolean setSize(int width,
                             int height)
Sets the size in an implementation independant manner.

Specified by:
setSize in class CanvasPeer

getWidth

public final int getWidth()
Gets the width in an implementation independant manner

Specified by:
getWidth in interface org.jagatoo.input.render.InputSourceWindow
Specified by:
getWidth in class CanvasPeer

getHeight

public final int getHeight()
Gets the width in an implementation independant manner

Specified by:
getHeight in interface org.jagatoo.input.render.InputSourceWindow
Specified by:
getHeight in class CanvasPeer

setDisplayModeImpl

protected boolean setDisplayModeImpl(DisplayMode displayMode)
Sets the new DisplayMode in an implementation independant manner.

Specified by:
setDisplayModeImpl in class CanvasPeer

setGamma

public void setGamma(float gamma,
                     float brightness,
                     float contrast)
Changes the gamma-, brightness- and contrast values for this CanvasPeer.

Overrides:
setGamma in class CanvasPeer
Parameters:
gamma - the gamma value
brightness - the brightness value [-1.0, +1.0]
contrast - the contrast value [0, +1.0]

isRendering

public final boolean isRendering()
This flag is set by the Rendering system triggered by xith or by the CanvasPeer implementation itself (e.g when the CanvasPeer is auto-redrawn).

Specified by:
isRendering in class CanvasPeer

makeCurrent

protected java.lang.Thread makeCurrent()
Specified by:
makeCurrent in class CanvasPeerImplBase

beforeThreadChanged

public void beforeThreadChanged()
This method should be executed by the Thread that starts the actual rendering Thread right before it starts it. (LWJGL needs this)

Specified by:
beforeThreadChanged in class CanvasPeer

initRenderingImpl

protected java.lang.Object initRenderingImpl(View view,
                                             java.util.List<RenderPass> renderPasses,
                                             boolean layeredMode,
                                             long frameId,
                                             long nanoTime,
                                             long nanoStep,
                                             PickRequest pickRequest)
Initializes the rendering. The CanvasPeer implementation may decide when to actually do.

Specified by:
initRenderingImpl in class CanvasPeer
Parameters:
view - the View used to render
renderPasses - the List of RenderPasses to iterate and render
layeredMode - if true, the RenderPasses are handled in layered mode
frameId - the current frame's id
pickRequest - null for normal rendering

destroy

public void destroy()
Clears the screen (BLACK) and destroys the display.

Overrides:
destroy in class CanvasPeerImplBase