Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: gl4java/drawable/GLDrawable.java


1   package gl4java.drawable;
2   
3   import java.awt.event.*;
4   import java.util.EventListener;
5   
6   import gl4java.*;
7   
8   /** Abstracts common functionality among the OpenGL components such as
9       GLCanvas and GLJPanel. The GLDrawable/GLEventListener interfaces
10      allow client code to draw using OpenGL without subclassing. */
11  
12  public interface GLDrawable 
13  {
14      /** Add a GLEventListener to this drawable. If multiple listeners
15          are added to a given drawable, they are notified of events in an
16          arbitrary order. */
17      public void addGLEventListener(GLEventListener listener);
18  
19      /** Remove a GLEventListener from this drawable. */
20      public void removeGLEventListener(GLEventListener listener);
21  
22      /** Gets the GL functions used by this drawable. When running on
23          JDK 1.4 this will return a {@link gl4java.GLFunc14}. */
24      public GLFunc getGL();
25  
26      /** Gets the GLU functions used by this drawable. When running on
27          JDK 1.4 this will return a {@link gl4java.GLUFunc14}. */
28      public GLUFunc getGLU();
29  
30      /**
31       * Used to return the created GLContext
32       */
33      public GLContext getGLContext();
34  
35      /**
36       *
37       * This is the rendering-method called by 
38       * e.g.: {@link gl4java.awt.GLCanvas#display} or by 
39       * {@link gl4java.GLRunnable#run}.
40       * 
41       * <p>
42       * The default implementation of display() sends 
43       * preDisplay, display and postDisplay events to
44       * all {@link gl4java.drawable.GLEventListener}s associated with this
45       * GLDrawable in the above order.
46       *
47       * <p>
48       * <pre>
49          reset timer for frame duration
50  
51         for_all(gl4java.drawable.GLEventListener)
52      SEND preDisplay
53  
54    if( gljMakeCurrent() )
55    {
56      for_all(gl4java.drawable.GLEventListener)
57        SEND display
58      gljSwap()
59      gljFree()
60  
61      for_all(gl4java.drawable.GLEventListener)
62        SEND postDisplay
63    }
64  
65          stop timer for frame duration
66       * </pre>
67       *
68       * <p>
69       * If you use the subclassing model (as opposed to the
70       * GLEventListener model), your subclass will redefine this to
71       * perform its OpenGL drawing. In this case you MUST encapsulate
72       * your OpenGL calls within:
73       * <pre>
74        - glj.gljMakeCurrent()
75      YOUR OpenGL commands here !
76        - glj.gljFree()
77       * </pre>
78       *
79       * @return     void
80       *
81       * @see gl4java.GLContext#gljMakeCurrent
82       * @see gl4java.GLContext#gljFree 
83       * @see gl4java.GLContext#gljSwap 
84       * @see gl4java.drawable.GLEventListener#preDisplay
85       * @see gl4java.drawable.GLEventListener#display
86       * @see gl4java.drawable.GLEventListener#postDisplay
87       */
88      public void display();
89  
90      /**
91       * this function can be called to force a repaint
92       *
93       * Repaints this component. 
94       *
95       * This method causes a call to this component's update method 
96       * as soon as possible.
97       */
98      public void repaint();
99  
100     /**
101      * the components listener's should be implemented also !
102      * since JDK 1.1
103      */
104     public void addComponentListener(ComponentListener l);
105     public void removeComponentListener(ComponentListener l);
106     public void addFocusListener(FocusListener l);
107     public void addKeyListener(KeyListener l);
108     public void removeFocusListener(FocusListener l);
109     public void addMouseListener(MouseListener l);
110     public void removeMouseListener(MouseListener l);
111     public void addMouseMotionListener(MouseMotionListener l);
112     public void removeMouseMotionListener(MouseMotionListener l);
113     
114     /**
115      * JDK 1.2 the components listener's are left, 
116      * because of JDK 1.1 compatibility
117      *
118     public void addInputMethodListener(InputMethodListener l);
119     public void removeInputMethodListener(InputMethodListener l);
120     */
121 
122     /**
123      * JDK 1.3 the components listener's are left, 
124      * because of JDK 1.1 compatibility
125      * 
126     public void addHierarchyListener(HierarchyListener l);
127     public void removeHierarchyListener(HierarchyListener l);
128     public void addHierarchyBoundsListener(HierarchyBoundsListener l);
129     public void removeHierarchyBoundsListener(HierarchyBoundsListener l);
130     */
131 
132 
133     /**
134      * JDK 1.3 the listener's methods are left, 
135      * because of JDK 1.1 compatibility
136      * since JDK 1.3, e.g. implemented within GLCanvas
137      *
138     public EventListener[] getListeners(Class listenerType);
139     */
140 }