|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--com.hermetica.magician.GLComponent
A GLComponent object is a generic AWT Component that allows OpenGL commands to be rendered directly onto it. The benefit here is that standard Java AWT methods such as repaint() and resize() may be invoked against this Component and it will affect an associated OpenGL pipeline accordingly.
The main feature of the GLComponent class is that GLComponent objects can be parented into AWT Container objects and treated identically to the more standard AWT objects such as a Button or a Label. The GLComponent object is also subject to the same event handling mechanisms as other AWT classes.
GLComponents are never directly instantiated within Magician applications but are created by using the GLComponentFactory class which provides an abstracted way to create GLComponents straddling differences in Java implementations. This ensures that Magician applications remain portable across as many systems as possible.
Field Summary | |
protected static int |
DISPLAY_EVENT
|
protected static int |
INITIALIZE_EVENT
Event types this component can deal with |
protected static int |
RESHAPE_EVENT
|
static java.lang.String |
VERSION
Version information |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
GLComponent()
|
Method Summary | |
void |
addConsumer(java.awt.image.ImageConsumer ic)
Registers an ImageConsumer with this GLComponent as the target to which image data will be sent |
void |
addGLEventListener(GLEventListener listener)
This method registers a component listener with this component. |
void |
addNotify()
Handles peer-notification |
protected void |
createChoke()
Creates a new mutex for this component. |
void |
destroy()
Destroys the component completely. |
protected void |
generateID()
Generates a new unique id for the component. |
protected CriticalSection |
getChoke()
Returns the mutex associated with this component |
GLContext |
getContext()
Returns the rendering context associated with this component |
int |
getDesktopHeight()
Native method that returns the desktop height |
int |
getDesktopWidth()
Native method that returns the desktop width |
boolean |
getFlushOnRepaint()
Returns the current status of whether or not flushing the buffers after each listener display() method has been called will occur. |
int |
getGLContext()
Method used to fetch the OpenGL rendering context from this component's associated GLContext. |
protected int |
getID()
Returns the internal ID of a particular component |
GLEventListener |
getListener()
Returns the listener chain |
java.awt.Dimension |
getMinimumSize()
Gets the preferred size of the component |
java.awt.Dimension |
getPreferredSize()
Gets the preferred size of the component |
int |
getReadBuffer()
Returns the buffer from which pixel data reading will take place for image production. |
protected GLDrawable |
getSharedComponent()
Returns the shared component. |
boolean |
getTraceStatus()
Returns the warning level that a component is running at. |
int |
getWidget()
Method used to fetch the Widget / device context for this GLComponent. |
int |
getWindow()
Method used to fetch the window information of this component. |
protected abstract void |
init(GLDrawable component,
GLContext context,
int width,
int height)
Overridden method to allow deferred initialization |
boolean |
initialize()
Initializes the component. |
boolean |
isConsumer(java.awt.image.ImageConsumer ic)
Determines if a given ImageConsumer object is currently registered with this ImageProducer as one of its consumers. |
boolean |
isInitialized()
Tests to see whether the component is initialized |
boolean |
isOffscreen()
Specifies this component is onscreen |
boolean |
isRunning()
Returns whether or not the internal thread is running |
boolean |
isSuspended()
Returns whether or not the GLComponent is suspended |
boolean |
needsHeavyPeer()
Microsoft-VM-specific thing required to specify that a native window is required to render onto... |
void |
paint(java.awt.Graphics g)
Invokes the ``display()'' method within a class implementing GLEventListener. |
void |
postRedisplay()
Signals that a repaint event should take place as soon as possible. |
void |
processDisplayEvent(GLEventListener listener)
Processes a display event |
void |
processInitializeEvent(GLEventListener listener)
Processes an initialize event |
void |
processReshapeEvent(GLEventListener listener)
Processes a reshape event |
void |
removeConsumer(java.awt.image.ImageConsumer ic)
Removes the given consumer from the list of consumers currently registered to receive image data from this ImageProducer |
void |
removeGLEventListener(GLEventListener listener)
This method removes a GLEventListener from the listener chain |
void |
repaint()
Handles repainting the screen by directly using GL buffer control instead of the standard AWT refresh handling which causes flickering |
void |
requestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)
This method, used by an ImageConsumer, requests that the data be resent as soon as possible in TOPDOWNLEFTRIGHT order so that high quality image conversion might occur |
void |
reshape(int width,
int height)
This method traps window resizing events from AWT and invokes the ``reshape()'' method implemented in GLEventListener-based classes. |
void |
reshape(int x,
int y,
int width,
int height)
This method traps window resizing events from AWT and invokes the ``reshape()'' method implemented in GLEventListener-based classes. |
void |
resize(java.awt.Dimension dim)
This method traps window resizing events from AWT and invokes the ``reshape()'' method implemented in GLEventListener-based classes. |
void |
resize(int width,
int height)
This method traps window resizing events from AWT and invokes the ``reshape()'' method implemented in GLEventListener-based classes. |
void |
restart()
Reinitializes the component completely. |
void |
resume()
Resumes the component allowing it to process reshape, repaint and initialize events. |
void |
run()
The main driving thread of the GLComponent |
void |
setContext(GLContext context)
Sets the OpenGL context associated with this component. |
void |
setFlushOnRepaint(boolean mode)
Specifies whether or not the component should flush its buffers after all the pending repainting calls have been made in each listener. |
protected void |
setInitialized(boolean initializedStatus)
Sets the value of whether or not a component is initialized. |
protected void |
setListener(GLEventListener listener)
Sets the listener. |
void |
setReadBuffer(int buffer)
Sets the buffer from which pixel data should be read for image production |
protected void |
setRunning(boolean runningStatus)
Sets the running status of this component. |
protected void |
setSharedComponent(GLDrawable component)
Sets the shared Component, if necessary. |
void |
setSleepDuration(int ms)
Sets the sleep duration of the thread between iterations |
protected void |
setSuspended(boolean suspendedStatus)
Sets the status of whether or not the component is suspended. |
void |
setTraceStatus(boolean mode)
Sets the verbosity of Exception warning. |
void |
start()
Starts up the GLComponent handling. |
void |
startProduction(java.awt.image.ImageConsumer ic)
This method registers the given ImageConsumer as a consumer of pixel data produced by this ImageProducer and starts delivering data in pixel blocks to the registered ImageConsumers |
void |
stop()
Shuts down the internal thread safely. |
void |
suspend()
Stops the component from processing reshape, repaint and initialize events. |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
deliverEvent,
disable,
disableEvents,
dispatchEvent,
doLayout,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getAlignmentX,
getAlignmentY,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentAt,
getComponentAt,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getMaximumSize,
getName,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
invalidate,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
layout,
list,
list,
list,
list,
list,
locate,
location,
lostFocus,
minimumSize,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
paramString,
postEvent,
preferredSize,
prepareImage,
prepareImage,
print,
printAll,
processComponentEvent,
processEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
requestFocus,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setEnabled,
setFont,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus,
update,
validate |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String VERSION
protected static final int INITIALIZE_EVENT
protected static final int RESHAPE_EVENT
protected static final int DISPLAY_EVENT
Constructor Detail |
public GLComponent()
Method Detail |
public int getDesktopWidth()
public int getDesktopHeight()
protected abstract void init(GLDrawable component, GLContext context, int width, int height)
public final void setTraceStatus(boolean mode)
mode
- The new mode for verbose warnings or notpublic final boolean getTraceStatus()
public final void setContext(GLContext context)
context
- The context to associate with the componentpublic final GLContext getContext()
protected void createChoke()
protected CriticalSection getChoke()
protected void generateID()
protected int getID()
public final boolean initialize()
public final boolean isInitialized()
protected final void setInitialized(boolean initializedStatus)
public final void restart()
public final boolean isRunning()
protected final void setRunning(boolean runningStatus)
public final void start()
public final void suspend()
public final boolean isSuspended()
protected final void setSuspended(boolean suspendedStatus)
public final void resume()
public final void destroy()
public final void stop()
public final GLEventListener getListener()
protected final void setListener(GLEventListener listener)
protected void setSharedComponent(GLDrawable component)
protected GLDrawable getSharedComponent()
public void setFlushOnRepaint(boolean mode)
mode
- Specifies whether flushing should or should not occurpublic boolean getFlushOnRepaint()
public void setSleepDuration(int ms)
public void run()
public void processInitializeEvent(GLEventListener listener)
public void processReshapeEvent(GLEventListener listener)
public void processDisplayEvent(GLEventListener listener)
public void addGLEventListener(GLEventListener listener)
public void removeGLEventListener(GLEventListener listener)
public void postRedisplay()
public void repaint()
public void paint(java.awt.Graphics g)
This method should never be invoked directly. If you wish to refresh the display, call ``repaint()'' instead.
public void resize(int width, int height)
public void resize(java.awt.Dimension dim)
public void reshape(int width, int height)
public void reshape(int x, int y, int width, int height)
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension getMinimumSize()
public void addNotify()
public boolean needsHeavyPeer()
public void setReadBuffer(int buffer)
buffer
- The OpenGL buffer to read frompublic int getReadBuffer()
public int getWindow()
public int getGLContext()
public int getWidget()
public void addConsumer(java.awt.image.ImageConsumer ic)
public boolean isConsumer(java.awt.image.ImageConsumer ic)
public void removeConsumer(java.awt.image.ImageConsumer ic)
public void requestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)
public void startProduction(java.awt.image.ImageConsumer ic)
public boolean isOffscreen()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |