|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.piece.GLWindow
public class GLWindow
Window able to display GL graphics.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface cz.cuni.jagrlib.iface.GraphicsViewer |
---|
GraphicsViewer.PreviewThread |
Field Summary | |
---|---|
protected javax.media.opengl.GLCanvas |
canvas
GL canvas component - drawing target. |
static java.lang.String |
CANVAS_HEIGHT
|
protected static int |
CANVAS_HEIGHT_MAX
Maximal canvas height. |
protected static int |
CANVAS_HEIGHT_MIN
Minimal canvas height. |
static java.lang.String |
CANVAS_WIDTH
|
protected static int |
CANVAS_WIDTH_MAX
Maximal canvas width. |
protected static int |
CANVAS_WIDTH_MIN
Minimal canvas width. |
protected static java.lang.String |
CATEGORY
Object category. |
protected boolean |
continueRepaintLoop
Breaks the repaint loop from outside the repaintLoop() call. |
protected static java.lang.String |
DEFAULT_FRAME_TITLE
Default window title. |
protected static boolean |
DEFAULT_FULLSCREEN_VALUE
Default fullscreen value. |
protected static int |
DEFAULT_HEIGHT
Default canvas height in pixels. |
protected static int |
DEFAULT_WIDTH
Default canvas width in pixels. |
protected static long |
FPS_PERIOD
Minimal interval between two FPS-display times. |
protected static int |
FPS_QUEUE_SIZE
FPS-queue size (maximal number of previous frames used in FPS computation). |
protected long |
fpsLast
The last FPS-display time. |
protected int |
fpsPtr
Index of actual frame in fpsQueue . |
protected long[] |
fpsQueue
The FPS-queue data, actual frame is defined by fpsPtr . |
protected javax.swing.JFrame |
frame
Swing frame window to show graphic output in. |
protected java.lang.String |
frameTitle
Frame title (in order that setTitle() works every time). |
protected boolean |
fullscreen
Current state of fulscreen mode. |
static java.lang.String |
FULLSCREEN
|
protected GLGraphics |
gr
Actual GL graphics module (rendering source). |
protected int |
height
Current height of rendering canvas (in pixels). |
protected InputListener |
listener
InputListener connected through "direct" plug. |
protected java.util.List<InputListener> |
listeners
Set of actual input listeners. |
protected boolean |
makeSnapshot
Interthread variable for creating snapshot. |
static RegPiece |
reg
Static registration instance for this class. |
protected java.util.List<Semaphore> |
semaphores
Semaphores that will be signaled after the viewer window is closed. |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
protected boolean |
userBreak
Has the user-break occurred? |
protected int |
width
Current width of rendering canvas (in pixels). |
protected int |
x1
Minimal X coordinate of actual invalid region. |
protected int |
x2
Maximal X coordinate (outer bound) of actual invalid region. |
protected int |
y1
Minimal Y coordinate of actual invalid region. |
protected int |
y2
Maximal Y coordinate (outer bound) of actual invalid region. |
Fields inherited from class cz.cuni.jagrlib.Piece |
---|
channels, info, pl, plugs, TEMPLATE_TYPE |
Fields inherited from interface cz.cuni.jagrlib.iface.GraphicsViewer |
---|
BLACK_BACKGROUND, WINDOW_TITLE |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Constructor Summary | |
---|---|
GLWindow()
|
Method Summary | |
---|---|
void |
addInputListener(InputListener list)
Adds input listener object. |
void |
addSemaphore(Semaphore s)
Adds a new semaphore - object which wants to be signaled after the viewer window is closed (by user interaction etc.). |
void |
destroy()
Destroys the preview window. |
protected void |
doRepaint()
Does the repaint job itself (according the invalid region). |
boolean |
fire(int type)
Triggers the (undetermined) action. |
java.lang.Object |
get(java.lang.String key)
Gets the given property. |
void |
hudClear()
Removes all HUD primitives. |
int |
hudGetFreeId()
Returns id of any free HUD slot. |
void |
hudRemove(int id)
Removes existing HUD primitive. |
void |
hudSetLine(int id,
int x1,
int y1,
int x2,
int y2)
Replaces the given HUD primitive slot with line from [x1,y1] to [x2,y2] . |
void |
invalidate(int xMin,
int xMax,
int yMin,
int yMax)
Invalidates the given rectangular region of the graphics output. |
void |
removeInputListener(InputListener list)
Removes (previously added) input listener object. |
void |
removeSemaphore(Semaphore s)
Removes one of associated semaphores. |
void |
repaint()
Causes the instant repainting of actual invalid region of the graphic output. |
void |
repaintAll()
Causes the instant repainting of the whole graphic output (regardless of the actual invalid region). |
boolean |
repaintLoop()
Start (potentially) infinite repaint loop. |
void |
set(java.lang.String key,
java.lang.Object value)
Sets the given property. |
void |
setSize()
Sets size of frame due to fullscreen variable and width and height variables |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
boolean |
stopRepaintLoop()
Stops the running repaint loop. |
Methods inherited from class cz.cuni.jagrlib.Piece |
---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop |
Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, stringProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.jagrlib.iface.Property |
---|
commit |
Methods inherited from interface cz.cuni.jagrlib.Breakable |
---|
setProgressListener, stop |
Field Detail |
---|
protected static final int DEFAULT_WIDTH
protected static final int DEFAULT_HEIGHT
protected int width
protected int height
protected boolean fullscreen
protected int x1
protected int x2
protected int y1
protected int y2
protected static final int CANVAS_WIDTH_MIN
protected static final int CANVAS_WIDTH_MAX
protected static final int CANVAS_HEIGHT_MIN
protected static final int CANVAS_HEIGHT_MAX
protected static final boolean DEFAULT_FULLSCREEN_VALUE
protected static final java.lang.String DEFAULT_FRAME_TITLE
protected java.lang.String frameTitle
protected javax.swing.JFrame frame
protected javax.media.opengl.GLCanvas canvas
protected GLGraphics gr
protected boolean makeSnapshot
GLEventListener.display(javax.media.opengl.GLAutoDrawable)
protected boolean continueRepaintLoop
repaintLoop()
call.
repaintLoop()
,
stopRepaintLoop()
protected boolean userBreak
protected java.util.List<Semaphore> semaphores
Semaphore
,
addSemaphore(cz.cuni.jagrlib.Semaphore)
,
removeSemaphore(cz.cuni.jagrlib.Semaphore)
protected java.util.List<InputListener> listeners
addInputListener(cz.cuni.jagrlib.iface.InputListener)
,
removeInputListener(cz.cuni.jagrlib.iface.InputListener)
protected InputListener listener
protected static final long FPS_PERIOD
protected static final int FPS_QUEUE_SIZE
protected final long[] fpsQueue
fpsPtr
.
protected int fpsPtr
fpsQueue
.
protected long fpsLast
public static final java.lang.String FULLSCREEN
public static final java.lang.String CANVAS_WIDTH
public static final java.lang.String CANVAS_HEIGHT
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
Constructor Detail |
---|
public GLWindow()
Method Detail |
---|
protected void doRepaint()
repaintLoop()
public boolean repaintLoop()
stopRepaintLoop()
call or by external user
interaction (user break, window close, ..).
repaintLoop
in interface GraphicsViewer
true
if the loop was terminated by a
stopRepaintLoop()
call.stopRepaintLoop()
public void destroy()
destroy
in interface GraphicsViewer
public boolean stopRepaintLoop()
stopRepaintLoop
in interface GraphicsViewer
true
if the loop was successfully stopped.repaintLoop()
public void repaintAll()
Trigger.fire()
call has the same effect..
repaintAll
in interface GraphicsViewer
invalidate(int, int, int, int)
,
repaint()
,
Trigger.fire(int)
public void invalidate(int xMin, int xMax, int yMin, int yMax)
repaint()
call...
invalidate
in interface GraphicsViewer
xMin
- X coordinate of the upper left corner.xMax
- X coordinate of the lower right corner (outside pixel).yMin
- Y coordinate of the upper left corner.yMax
- Y coordinate of the upper left corner (outside pixel).repaint()
public void repaint()
repaint
in interface GraphicsViewer
repaintAll()
,
invalidate(int, int, int, int)
public void addSemaphore(Semaphore s)
addSemaphore
in interface GraphicsViewer
s
- A new semaphore instance.removeSemaphore(cz.cuni.jagrlib.Semaphore)
public void removeSemaphore(Semaphore s)
removeSemaphore
in interface GraphicsViewer
s
- Semaphore to be removed.addSemaphore(cz.cuni.jagrlib.Semaphore)
public void addInputListener(InputListener list)
addInputListener
in interface GraphicsViewer
public void removeInputListener(InputListener list)
removeInputListener
in interface GraphicsViewer
public void hudClear()
GraphicsViewer
hudClear
in interface GraphicsViewer
public int hudGetFreeId()
GraphicsViewer
hudGetFreeId
in interface GraphicsViewer
public void hudSetLine(int id, int x1, int y1, int x2, int y2)
GraphicsViewer
[x1,y1]
to [x2,y2]
.
hudSetLine
in interface GraphicsViewer
public void hudRemove(int id)
GraphicsViewer
hudRemove
in interface GraphicsViewer
public boolean fire(int type)
fire
in interface Trigger
type
- The action type (whatever it means..).
true
if the action was successful.public void set(java.lang.String key, java.lang.Object value)
set
in interface Property
set
in class DefaultProperty
key
- Key string.value
- The new value.Property.commit()
public void setSize()
public java.lang.Object get(java.lang.String key)
get
in interface Property
get
in class DefaultProperty
key
- Key string.
null
.public static int setTemplate(Template t, int ord)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |