aboutsummaryrefslogtreecommitdiffstats
path: root/demos/RonsDemos/nonAnimApplet.skel
diff options
context:
space:
mode:
Diffstat (limited to 'demos/RonsDemos/nonAnimApplet.skel')
-rw-r--r--demos/RonsDemos/nonAnimApplet.skel120
1 files changed, 120 insertions, 0 deletions
diff --git a/demos/RonsDemos/nonAnimApplet.skel b/demos/RonsDemos/nonAnimApplet.skel
new file mode 100644
index 0000000..a1697d2
--- /dev/null
+++ b/demos/RonsDemos/nonAnimApplet.skel
@@ -0,0 +1,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();
+ }
+ }
+}