All Packages  This Package  Class Hierarchy  Class Search  Index

Class com.hermetica.magician.GLComponent
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----com.hermetica.magician.GLComponent

  Summary

public abstract class  GLComponent
     extends java.awt.Canvas
     implements java.lang.Runnable, 
                com.hermetica.magician.GLDrawable, 
                java.awt.image.ImageProducer
{
          // Fields 4
     protected static final int DISPLAY_EVENT;
     protected static final int INITIALIZE_EVENT;
     protected static final int RESHAPE_EVENT;
     public static final String VERSION;

          // Constructors 1
     public GLComponent();

          // Methods 56
     public void addConsumer(ImageConsumer);
     public synchronized void addGLEventListener(GLEventListener);
     protected void createChoke();
     public final synchronized void destroy();
     protected void generateID();
     protected CriticalSection getChoke();
     public final GLContext getContext();
     public native int getDesktopHeight();
     public native int getDesktopWidth();
     public boolean getFlushOnRepaint();
     public native int getGLContext();
     protected int getID();
     public final GLEventListener getListener();
     public Dimension getMinimumSize();
     public Dimension getPreferredSize();
     public int getReadBuffer();
     protected GLComponent getSharedComponent();
     public final boolean getTraceStatus();
     public native int getWidget();
     public native int getWindow();
     public final synchronized boolean initialize();
     public boolean isConsumer(ImageConsumer);
     public final boolean isInitialized();
     public final boolean isRunning();
     public final boolean isSuspended();
     public boolean needsHeavyPeer();
     public void paint(Graphics);
     public void postRedisplay();
     public void processDisplayEvent(GLEventListener);
     public void processInitializeEvent(GLEventListener);
     public void processReshapeEvent(GLEventListener);
     public void removeConsumer(ImageConsumer);
     public synchronized void removeGLEventListener(GLEventListener);
     public void repaint();
     public void requestTopDownLeftRightResend(ImageConsumer);
     public void reshape(int, int);
     public void reshape(int, int, int, int);
     public void resize(int, int);
     public void resize(Dimension);
     public final synchronized void restart();
     public final synchronized void resume();
     public void run();
     public final void setContext(GLContext);
     public void setFlushOnRepaint(boolean);
     protected final void setInitialized(boolean);
     protected final void setListener(GLEventListener);
     public void setReadBuffer(int);
     protected final void setRunning(boolean);
     protected void setSharedComponent(GLComponent);
     public void setSleepDuration(int);
     protected final void setSuspended(boolean);
     public final void setTraceStatus(boolean);
     public final synchronized void start();
     public void startProduction(ImageConsumer);
     public final synchronized void stop();
     public final synchronized void suspend();
}

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.

Version:
$Id: GLComponent.java,v 1.15 1998/10/31 11:09:21 descarte Exp descarte $
Author:
Alligator Descartes <descarte@arcana.co.uk> , Jason Osgood


  Cross Reference

Returned By:
GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponentFactory.createGLComponent(), GLComponent.getSharedComponent(), GLContext.getComponent(), GLUTesselator.getComponent()





  Fields

· VERSION

Summary  |  Top
   public static final String VERSION

Version information


· INITIALIZE_EVENT

Summary  |  Top
   protected static final int INITIALIZE_EVENT

Event types this component can deal with


· RESHAPE_EVENT

Summary  |  Top
   protected static final int RESHAPE_EVENT


· DISPLAY_EVENT

Summary  |  Top
   protected static final int DISPLAY_EVENT


  Constructors

· GLComponent

Summary  |  Top

   public GLComponent() 

Default constructor



  Methods

· getDesktopWidth

Summary  |  Top
   public native int getDesktopWidth() 

Native method that returns the desktop width



· getDesktopHeight

Summary  |  Top
   public native int getDesktopHeight() 

Native method that returns the desktop height



· setTraceStatus

Summary  |  Top
   public final void setTraceStatus(boolean mode) 

Sets the verbosity of Exception warning. The default is false, ie, if there are any internal exceptions caught by the component, it won't tell you about them. Set this to true if you want the message of each caught Exception printed to System.err and the internal locks traced.

Parameter Description
mode The new mode for verbose warnings or not



· getTraceStatus

Summary  |  Top
   public final boolean getTraceStatus() 

Returns the warning level that a component is running at. The return value is either true signifying that debugging is on, or false signifying that it's not



· setContext

Summary  |  Top
   public final void setContext(GLContext context) 

Sets the OpenGL context associated with this component.

Parameter Description
context The context to associate with the component



· getContext

Summary  |  Top
   public final GLContext getContext() 

Returns the rendering context associated with this component

Implements:
getContext in interface GLDrawable


