aboutsummaryrefslogtreecommitdiffstats
path: root/gl4java/drawable/GLEventListener.java
blob: feb388de82d45e64cb384c50b0c323f0ad1cf9b9 (plain)
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
package gl4java.drawable;

import gl4java.GLEnum;
import gl4java.GLUEnum;

/** Declares events which client code can handle to perform OpenGL
    rendering into a GLDrawable without subclassing. */

public interface GLEventListener
	extends java.util.EventListener, GLEnum, GLUEnum
{
  /** Called by the drawable immediately after the OpenGL context is
      initialized; the GLContext has already been made current when
      this method is called. Can be used to perform one-time OpenGL
      initialization such as setup of lights and display lists.

      @see gl4java.awt.GLCanvas#init
      @see gl4java.swing.GLJPanel#init
  */
  public void init(GLDrawable drawable);

  /** Called by the drawable before initiate rendering by the client. At
      the time this method is called, the duration for this frames
      time consume is started.
      After all GLEventListeners have been notified of a preDisplay event, 
      the drawable will continues with the
      {@link gl4java.drawable.GLEventListener#display} event.

      @see gl4java.awt.GLAnimCanvas#display
      @see gl4java.awt.GLCanvas#display
      @see gl4java.swing.GLJPanel#display
      @see gl4java.drawable.GLEventListener#display
      @see gl4java.drawable.GLEventListener#postDisplay
  */
  public void preDisplay(GLDrawable drawable);

  /** Called by the drawable to initiate rendering by the client. At
      the time this method is called, the drawable has already called
      {@link gl4java.drawable.GLEventListener#preDisplay} and made
      its associated GLContext current by a call to {@link
      gl4java.GLContext#gljMakeCurrent}. After all GLEventListeners
      have been notified of a display event, the drawable will swap
      its buffers if necessary and then free its GLContext with a call
      to {@link gl4java.GLContext#gljFree} and
      and continues with the 
      {@link gl4java.drawable.GLEventListener#postDisplay} event.
      So the GLContext is locked while the GLEventListeners
      receives this display event.

      @see gl4java.awt.GLAnimCanvas#display
      @see gl4java.awt.GLCanvas#display
      @see gl4java.swing.GLJPanel#display
      @see gl4java.drawable.GLEventListener#preDisplay
      @see gl4java.drawable.GLEventListener#postDisplay
  */
  public void display(GLDrawable drawable);

  /** Called by the drawable after initiate rendering by the client. At
      the time this method is called, the drawable has already called
      {@link gl4java.drawable.GLEventListener#display}.
      After all GLEventListeners
      have been notified of a postDisplay event, the 
      duration for the consumed time is stopped.

      @see gl4java.awt.GLAnimCanvas#display
      @see gl4java.awt.GLCanvas#display
      @see gl4java.swing.GLJPanel#display
      @see gl4java.drawable.GLEventListener#preDisplay
      @see gl4java.drawable.GLEventListener#display
      @see gl4java.drawable.GLEventListener#postDisplay
  */
  public void postDisplay(GLDrawable drawable);

  /** Called by the drawable if it wants to destroy itself.
      Here you can clean up any OpenGL stuff (delete textures
      or whatever) prior to actually deleting the OpenGL context.

      @see gl4java.awt.GLCanvas#doCleanup
      @see gl4java.swing.GLJPanel#doCleanup
  */
  public void cleanup(GLDrawable drawable);

  /** Called by the drawable during the first repaint after the
      component has been resized. The client can update the viewport
      and view volume of the window appropriately, for example by a
      call to {@link gl4java.GLFunc#glViewport}; note that for
      convenience the component has already called {@link
      gl4java.GLContext#gljResize}(width, height) and {@link
      gl4java.GLFunc.glViewport}(0, 0, width, height) when this method
      is called, so the client may not have to do anything in this
      method. At the time this method is called, the drawable has
      already made its associated GLContext current by a call to
      {@link gl4java.GLContext#gljMakeCurrent}. After all
      GLEventListeners have been notified of a reshape event, the
      drawable will free its GLContext with a call to {@link
      gl4java.GLContext#gljFree}.

      @see gl4java.awt.GLCanvas#reshape
      @see gl4java.swing.GLJPanel#reshape
 */
  public void reshape(GLDrawable drawable, int width, int height);
}