aboutsummaryrefslogtreecommitdiffstats
path: root/demos/RonsDemos/nonAnimApplet.skel
blob: a1697d2e4fd9ff29977a5d2a83d39b4365aed261 (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/**
 * Skeleton for non-animated applets (applets which redraw once each
 * time the repaint() method is called, but do not continually animate
 * automatically).
 */

/**
 * @(#) [place applet name here].java
 * @(#) author: [place author here] (converted to Java by Ron Cemer)
 */

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.util.*;
import java.io.*;
import java.util.*;
import gl4java.GLContext;
import gl4java.awt.GLCanvas;

public class myapplet extends Applet 
{
    myappletCanvas canvas = null;


        /* Initialize the applet */


	public void init()
	{
        Dimension d = getSize();
        setLayout(new BorderLayout());
        canvas = new myappletCanvas(d.width, d.height);
        add("Center", canvas);
	}


        /* Start the applet */


    public void start()
    {
    }


        /* Stop the applet */


    public void stop()
    {
    }


        /* Destroy the applet */


    public void destroy()
    {
        canvas.destroy();
    }


        /* Local GLCanvas extension class */


    private class myappletCanvas extends GLCanvas
    {
        public myappletCanvas(int w, int h)
        {
            super(w, h);
            GLContext.gljNativeDebug = false;
            GLContext.gljClassDebug = false;
        }
    
        public void preInit()
        {
            doubleBuffer = true;
            stereoView = false;
        }
    
        public void init()
        {
            System.out.println("init(): " + this);
            reshape(getSize().width, getSize().height);

// Put OpenGL initialization code here.

            glj.gljCheckGL();
        }
    
        public void destroy()
        {
            System.out.println("destroy(): " + this);

// Put any special takedown code here.

            cvsDispose();
        }
    
        public void reshape(int width, int height)
        {
            gl.glViewport(0,0,width,height);

// Put any custom reshape code here.

        }

        public void display()
        {
            if (glj.gljMakeCurrent(true) == false) return;

// Put drawing code here.

            glj.gljSwap();
            glj.gljCheckGL();
            glj.gljFree();
        }
    }
}