· createChoke

Summary  |  Top
   protected void createChoke() 

Creates a new mutex for this component. Internal use only.



· getChoke

Summary  |  Top
   protected CriticalSection getChoke() 

Returns the mutex associated with this component



· generateID

Summary  |  Top
   protected void generateID() 

Generates a new unique id for the component. Used internally only.



· getID

Summary  |  Top
   protected int getID() 

Returns the internal ID of a particular component



· initialize

Summary  |  Top
   public final synchronized boolean initialize() 

Initializes the component. This MUST be called before anything will happen with the component.

Implements:
initialize in interface GLDrawable


· isInitialized

Summary  |  Top
   public final boolean isInitialized() 

Tests to see whether the component is initialized

Implements:
isInitialized in interface GLDrawable


· setInitialized

Summary  |  Top
   protected final void setInitialized(boolean initializedStatus) 

Sets the value of whether or not a component is initialized. This is used internally only...



· restart

Summary  |  Top
   public final synchronized void restart() 

Reinitializes the component completely. This leaves the component in the same state as if the constructor had just been called.

Implements:
restart in interface GLDrawable


· isRunning

Summary  |  Top
   public final boolean isRunning() 

Returns whether or not the internal thread is running

Implements:
isRunning in interface GLDrawable


· setRunning

Summary  |  Top
   protected final void setRunning(boolean runningStatus) 

Sets the running status of this component. Used internally only.



· start

Summary  |  Top
   public final synchronized void start() 

Starts up the GLComponent handling. Without calling start(), no reshape, repaint or initialize events will be processed.

Implements:
start in interface GLDrawable


· suspend

Summary  |  Top
   public final synchronized void suspend() 

Stops the component from processing reshape, repaint and initialize events. This is useful in cases where you might have minimised the component and do not wish it to continue processing.

Implements:
suspend in interface GLDrawable


· isSuspended

Summary  |  Top
   public final boolean isSuspended() 

Returns whether or not the GLComponent is suspended

Implements:
isSuspended in interface GLDrawable


· setSuspended

Summary  |  Top
   protected final void setSuspended(boolean suspendedStatus) 

Sets the status of whether or not the component is suspended. This is to be used internally only....



· resume

Summary  |  Top
   public final synchronized void resume() 

Resumes the component allowing it to process reshape, repaint and initialize events.

Implements:
resume in interface GLDrawable


· destroy

Summary  |  Top
   public final synchronized void destroy() 

Destroys the component completely. This has the effect of freeing up all internal resources of this component.

Implements:
destroy in interface GLDrawable


· stop

Summary  |  Top
   public final synchronized void stop() 

Shuts down the internal thread safely. This is used when both stopping the component ( if you wished to change its mode of operation from dynamic to static ) and when destroying the component completely

Implements:
stop in interface GLDrawable


· getListener

Summary  |  Top
   public final GLEventListener getListener() 

Returns the listener chain

Implements:
getListener in interface GLDrawable


· setListener

Summary  |  Top
   protected final void setListener(GLEventListener listener) 

Sets the listener. This is to be used internally only....



· setSharedComponent

Summary  |  Top
   protected void setSharedComponent(GLComponent component) 

Sets the shared Component, if necessary. This is used internally only...



· getSharedComponent

Summary  |  Top
   protected GLComponent getSharedComponent() 

Returns the shared component. This is used internally only.



· setFlushOnRepaint

Summary  |  Top
   public 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. By default, flushing will occur.

Parameter Description
mode Specifies whether flushing should or should not occur



· getFlushOnRepaint

Summary  |  Top
   public boolean getFlushOnRepaint() 

Returns the current status of whether or not flushing the buffers after each listener display() method has been called will occur. By default, flushing will occur.



· setSleepDuration

Summary  |  Top
   public void setSleepDuration(int ms) 

Sets the sleep duration of the thread between iterations



· run

Summary  |  Top
   public void run() 

The main driving thread of the GLComponent

Implements:
run in interface Runnable


· processInitializeEvent

Summary  |  Top
   public void processInitializeEvent(GLEventListener listener) 

Processes an initialize event

Implements:
processInitializeEvent in interface GLDrawable


· processReshapeEvent

Summary  |  Top
   public void processReshapeEvent(GLEventListener listener) 

Processes a reshape event

Implements:
processReshapeEvent in interface GLDrawable


· processDisplayEvent

Summary  |  Top
   public void processDisplayEvent(GLEventListener listener) 

Processes a display event

Implements:
processDisplayEvent in interface GLDrawable


· addGLEventListener

Summary  |  Top
   public synchronized void addGLEventListener(GLEventListener listener) 

This method registers a component listener with this component. The GLEventListener is used to route any resizing and refreshing events through to the main program which handles them accordingly

