com.jme.system.jogl
Class JOGLDisplaySystem

java.lang.Object
  extended by com.jme.system.DisplaySystem
      extended by com.jme.system.jogl.JOGLDisplaySystem

public class JOGLDisplaySystem
extends DisplaySystem

Author:
Steve Vaughan

Field Summary
 
Fields inherited from class com.jme.system.DisplaySystem
alphaBits, bpp, brightness, contrast, created, depthBits, frq, fs, gamma, height, samples, stencilBits, width
 
Constructor Summary
JOGLDisplaySystem()
           
 
Method Summary
 void close()
          close shutdowns and destroys any window contexts.
 JMECanvas createCanvas(int width, int height)
          createCanvas should create a canvas object with the desired settings.
 JMECanvas createCanvas(int width, int height, java.lang.String type, java.util.HashMap<java.lang.String,java.lang.Object> props)
          createCanvas should create a canvas object with the desired settings.
static JOGLAWTCanvas createGLCanvas()
           
 void createHeadlessWindow(int w, int h, int bpp)
          createHeadlessWindow creates a headless window with the desired settings.
 TextureRenderer createTextureRenderer(int width, int height, TextureRenderer.Target target)
          Create a TextureRenderer using the underlying system.
 void createWindow(int width, int height, int bpp, int frq, boolean fs)
          createWindow creates a window with the desired settings.
 java.lang.String getAdapter()
          getAdapter returns the name of the underlying system's graphics adapter for debugging / display purposes.
 RenderContext<GLContext> getCurrentContext()
           
 java.lang.String getDisplayAPIVersion()
          getDisplayAPIVersion returns the API version supported
 java.lang.String getDisplayRenderer()
          getDisplayRenderer returns details of the adapter
 java.lang.String getDisplayVendor()
          getDisplayVendor returns the vendor of the graphics adapter
 java.lang.String getDriverVersion()
          getDriverVersion returns a string representing the version of driver installed on the underlying system.
 JOGLRenderer getRenderer()
          getRenderer returns the Renderer implementation that is compatible with the chosen DisplaySystem.
 void initForCanvas(int width, int height)
          This will be called from a GLEventListener, meaning that the Component will have been realized and the GLContext will already have been made current.
 boolean isActive()
          isActive returns true if the display is active.
 boolean isClosing()
          isClosing notifies if the window is currently closing.
 boolean isValidDisplayMode(int width, int height, int bpp, int freq)
          isValidDisplayMode determines if the given parameters constitute a valid display mode on this system.
 void moveWindowTo(int locX, int locY)
          If running in windowed mode, move the window's position to the given display coordinates.
 void recreateWindow(int w, int h, int bpp, int frq, boolean fs)
          recreateWindow recreates a window with the desired settings.
 RenderContext<GLContext> removeContext(GLContext contextKey)
           
 void reset()
          reset cleans up the display system for closing or restarting.
 void setIcon(Image[] iconImages)
          Sets one or more icons for the DisplaySystem.
 void setRenderer(Renderer renderer)
          setRenderer sets the Renderer object that is to be used by this display.
 void setTitle(java.lang.String title)
          Sets the title of the display system.
 void setVSyncEnabled(boolean enabled)
          setVSyncEnabled attempts to enable or disable monitor vertical synchronization.
 RenderContext<GLContext> switchContext(GLContext contextKey)
          Switches to another RenderContext identified by the contextKey or to a new RenderContext if none is provided.
protected  void updateDisplayBGC()
          Update the display's gamma, brightness and contrast based on the set values.
 
Methods inherited from class com.jme.system.DisplaySystem
getBitDepth, getBrightness, getContrast, getDisplaySystem, getDisplaySystem, getFrequency, getGamma, getHeight, getMinAlphaBits, getMinDepthBits, getMinSamples, getMinStencilBits, getPickRay, getScreenCoordinates, getScreenCoordinates, getSystemProvider, getSystemProviderIdentifiers, getWidth, getWorldCoordinates, getWorldCoordinates, isCreated, isFullScreen, makeCanvasConstructor, registerCanvasConstructor, resetSystemProvider, setBrightness, setBrightnessGammaContrast, setContrast, setGamma, setHeight, setMinAlphaBits, setMinDepthBits, setMinSamples, setMinStencilBits, setSystemProvider, setWidth, updateStates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JOGLDisplaySystem

JOGLDisplaySystem()
Method Detail

createWindow

public void createWindow(int width,
                         int height,
                         int bpp,
                         int frq,
                         boolean fs)
