com.threerings.opengl
Class GlCanvasApp

java.lang.Object
  extended by com.threerings.expr.DynamicScope
      extended by com.threerings.opengl.GlApp
          extended by com.threerings.opengl.GlCanvasApp
All Implemented Interfaces:
EditorContext, Scope, ScopeUpdateListener, AlContext, Enqueueable, GlContext
Direct Known Subclasses:
GlCanvasTool

public abstract class GlCanvasApp
extends GlApp

A base class for applications centered around an OpenGL canvas.


Field Summary
protected  Component _canvas
          The render canvas.
protected  Root _canvasRoot
          The root.
protected  JFrame _frame
          The frame containing the canvas.
protected  KeyboardManager _keymgr
          The keyboard manager for the canvas.
 
Fields inherited from class com.threerings.opengl.GlApp
_at, _billboardRotation, _camhand, _cfgmgr, _clipprov, _colorpos, _compatibilityMode, _compositor, _epoch, _imgcache, _msgmgr, _now, _renderEffects, _renderer, _renderScheme, _rsrcmgr, _shadcache, _soundmgr, _streamGain, _up, _viewTransform, _viewTransformState, _worldTransform, PIXEL_FORMATS
 
Fields inherited from class com.threerings.expr.DynamicScope
_compoundDepth, _listeners, _owner, _parentScope, _scopeName, _symbols, INVALID_SCOPE
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
GlCanvasApp()
           
 
Method Summary
protected  Component createCanvas()
          Creates a canvas using one of our supported pixel formats.
protected  JComponent createCanvasContainer()
          Creates and returns the component that contains the canvas (after the canvas has been created).
 Root createRoot()
          Creates a user interface root appropriate for this application.
protected  void didInit()
          Override to perform custom initialization after the render context is valid.
 Component getCanvas()
          Returns a reference to the canvas.
 JFrame getFrame()
          Returns a reference to the containing frame.
 boolean getMouseRay(Ray3D result)
          Gets the ray through the canvas's mouse position.
 void getPickRay(int x, int y, Ray3D result)
          Finds the ray through the specified canvas coordinates.
 RunQueue getRunQueue()
          Returns a reference to the application's run queue.
protected  void initRenderer()
          Initializes the renderer.
 void makeCurrent()
          Makes the OpenGL context current.
 void shutdown()
          Shuts down the application.
 void startup()
          Starts up the application.
protected  void willShutdown()
          Override to perform cleanup before the application exits.
 
Methods inherited from class com.threerings.opengl.GlApp
compositeView, createCameraHandler, createSnapshot, enqueue, getApp, getCameraHandler, getClipProvider, getColorPository, getCompatibilityMode, getCompositor, getConfigManager, getImageCache, getMessageManager, getRenderEffects, getRenderer, getRenderScheme, getResourceManager, getScope, getShaderCache, getSoundManager, getStreamGain, init, initSharedManagers, renderView, setCameraHandler, setCompatibilityMode, setRenderEffects, setRenderer, setRenderScheme, shouldCheckTimestamps, updateView, updateView, xlate
 
Methods inherited from class com.threerings.expr.DynamicScope
addListener, dispose, endCompoundUpdate, get, getParentScope, getScopeName, put, remove, removeListener, scopeUpdated, setParentScope, startCompoundUpdate, wasUpdated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_frame

protected JFrame _frame
The frame containing the canvas.


_canvas

protected Component _canvas
The render canvas.


_canvasRoot

protected Root _canvasRoot
The root.


_keymgr

protected KeyboardManager _keymgr
The keyboard manager for the canvas.

Constructor Detail

GlCanvasApp

public GlCanvasApp()
Method Detail

getFrame

public JFrame getFrame()
Returns a reference to the containing frame.


getCanvas

public Component getCanvas()
Returns a reference to the canvas.


getMouseRay

public boolean getMouseRay(Ray3D result)
Gets the ray through the canvas's mouse position.

Returns:
true if the mouse cursor is on the canvas (in which case the result will be populated), false if it is not on the canvas.

getPickRay

public void getPickRay(int x,
                       int y,
                       Ray3D result)
Finds the ray through the specified canvas coordinates.


makeCurrent

public void makeCurrent()
Description copied from interface: GlContext
Makes the OpenGL context current.


getRunQueue

public RunQueue getRunQueue()
Description copied from class: GlApp
Returns a reference to the application's run queue.

Specified by:
getRunQueue in class GlApp

createRoot

public Root createRoot()
Description copied from class: GlApp
Creates a user interface root appropriate for this application.

Specified by:
createRoot in class GlApp

startup

public void startup()
Description copied from class: GlApp
Starts up the application.

Specified by:
startup in class GlApp

shutdown

public void shutdown()
Description copied from class: GlApp
Shuts down the application.

Specified by:
shutdown in class GlApp

initRenderer

protected void initRenderer()
Description copied from class: GlApp
Initializes the renderer.

Specified by:
initRenderer in class GlApp

didInit

protected void didInit()
Description copied from class: GlApp
Override to perform custom initialization after the render context is valid.

Overrides:
didInit in class GlApp

willShutdown

protected void willShutdown()
Description copied from class: GlApp
Override to perform cleanup before the application exits.

Overrides:
willShutdown in class GlApp

createCanvas

protected Component createCanvas()
Creates a canvas using one of our supported pixel formats.


createCanvasContainer

protected JComponent createCanvasContainer()
Creates and returns the component that contains the canvas (after the canvas has been created).