Implements:
addGLEventListener in interface GLDrawable


· removeGLEventListener

Summary  |  Top
   public synchronized void removeGLEventListener(GLEventListener listener) 

This method removes a GLEventListener from the listener chain

Implements:
removeGLEventListener in interface GLDrawable


· postRedisplay

Summary  |  Top
   public void postRedisplay() 

Signals that a repaint event should take place as soon as possible. This is basically a GLUT-like cosmetic function.

Implements:
postRedisplay in interface GLDrawable


· repaint

Summary  |  Top
   public void repaint() 

Handles repainting the screen by directly using GL buffer control instead of the standard AWT refresh handling which causes flickering

Overrides:
repaint in class Component
Implements:
repaint in interface GLDrawable


· paint

Summary  |  Top
   public void paint(Graphics g) 

Invokes the ``display()'' method within a class implementing GLEventListener. This class acquires a context lock and handles appropriate buffer swapping for you, ie, glFlush() is called for single-buffered contexts and swapBuffers() is called for double-buffered contexts.

This method should never be invoked directly. If you wish to refresh the display, call ``repaint()'' instead.

Overrides:
paint in class Canvas
Implements:
paint in interface GLDrawable


· resize

Summary  |  Top
   public void resize(int width, 
                      int height) 

This method traps window resizing events from AWT and invokes the ``reshape()'' method implemented in GLEventListener-based classes.

Overrides:
resize in class Component


· resize

Summary  |  Top
   public void resize(Dimension dim) 

This method traps window resizing events from AWT and invokes the ``reshape()'' method implemented in GLEventListener-based classes.

Overrides:
resize in class Component


· reshape

Summary  |  Top
   public void reshape(int width, 
                       int height) 

This method traps window resizing events from AWT and invokes the ``reshape()'' method implemented in GLEventListener-based classes. Before it does so, it will acquire a context lock for you and release it after the ``reshape()'' method has been invoked.



· reshape

Summary  |  Top
   public 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. Before it does so, it will acquire a context lock for you and release it after the ``reshape()'' method has been invoked.

Overrides:
reshape in class Component


· getPreferredSize

Summary  |  Top
   public Dimension getPreferredSize() 

Gets the preferred size of the component

Overrides:
getPreferredSize in class Component


· getMinimumSize

Summary  |  Top
   public Dimension getMinimumSize() 

Gets the preferred size of the component

Overrides:
getMinimumSize in class Component


· needsHeavyPeer

Summary  |  Top
   public boolean needsHeavyPeer() 

Microsoft-VM-specific thing required to specify that a native window is required to render onto...



· setReadBuffer

Summary  |  Top
   public void setReadBuffer(int buffer) 

Sets the buffer from which pixel data should be read for image production

Parameter Description
buffer The OpenGL buffer to read from



· getReadBuffer

Summary  |  Top
   public int getReadBuffer() 

Returns the buffer from which pixel data reading will take place for image production.



· getWindow

Summary  |  Top
   public native int getWindow() 

Method used to fetch the window information of this component. This method should not be called directly from Java and should only be used within the context of the Extension Developer's Kit. This method is subject to change name or functionality between releases.



· getGLContext

Summary  |  Top
   public native int getGLContext() 

Method used to fetch the OpenGL rendering context from this component's associated GLContext. This method should not be called directly from Java and should only be used within the context of the Extension Developer's Kit. This method is subject to change name or functionality between releases.



· getWidget

Summary  |  Top
   public native int getWidget() 

Method used to fetch the Widget / device context for this GLComponent. This method should not be called directly from Java and should only be used within the context of the Extension Developer's Kit. This method is subject to change name or functionality between releases.



· addConsumer

Summary  |  Top
   public void addConsumer(ImageConsumer ic) 

Registers an ImageConsumer with this GLComponent as the target to which image data will be sent

Implements:
addConsumer in interface ImageProducer


· isConsumer

Summary  |  Top
   public boolean isConsumer(ImageConsumer ic) 

Determines if a given ImageConsumer object is currently registered with this ImageProducer as one of its consumers.

Implements:
isConsumer in interface ImageProducer


· removeConsumer

Summary  |  Top
   public void removeConsumer(ImageConsumer ic) 

Removes the given consumer from the list of consumers currently registered to receive image data from this ImageProducer

Implements:
removeConsumer in interface ImageProducer


· requestTopDownLeftRightResend

Summary  |  Top
   public void requestTopDownLeftRightResend(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

Implements:
requestTopDownLeftRightResend in interface ImageProducer


· startProduction

Summary  |  Top
   public void startProduction(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

Implements:
startProduction in interface ImageProducer


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7