org.xith3d.render.jsr231
Class CanvasPeerImplSWT

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

public class CanvasPeerImplSWT
extends CanvasPeerImplBase

The CanvasPeer implementation for the official Java OpenGL Bindings (JOGL) and SWT.


Field Summary
 
Fields inherited from class org.xith3d.render.jsr231.CanvasPeerImplBase
swapIntervalChanged
 
Fields inherited from class org.xith3d.render.CanvasPeer
isGammaChanged, oglInfo
 
Constructor Summary
CanvasPeerImplSWT(java.lang.Object owner, DisplayMode displayMode, DisplayMode.FullscreenMode fullscreen, boolean vsync, FSAA fsaa, int depthBufferSize)
           
 
Method Summary
 void beforeThreadChanged()
          This method should be executed by the Thread that starts the actual rendering Thread right before it starts it.
 void clear()
          Clears the screen to BLACK.
 void destroy()
          Clears the screen (BLACK) and destroys the display.
protected  void ensureSWT()
           
 org.eclipse.swt.opengl.GLCanvas getComponent()
          
 org.eclipse.swt.opengl.GLCanvas getDrawable()
           
 javax.media.opengl.GL getGL()
           
 int getHeight()
          Gets the width in an implementation independant manner
 org.jagatoo.input.impl.swt.SWTInputDeviceFactory 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
 org.eclipse.swt.widgets.Composite 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.
protected  void initSWT()
           
 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).
 boolean receivesInputEvents()
          
 void refreshCursor(org.jagatoo.input.devices.Mouse mouse)
          
protected  void setAutoSwapBufferMode(boolean mode)
           
protected  boolean setDisplayModeImpl(DisplayMode displayMode)
          Sets the new DisplayMode in an implementation independant manner.
 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.jsr231.CanvasPeerImplBase
addDestroyableObject, beforeRenderStart, createRenderPeer, doRender, getCurrentViewport, getExpectedNativeDisplayModeClass, getMaxViewport, getRenderedFrames, getRenderPeer, getSwapInterval, init, isInitialized, setSwapInterval, 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, setGamma, 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

CanvasPeerImplSWT

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

getInputDeviceFactory

public org.jagatoo.input.impl.swt.SWTInputDeviceFactory getInputDeviceFactory(org.jagatoo.input.InputSystem inputSystem)

getDrawable

public final org.eclipse.swt.opengl.GLCanvas getDrawable()

refreshCursor

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


receivesInputEvents

public final boolean receivesInputEvents()


initSWT

protected void initSWT()

ensureSWT

protected final void ensureSWT()

getType

public OpenGLLayer getType()

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

setVSyncEnabled

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

Overrides:
setVSyncEnabled in class CanvasPeer

getGL

public final javax.media.opengl.GL getGL()
Specified by:
getGL in class CanvasPeerImplBase

getWindow

public final org.eclipse.swt.widgets.Composite getWindow()

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

getComponent

public final org.eclipse.swt.opengl.GLCanvas 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

setAutoSwapBufferMode

protected void setAutoSwapBufferMode(boolean mode)
Specified by:
setAutoSwapBufferMode in class CanvasPeerImplBase

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

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

clear

public void clear()
Clears the screen to BLACK.

Overrides:
clear in class CanvasPeerImplBase

destroy

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

Overrides:
destroy in class CanvasPeer