Description copied from class: DisplaySystem
createWindow creates a window with the desired settings. The width and height defined by w and h define the size of the window if fullscreen is false, otherwise it defines the resolution of the fullscreen display. The color depth is defined by bpp. The implementing class should only allow 16, 24, and 32. The monitor frequency is defined by the frq parameter and should not exceed the capabilities of the connected hardware, the implementing class should attempt to assure this does not happen. Lastly, the boolean flag fs determines if the display should be windowed or fullscreen. If false, windowed is chosen. This window will be placed in the center of the screen initially. If true fullscreen mode will be entered with the appropriate settings.

Specified by:
createWindow in class DisplaySystem
Parameters:
width - the width/horizontal resolution of the display.
height - the height/vertical resolution of the display.
bpp - the color depth of the display.
frq - the frequency of refresh of the display.
fs - flag determining if fullscreen is to be used or not. True will use fullscreen, false will use windowed mode.

createCanvas

public JMECanvas createCanvas(int width,
                              int height)
Description copied from class: DisplaySystem
createCanvas should create a canvas object with the desired settings. The width and height defined by w and h define the size of the canvas. Makes an AWT canvas by default.

Overrides:
createCanvas in class DisplaySystem
Parameters:
width - the width/horizontal resolution of the display.
height - the height/vertical resolution of the display.

createCanvas

public JMECanvas createCanvas(int width,
                              int height,
                              java.lang.String type,
                              java.util.HashMap<java.lang.String,java.lang.Object> props)
Description copied from class: DisplaySystem
createCanvas should create a canvas object with the desired settings. The width and height defined by w and h define the size of the canvas.

Specified by:
createCanvas in class DisplaySystem
Parameters:
width - the width/horizontal resolution of the display.
height - the height/vertical resolution of the display.
type - the type of canvas to make. e.g. "AWT", "SWT".
props - the properties we want to use (if any) for constructing our canvas.

createHeadlessWindow

public void createHeadlessWindow(int w,
                                 int h,
                                 int bpp)
Description copied from class: DisplaySystem
createHeadlessWindow creates a headless window with the desired settings. A headless window is a rendering target that is not shown on screen. It is useful for doing offline rendering, integration and so forth. You can not have a regular and headless window at the same time. The width and height defined by w and h define the size of the window. The color depth is defined by bpp.

Specified by:
createHeadlessWindow in class DisplaySystem
Parameters:
w - the width/horizontal resolution of the display.
h - the height/vertical resolution of the display.
bpp - the color depth of the display.

createTextureRenderer

public TextureRenderer createTextureRenderer(int width,
                                             int height,
                                             TextureRenderer.Target target)
Description copied from class: DisplaySystem
Create a TextureRenderer using the underlying system.

Specified by:
createTextureRenderer in class DisplaySystem
Parameters:
width - width of texture
height - height of texture
Returns:
A TextureRenderer for the display system.

createGLCanvas

public static JOGLAWTCanvas createGLCanvas()

getRenderer

public JOGLRenderer getRenderer()
Description copied from class: DisplaySystem
getRenderer returns the Renderer implementation that is compatible with the chosen DisplaySystem. For example, if LWJGLDisplaySystem is used, the returned Renderer will be LWJGLRenderer.

Specified by:
getRenderer in class DisplaySystem
Returns:
the appropriate Renderer implementation that is compatible with the used DisplaySystem.
See Also:
Renderer

setTitle

public void setTitle(java.lang.String title)
Description copied from class: DisplaySystem
Sets the title of the display system. This is usually reflected by the renderer as text in the menu bar.

Specified by:
setTitle in class DisplaySystem
Parameters:
title - The new display title.

getAdapter

public java.lang.String getAdapter()
Description copied from class: DisplaySystem
getAdapter returns the name of the underlying system's graphics adapter for debugging / display purposes.

Specified by:
getAdapter in class DisplaySystem
Returns:
the adapter's name as a String

getCurrentContext

public RenderContext<GLContext> getCurrentContext()
Specified by:
getCurrentContext in class DisplaySystem
Returns:
a RenderContext object representing the current OpenGL context.

getDisplayAPIVersion

public java.lang.String getDisplayAPIVersion()
Description copied from class: DisplaySystem
getDisplayAPIVersion returns the API version supported

Specified by:
getDisplayAPIVersion in class DisplaySystem
Returns:
The api version supported

getDisplayRenderer

public java.lang.String getDisplayRenderer()
Description copied from class: DisplaySystem
getDisplayRenderer returns details of the adapter

Specified by:
getDisplayRenderer in class DisplaySystem
Returns:
The adapter details

getDisplayVendor

