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