public java.lang.String getDisplayVendor()
Description copied from class: DisplaySystem
getDisplayVendor returns the vendor of the graphics adapter

Specified by:
getDisplayVendor in class DisplaySystem
Returns:
The adapter vendor

getDriverVersion

public java.lang.String getDriverVersion()
Description copied from class: DisplaySystem
getDriverVersion returns a string representing the version of driver installed on the underlying system.

Specified by:
getDriverVersion in class DisplaySystem
Returns:
the version as a String

initForCanvas

public void initForCanvas(int width,
                          int height)
This will be called from a GLEventListener, meaning that the Component will have been realized and the GLContext will already have been made current.


isActive

public boolean isActive()
Description copied from class: DisplaySystem
isActive returns true if the display is active.

Specified by:
isActive in class DisplaySystem
Returns:
whether the display system is active.

isClosing

public boolean isClosing()
Description copied from class: DisplaySystem
isClosing notifies if the window is currently closing. This could be caused via the application itself or external interrupts such as alt-f4 etc.

Specified by:
isClosing in class DisplaySystem
Returns:
true if the window is closing, false otherwise.

isValidDisplayMode

public boolean isValidDisplayMode(int width,
                                  int height,
                                  int bpp,
                                  int freq)
Description copied from class: DisplaySystem
isValidDisplayMode determines if the given parameters constitute a valid display mode on this system. Returning true does not necessarily guarantee that the system is capable of running in the specified display mode, merely that it believes it is possible.

Specified by:
isValidDisplayMode in class DisplaySystem
Parameters:
width - the width/horizontal resolution of the display.
height - the height/vertical resolution of the display.
bpp - the bit depth of the display.
freq - the frequency of refresh of the display (in Hz).

moveWindowTo

public void moveWindowTo(int locX,
                         int locY)
Description copied from class: DisplaySystem
If running in windowed mode, move the window's position to the given display coordinates.

Specified by:
moveWindowTo in class DisplaySystem

recreateWindow

public void recreateWindow(int w,
                           int h,
                           int bpp,
                           int frq,
                           boolean fs)
Description copied from class: DisplaySystem
recreateWindow recreates a window with the desired settings.

Specified by:
recreateWindow in class DisplaySystem
Parameters:
w - the width/horizontal resolution of the display.
h - the height/vertical resolution of the display.
bpp - the color depth of the display.
frq - the frequency of refresh of the display.
fs - flag determining if fullscreen is to be used or not. True will use fullscreen, false will use windowed mode.

reset

public void reset()
Description copied from class: DisplaySystem
reset cleans up the display system for closing or restarting.

Specified by:
reset in class DisplaySystem

setIcon

public void setIcon(Image[] iconImages)
Description copied from class: DisplaySystem
Sets one or more icons for the DisplaySystem.

As a reference for usual platforms on number of icons and their sizes:

Images should be in format RGBA8888. If they are not jME will try to convert them using ImageUtils. If that fails a JmeException could be thrown.

Specified by:
setIcon in class DisplaySystem
Parameters:
iconImages - Array of Images to be used as icons.

setRenderer

public void setRenderer(Renderer renderer)
Description copied from class: DisplaySystem
setRenderer sets the Renderer object that is to be used by this display. The implementing class should take measures to insure that the given Renderer is compatible with the Display.

Specified by:
setRenderer in class DisplaySystem
Parameters:
renderer - the Renderer to set for this display.

setVSyncEnabled

public void setVSyncEnabled(boolean enabled)
Description copied from class: DisplaySystem
setVSyncEnabled attempts to enable or disable monitor vertical synchronization. The method is a "best attempt" to change the monitor vertical refresh synchronization, and is not guaranteed to be successful. This is dependant on OS.

Specified by:
setVSyncEnabled in class DisplaySystem
Parameters:
enabled - true to synchronize, false to ignore synchronization

updateDisplayBGC

protected void updateDisplayBGC()
Description copied from class: DisplaySystem
Update the display's gamma, brightness and contrast based on the set values.

Specified by:
updateDisplayBGC in class DisplaySystem

close

public void close()
Description copied from class: DisplaySystem
close shutdowns and destroys any window contexts.

Specified by:
close in class DisplaySystem

switchContext

public RenderContext<GLContext> switchContext(GLContext contextKey)
Switches to another RenderContext identified by the contextKey or to a new RenderContext if none is provided.

Parameters:
contextKey - key identifier
Returns:
RenderContext identified by the contextKey or new RenderContext if none provided

removeContext

public RenderContext<GLContext> removeContext(GLContext contextKey)