aboutsummaryrefslogtreecommitdiffstats
path: root/demos/MiscDemos
diff options
context:
space:
mode:
Diffstat (limited to 'demos/MiscDemos')
-rw-r--r--demos/MiscDemos/DrawColoredPrimitives.html14
-rwxr-xr-xdemos/MiscDemos/DrawColoredPrimitives.java142
-rw-r--r--demos/MiscDemos/DrawColoredPrimitives2.html16
-rw-r--r--demos/MiscDemos/DrawColoredPrimitives2.java302
-rw-r--r--demos/MiscDemos/DrawColoredPrimitives2_plugin13.html48
-rw-r--r--demos/MiscDemos/DrawColoredPrimitives_plugin13.html46
-rwxr-xr-xdemos/MiscDemos/GLImageViewerCanvas.java126
-rwxr-xr-xdemos/MiscDemos/GLImageViewerWorld.java112
-rwxr-xr-xdemos/MiscDemos/GLImageWorld1.java456
-rwxr-xr-xdemos/MiscDemos/PerformanceCheck.sh56
-rw-r--r--demos/MiscDemos/PerformanceEtc/profile.jdk1.2-sun48
-rw-r--r--demos/MiscDemos/PerformanceEtc/profile.jdk1.3-ibm52
-rw-r--r--demos/MiscDemos/PerformanceEtc/profile.jdk1.3-sun52
-rw-r--r--demos/MiscDemos/PerformanceEtc/profile.jdk118-ibm48
-rw-r--r--demos/MiscDemos/PerformanceEtc/profile.jdk118_v150
-rw-r--r--demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-ppc-500mhz-xf68-4.0.1-DRI-soft.log82
-rw-r--r--demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-Mesa321-soft-gears.log130
-rw-r--r--demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-DRI-soft-gears.log137
-rw-r--r--demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-NVidia-GForce256-gears.log131
-rw-r--r--demos/MiscDemos/PerformanceLogs/index.html15
-rw-r--r--demos/MiscDemos/SharedGLTest.java73
-rw-r--r--demos/MiscDemos/SharedGLTest2.html13
-rwxr-xr-xdemos/MiscDemos/SharedGLTest2.java144
-rw-r--r--demos/MiscDemos/SharedGLTest2_plugin13.html45
-rw-r--r--demos/MiscDemos/TriangleRotate.html14
-rwxr-xr-xdemos/MiscDemos/TriangleRotate.java139
-rw-r--r--demos/MiscDemos/TriangleRotate_plugin13.html46
-rw-r--r--demos/MiscDemos/accanti.html17
-rw-r--r--demos/MiscDemos/accanti.java258
-rw-r--r--demos/MiscDemos/accanti_plugin13.html48
-rw-r--r--demos/MiscDemos/alpha3D.html17
-rw-r--r--demos/MiscDemos/alpha3D.java287
-rw-r--r--demos/MiscDemos/alpha3D_plugin13.html48
-rw-r--r--demos/MiscDemos/anti.html17
-rw-r--r--demos/MiscDemos/anti.java162
-rw-r--r--demos/MiscDemos/anti_plugin13.html48
-rw-r--r--demos/MiscDemos/coloredCross.java111
-rw-r--r--demos/MiscDemos/depthcue.html17
-rw-r--r--demos/MiscDemos/depthcue.java140
-rw-r--r--demos/MiscDemos/depthcue_plugin13.html48
-rw-r--r--demos/MiscDemos/gears.html13
-rw-r--r--demos/MiscDemos/gears.java437
-rw-r--r--demos/MiscDemos/gears_plugin13.html45
-rw-r--r--demos/MiscDemos/glJavaFontTest1.java120
-rw-r--r--demos/MiscDemos/glutFontBitmapTest.html15
-rw-r--r--demos/MiscDemos/glutFontBitmapTest.java137
-rw-r--r--demos/MiscDemos/glutFontBitmapTest2Applet$glutFbin0 -> 5910 bytes
-rw-r--r--demos/MiscDemos/glutFontBitmapTest2Applet.html16
-rw-r--r--demos/MiscDemos/glutFontBitmapTest2Applet.java319
-rw-r--r--demos/MiscDemos/glutFontBitmapTest2Applet_plugin13.html48
-rw-r--r--demos/MiscDemos/glutFontBitmapTest_plugin13.html47
-rw-r--r--demos/MiscDemos/glutFontStrokeTest.html15
-rw-r--r--demos/MiscDemos/glutFontStrokeTest.java128
-rw-r--r--demos/MiscDemos/glutFontStrokeTest_plugin13.html47
-rw-r--r--demos/MiscDemos/index.html78
-rw-r--r--demos/MiscDemos/index_plugin13.html80
-rw-r--r--demos/MiscDemos/morph3d.html17
-rwxr-xr-xdemos/MiscDemos/morph3d.java1060
-rw-r--r--demos/MiscDemos/morph3d_plugin13.html48
-rw-r--r--demos/MiscDemos/nurbs.html14
-rw-r--r--demos/MiscDemos/nurbs.java314
-rw-r--r--demos/MiscDemos/nurbs_plugin13.html46
-rw-r--r--demos/MiscDemos/pngTextureTestApplet.html16
-rwxr-xr-xdemos/MiscDemos/pngTextureTestApplet.java420
-rw-r--r--demos/MiscDemos/pngTextureTestApplet_plugin13.html48
-rw-r--r--demos/MiscDemos/select.html17
-rw-r--r--demos/MiscDemos/select.java596
-rw-r--r--demos/MiscDemos/select_plugin13.html49
-rw-r--r--demos/MiscDemos/spectex.html14
-rw-r--r--demos/MiscDemos/spectex.java336
-rw-r--r--demos/MiscDemos/spectex_plugin13.html46
-rw-r--r--demos/MiscDemos/stencil.html20
-rw-r--r--demos/MiscDemos/stencil.java342
-rw-r--r--demos/MiscDemos/stencil_plugin13.html51
-rw-r--r--demos/MiscDemos/teaambient.html17
-rwxr-xr-xdemos/MiscDemos/teaambient.java182
-rw-r--r--demos/MiscDemos/teaambient_plugin13.html48
-rw-r--r--demos/MiscDemos/teapots.html17
-rw-r--r--demos/MiscDemos/teapots.java279
-rw-r--r--demos/MiscDemos/teapots_plugin13.html48
-rw-r--r--demos/MiscDemos/tess.h40
-rw-r--r--demos/MiscDemos/tess.html15
-rw-r--r--demos/MiscDemos/tess.java298
-rw-r--r--demos/MiscDemos/tess_plugin13.html47
-rw-r--r--demos/MiscDemos/tessdemo.html15
-rwxr-xr-xdemos/MiscDemos/tessdemo.java667
-rw-r--r--demos/MiscDemos/tessdemo_plugin13.html47
-rw-r--r--demos/MiscDemos/tesswind.html15
-rwxr-xr-xdemos/MiscDemos/tesswind.java464
-rw-r--r--demos/MiscDemos/tesswind_plugin13.html47
-rw-r--r--demos/MiscDemos/tex/DAISYX.pngbin0 -> 17768 bytes
-rw-r--r--demos/MiscDemos/tex/a.tgabin0 -> 450018 bytes
-rw-r--r--demos/MiscDemos/tex/gleeson_head.jpgbin0 -> 6065 bytes
-rwxr-xr-xdemos/MiscDemos/tex/gnu-head-sm.pngbin0 -> 1915 bytes
-rwxr-xr-xdemos/MiscDemos/tex/jaulogo-300x80.pngbin0 -> 12576 bytes
95 files changed, 11000 insertions, 0 deletions
diff --git a/demos/MiscDemos/DrawColoredPrimitives.html b/demos/MiscDemos/DrawColoredPrimitives.html
new file mode 100644
index 0000000..a812c94
--- /dev/null
+++ b/demos/MiscDemos/DrawColoredPrimitives.html
@@ -0,0 +1,14 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<applet code="DrawColoredPrimitives.class" width=500 height=300>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/DrawColoredPrimitives.java b/demos/MiscDemos/DrawColoredPrimitives.java
new file mode 100755
index 0000000..0e6725b
--- /dev/null
+++ b/demos/MiscDemos/DrawColoredPrimitives.java
@@ -0,0 +1,142 @@
+/**
+ * @(#) DrawColoredPrimitives.java
+ * @(#) author: Joe Zimmerman (converted to Java by Sven Goethel)
+ */
+
+/* This program is free software under the license of LGPL */
+
+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.GLAnimCanvas;
+import gl4java.applet.SimpleGLAnimApplet1;
+
+public class DrawColoredPrimitives extends SimpleGLAnimApplet1
+{
+
+ public void init(int w, int h)
+ {
+ super.init();
+ canvas = new gldemo(w, h);
+ add("Center", canvas);
+ }
+
+ public void init()
+ {
+ super.init();
+ Dimension d = getSize();
+ canvas = new gldemo(d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] ) {
+ DrawColoredPrimitives applet =
+ new DrawColoredPrimitives();
+
+ Frame f = new Frame("DrawColoredPrimitives");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.init(500,300);
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+
+ private class gldemo extends GLAnimCanvas
+ {
+ float rotate;
+
+ float LightAmbient[] = { 0.75f, 0.75f, 0.75f, 1.5f};
+ float LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 0.9f};
+ float LightSpecular[] = { 0.8f, 0.8f, 0.8f, 1.0f};
+
+ public gldemo(int w, int h)
+ {
+ super(w, h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ setAnimateFps(30.0);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+ public void init()
+ {
+ reshape(getSize().width, getSize().height);
+
+ gl.glEnable(GL_LIGHT0);
+ gl.glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular);
+
+ glj.gljCheckGL();
+ }
+
+ public void reshape(int width, int height)
+ {
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPerspective(45, (float)width/(float)height, 1, 700);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glViewport(0,0,width,height);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+
+ gl.glColor4f(1, 1, 1, 1);
+
+ rotate++;
+
+ gl.glTranslatef(0, 0, -5);
+ gl.glRotatef(rotate, 0, 1, 0);
+ gl.glBegin(GL_POLYGON);
+ gl.glNormal3f( 1, 0, 0);
+ gl.glColor4f(1, 0, 0, 1); gl.glVertex3f( 0, 1, 0);
+ gl.glColor4f(0, 1, 0, 1); gl.glVertex3f(-1, -1, 0);
+ gl.glColor4f(0, 0, 1, 1); gl.glVertex3f( 1, -1, 0);
+ gl.glEnd();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+ }
+}
diff --git a/demos/MiscDemos/DrawColoredPrimitives2.html b/demos/MiscDemos/DrawColoredPrimitives2.html
new file mode 100644
index 0000000..6881a77
--- /dev/null
+++ b/demos/MiscDemos/DrawColoredPrimitives2.html
@@ -0,0 +1,16 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Right-Mouse Button for a Menu !
+<br>
+<hr>
+<applet code="DrawColoredPrimitives2.class" width=500 height=300>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/DrawColoredPrimitives2.java b/demos/MiscDemos/DrawColoredPrimitives2.java
new file mode 100644
index 0000000..fad8668
--- /dev/null
+++ b/demos/MiscDemos/DrawColoredPrimitives2.java
@@ -0,0 +1,302 @@
+/**
+ * @(#) DrawColoredPrimitives2.java
+ * @(#) author: Joe Zimmerman (converted to Java by Sven Goethel)
+ */
+
+/* This program is free software under the license of LGPL */
+
+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.GLAnimCanvas;
+import gl4java.applet.SimpleGLAnimApplet1;
+
+public class DrawColoredPrimitives2 extends SimpleGLAnimApplet1
+{
+
+ public void init()
+ {
+ super.init();
+ Dimension d = getSize();
+ canvas = new gldemo(d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] ) {
+ DrawColoredPrimitives2 applet =
+ new DrawColoredPrimitives2();
+
+ Frame f = new Frame("DrawColoredPrimitives2");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
+ applet.init();
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+
+ private class gldemo extends GLAnimCanvas
+ implements MouseListener, ActionListener
+ {
+ private PopupMenu menu = null;
+ private boolean menu_showing = false;
+ private boolean save_suspended = false;
+ private final String VIEW_FRONT = "View Front";
+ private final String VIEW_TOP = "View Top";
+ private final String VIEW_BOTTOM = "View Bottom";
+
+ final float M_PI = 3.14159265f;
+ final float M_PI_2 = 1.57079632f;
+ float rotate;
+ float rotationStep = 1;
+ int view = 0; /* 0 = front, 1 = top, 2 = bottom */
+
+ float LightAmbient[] = { 0.75f, 0.75f, 0.75f, 1.5f};
+ float LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 0.9f};
+ float LightSpecular[] = { 0.8f, 0.8f, 0.8f, 1.0f};
+
+ public gldemo(int w, int h)
+ {
+ super(w, h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ setAnimateFps(30.0);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+ public void init()
+ {
+ reshape(getSize().width, getSize().height);
+
+ gl.glEnable(GL_LIGHT0);
+ gl.glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular);
+
+ glj.gljCheckGL();
+
+ menu = new PopupMenu("Options");
+ menu.add(VIEW_FRONT);
+ menu.add(VIEW_TOP);
+ menu.add(VIEW_BOTTOM);
+ menu.addActionListener(this);
+ add(menu);
+
+ addMouseListener(this);
+ }
+
+ public void doCleanup()
+ {
+ removeMouseListener(this);
+ menu.removeActionListener(this);
+ }
+
+ public void reshape(int width, int height)
+ {
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPerspective(45, (float)width/(float)height, 1, 700);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glViewport(0,0,width,height);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+
+ gl.glTranslatef(0, 0, -5);
+
+ if(view==1)
+ {
+ gl.glRotatef(90f, 1, 0, 0);
+ } else if(view==2)
+ {
+ gl.glRotatef(-90f, 1, 0, 0);
+ }
+
+ gl.glColor4f(1, 1, 1, 1);
+
+ rotate+=rotationStep;
+ if(rotate>=180.0f || rotate<=0.0f)
+ rotationStep*=-1.0f;
+
+ gl.glRotatef(rotate, 0, 1, 0);
+
+
+ gl.glBegin(GL_POLYGON);
+ gl.glNormal3f( 1, 0, 0);
+
+ // top vertex
+ gl.glColor4f(1, 0, 0, 1); gl.glVertex3f( 0, 1, 0);
+ // bottom left vertex
+ gl.glColor4f(0, 1, 0, 1); gl.glVertex3f(-1, -1, 1);
+ // bottom right vertex
+ gl.glColor4f(0, 0, 1, 1); gl.glVertex3f( 1, -1, 1);
+ gl.glEnd();
+
+ gl.glBegin(GL_POLYGON);
+ gl.glNormal3f( 1, 0, 0);
+
+ // top vertex
+ gl.glColor4f(1, 0, 0, 1); gl.glVertex3f( 0, 1, 0);
+ // bottom left vertex
+ gl.glColor4f(0, 1, 0, 1); gl.glVertex3f( 1, -1, -1);
+ // bottom right vertex
+ gl.glColor4f(0, 0, 1, 1); gl.glVertex3f( 1, -1, 1);
+ gl.glEnd();
+
+ gl.glBegin(GL_POLYGON);
+ gl.glNormal3f( 1, 0, 0);
+
+ // top vertex
+ gl.glColor4f(1, 0, 0, 1); gl.glVertex3f( 0, 1, 0);
+ // bottom left vertex
+ gl.glColor4f(0, 1, 0, 1); gl.glVertex3f( 1, -1, -1);
+ // bottom right vertex
+ gl.glColor4f(0, 0, 1, 1); gl.glVertex3f(-1, -1, -1);
+ gl.glEnd();
+
+ gl.glBegin(GL_POLYGON);
+ gl.glNormal3f( 1, 0, 0);
+
+ // top vertex
+ gl.glColor4f(1, 0, 0, 1); gl.glVertex3f( 0, 1, 0);
+ // bottom left vertex
+ gl.glColor4f(0, 1, 0, 1); gl.glVertex3f(-1, -1, 1);
+ // bottom right vertex
+ gl.glColor4f(0, 0, 1, 1); gl.glVertex3f(-1, -1, -1);
+ gl.glEnd();
+
+
+ // bottom square polygon
+ gl.glBegin(GL_POLYGON);
+ gl.glNormal3f( 1, 0, 0);
+
+ gl.glColor4f(0, 0, 1, 1); gl.glVertex3f( 1, -1, 1);
+ gl.glColor4f(0, 1, 0, 1); gl.glVertex3f(-1, -1, 1);
+ gl.glColor4f(0, 0, 1, 1); gl.glVertex3f(-1, -1, -1);
+ gl.glColor4f(0, 1, 0, 1); gl.glVertex3f( 1, -1, -1);
+ gl.glEnd();
+
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ if (!menu_showing)
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ menu_showing = true;
+ save_suspended = isSuspended();
+ if (!save_suspended)
+ {
+ setSuspended(true);
+ repaint(100);
+ try
+ {
+ Thread.currentThread().sleep(200);
+ }
+ catch (Exception e)
+ { }
+ }
+ menu.show(this,evt.getX(),evt.getY());
+ }
+ else
+ {
+ // Must be left button.
+ if (isSuspended()) repaint();
+ }
+ }
+ else
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ // Method required for the implementation of ActionListener
+ public void actionPerformed(ActionEvent evt)
+ {
+ String c = evt.getActionCommand();
+ if (c.equals(VIEW_FRONT))
+ {
+ view=0;
+ }
+ else if (c.equals(VIEW_TOP))
+ {
+ view=1;
+ }
+ else if (c.equals(VIEW_BOTTOM))
+ {
+ view=2;
+ }
+ if (menu_showing)
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+
+
+ }
+}
diff --git a/demos/MiscDemos/DrawColoredPrimitives2_plugin13.html b/demos/MiscDemos/DrawColoredPrimitives2_plugin13.html
new file mode 100644
index 0000000..ba23c36
--- /dev/null
+++ b/demos/MiscDemos/DrawColoredPrimitives2_plugin13.html
@@ -0,0 +1,48 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Right-Mouse Button for a Menu !
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "DrawColoredPrimitives2.class" WIDTH = 500 HEIGHT = 300 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "DrawColoredPrimitives2.class" WIDTH = 500 HEIGHT = 300></XMP>
+<PARAM NAME = CODE VALUE = "DrawColoredPrimitives2.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "DrawColoredPrimitives2.class" WIDTH = 500 HEIGHT = 300>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/DrawColoredPrimitives_plugin13.html b/demos/MiscDemos/DrawColoredPrimitives_plugin13.html
new file mode 100644
index 0000000..101fd55
--- /dev/null
+++ b/demos/MiscDemos/DrawColoredPrimitives_plugin13.html
@@ -0,0 +1,46 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "DrawColoredPrimitives.class" WIDTH = 500 HEIGHT = 300 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "DrawColoredPrimitives.class" WIDTH = 500 HEIGHT = 300></XMP>
+<PARAM NAME = CODE VALUE = "DrawColoredPrimitives.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "DrawColoredPrimitives.class" WIDTH = 500 HEIGHT = 300>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/GLImageViewerCanvas.java b/demos/MiscDemos/GLImageViewerCanvas.java
new file mode 100755
index 0000000..320242c
--- /dev/null
+++ b/demos/MiscDemos/GLImageViewerCanvas.java
@@ -0,0 +1,126 @@
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.utils.textures.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.net.*;
+
+public class GLImageViewerCanvas extends Frame
+ implements ActionListener, ItemListener
+{
+ GLImageCanvas glImageCanvas = null;
+
+ private Choice fileTypeChoice = null;
+ private Button loadButton = null;
+ private Button saveButton = null;
+ private Button normalButton = null;
+ private Checkbox aspectCheck = null;
+
+ public GLImageViewerCanvas(String title)
+ {
+ super(title);
+ setSize(500, 300);
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+
+ addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ Panel filePanel = new Panel();
+ filePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+ fileTypeChoice = new Choice();
+ fileTypeChoice.add("any");
+ fileTypeChoice.add("tga");
+ fileTypeChoice.add("png");
+ fileTypeChoice.add("ppm");
+ filePanel.add(fileTypeChoice);
+
+ loadButton = new Button("load..");
+ loadButton.addActionListener(this);
+ filePanel.add(loadButton);
+
+ saveButton = new Button("save..");
+ saveButton.addActionListener(this);
+ filePanel.add(saveButton);
+
+ normalButton = new Button("normal");
+ normalButton.addActionListener(this);
+ filePanel.add(normalButton);
+
+ aspectCheck = new Checkbox("aspect", true);
+ aspectCheck.addItemListener(this);
+ filePanel.add(aspectCheck);
+ add("North", filePanel);
+
+ glImageCanvas = new GLImageCanvas(d.width, d.height);
+ glImageCanvas.setName("GLImageCanvas");
+ glImageCanvas.setKeepAspectRatio(aspectCheck.getState());
+ add("Center", glImageCanvas);
+
+ pack();
+ setVisible(true);
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ Object src = e.getSource();
+ if(src.equals(loadButton))
+ {
+ FileDialog fd = new FileDialog(this,"Bitmap Load Menu",
+ FileDialog.LOAD);
+ fd.show();
+ String fname = fd.getDirectory() + fd.getFile() ;
+ fname = fname.replace('\\','/');
+ fname = fname.trim();
+
+ setTitle(fname);
+ glImageCanvas.loadTexture(fname,
+ fileTypeChoice.getSelectedItem() );
+ repaint();
+ } else if(src.equals(saveButton))
+ {
+ FileDialog fd = new FileDialog(this,"TGA-Image Save Menu",
+ FileDialog.SAVE);
+ fd.show();
+ String fname = fd.getDirectory() + fd.getFile() ;
+ fname = fname.replace('\\','/');
+ fname = fname.trim();
+
+ setTitle(fname);
+ glImageCanvas.snapshot( new TGATextureGrabber(glImageCanvas.gl),
+ fname);
+ repaint();
+ } else if(src.equals(normalButton))
+ {
+ glImageCanvas.setOriginalSize();
+ }
+ }
+
+ public void itemStateChanged(ItemEvent e)
+ {
+ if(aspectCheck.equals(e.getItemSelectable()))
+ {
+ glImageCanvas.setKeepAspectRatio(aspectCheck.getState());
+ }
+ }
+
+ public static void main( String args[] )
+ {
+ GLContext.gljNativeDebug = true;
+ GLContext.gljClassDebug = true;
+ GLImageViewerCanvas applet =
+ new GLImageViewerCanvas("GLImageViewerCanvas");
+ }
+}
diff --git a/demos/MiscDemos/GLImageViewerWorld.java b/demos/MiscDemos/GLImageViewerWorld.java
new file mode 100755
index 0000000..f00bd06
--- /dev/null
+++ b/demos/MiscDemos/GLImageViewerWorld.java
@@ -0,0 +1,112 @@
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.utils.textures.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.net.*;
+
+public class GLImageViewerWorld extends Frame
+ implements ActionListener
+{
+ GLImageWorld1 glImageCanvas = null;
+
+ private Choice fileTypeChoice = null;
+ private Button loadButton = null;
+ private Button saveButton = null;
+ private Button normalButton = null;
+
+ public GLImageViewerWorld(String title)
+ {
+ super(title);
+ setSize(500, 300);
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+
+ addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ Panel filePanel = new Panel();
+ filePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+ fileTypeChoice = new Choice();
+ fileTypeChoice.add("any");
+ fileTypeChoice.add("tga");
+ fileTypeChoice.add("png");
+ fileTypeChoice.add("ppm");
+ filePanel.add(fileTypeChoice);
+
+ loadButton = new Button("load..");
+ loadButton.addActionListener(this);
+ filePanel.add(loadButton);
+
+ saveButton = new Button("save..");
+ saveButton.addActionListener(this);
+ filePanel.add(saveButton);
+
+ normalButton = new Button("normal");
+ normalButton.addActionListener(this);
+ filePanel.add(normalButton);
+
+ add("North", filePanel);
+
+ glImageCanvas = new GLImageWorld1(d.width, d.height);
+ glImageCanvas.setName("GLImageWorld1");
+ add("Center", glImageCanvas);
+
+ pack();
+ setVisible(true);
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ Object src = e.getSource();
+ if(src.equals(loadButton))
+ {
+ FileDialog fd = new FileDialog(this,"Bitmap Load Menu",
+ FileDialog.LOAD);
+ fd.show();
+ String fname = fd.getDirectory() + fd.getFile() ;
+ fname = fname.replace('\\','/');
+ fname = fname.trim();
+
+ setTitle(fname);
+ glImageCanvas.loadTexture(fname,
+ fileTypeChoice.getSelectedItem() );
+ repaint();
+ } else if(src.equals(saveButton))
+ {
+ FileDialog fd = new FileDialog(this,"TGA-Image Save Menu",
+ FileDialog.SAVE);
+ fd.show();
+ String fname = fd.getDirectory() + fd.getFile() ;
+ fname = fname.replace('\\','/');
+ fname = fname.trim();
+
+ setTitle(fname);
+ glImageCanvas.snapshot( new TGATextureGrabber(glImageCanvas.gl),
+ fname);
+ repaint();
+ } else if(src.equals(normalButton))
+ {
+ glImageCanvas.setOriginalPerspective();
+ }
+ }
+
+ public static void main( String args[] )
+ {
+ GLImageViewerWorld applet =
+ new GLImageViewerWorld("GLImageViewerWorld");
+ }
+}
+
diff --git a/demos/MiscDemos/GLImageWorld1.java b/demos/MiscDemos/GLImageWorld1.java
new file mode 100755
index 0000000..6ac78f5
--- /dev/null
+++ b/demos/MiscDemos/GLImageWorld1.java
@@ -0,0 +1,456 @@
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.utils.textures.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.net.*;
+
+public class GLImageWorld1 extends GLCanvas
+ implements MouseListener,MouseMotionListener
+{
+ float []mPosObjTrans;
+ float []mPosObjRot;
+
+ Point mousePoint;
+ Point oldMousePoint;
+ boolean mouseMoveFlag;
+
+
+ TextureGrabber textGrab4Snapshot = null;
+ String textGrab4SnapshotFName = null;
+
+ TextureLoader txtLoader = null;
+ int texName[] = {0};
+
+ public GLImageWorld1 (int w, int h)
+ {
+ super(w, h);
+ }
+
+ /**
+ * Creates a snapshot (save texture/image) of the current
+ * GL-Context !
+ *
+ * The snapshot itself is created delayed,
+ * so no return value is avaiable.
+ * Because this is a non critical path, I hope its enough !
+ *
+ * @param tg The TextureGrabber
+ * @param fname The filename
+ * @see TextureGrabber
+ */
+ public void snapshot(TextureGrabber tg, String fname)
+ {
+ textGrab4Snapshot=tg;
+ textGrab4SnapshotFName=fname;
+ repaint();
+ }
+
+ public void setOriginalPerspective()
+ {
+ setOriginalPerspective(true);
+ }
+
+ private void setOriginalPerspective(boolean fetchGL)
+ {
+ for(int i=0;i<16;i++)
+ mPosObjTrans[i]=0f;
+ mPosObjTrans[0]=mPosObjTrans[5]=mPosObjTrans[10]=mPosObjTrans[15]=1f;
+ for(int i=0;i<16;i++)
+ mPosObjRot[i]=0f;
+ mPosObjRot[0]=mPosObjRot[5]=mPosObjRot[10]=mPosObjRot[15]=1f;
+
+ if(fetchGL)
+ {
+ if( glj.gljMakeCurrent() == false )
+ System.out.println("problem in use() method");
+ }
+
+ TranlateObj(0f,0f,-10f);
+ SetCamera();
+
+ if(fetchGL)
+ {
+ glj.gljCheckGL();
+ glj.gljFree();
+ repaint();
+ }
+ }
+
+ public void preInit()
+ {
+ // createOwnWindow = true;
+ }
+
+ public void init()
+ {
+ gl.glEnable(GL_TEXTURE_2D);
+
+ gl.glGenTextures(1,texName);
+ gl.glBindTexture(GL_TEXTURE_2D,texName[0]);
+
+ //gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
+ //gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
+ //gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+ //gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
+ gl.glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ // cameraMatrix init
+ mPosObjTrans=new float[16];
+ mPosObjRot=new float[16];
+
+ setOriginalPerspective(false);
+
+ gl.glShadeModel (GL_SMOOTH);
+ gl.glEnable(GL_DEPTH_TEST);
+
+ gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
+ gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glj.gljCheckGL();
+
+ addMouseListener(this);
+ addMouseMotionListener(this);
+ mouseMoveFlag=false;
+
+ reshape(getSize().width, getSize().height);
+ }
+
+ /**
+ * These variables are very important
+ * to respect the texture-size ratio !
+ */
+ float texMaxPosX = 1f;
+ float texMaxPosY = 1f;
+
+ public boolean loadTexture(String name, String type)
+ {
+ boolean ok = true;
+
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return false;
+ }
+
+ // texture laden
+ if(type.equals("png"))
+ txtLoader = new PngTextureLoader(gl, glu);
+ else if(type.equals("ppm"))
+ txtLoader = new PPMAsciiTextureLoader(gl, glu);
+ else if(type.equals("tga"))
+ txtLoader = new TGATextureLoader(gl, glu);
+ else if(type.equals("any"))
+ txtLoader = new AWTTextureLoader(this, gl, glu);
+ else {
+ System.out.println("Imagetype: "+type+" is currently not supported !");
+ ok = false;
+ }
+
+ if(ok)
+ {
+ try {
+ txtLoader.readTexture(name);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ if(ok && txtLoader.isOk())
+ {
+ gl.glEnable(GL_TEXTURE_2D);
+
+ txtLoader.texImage2DScaled4BestSize();
+
+ texMaxPosX = 1f;
+ texMaxPosY = 1f;
+ float texAspect = txtLoader.getTextureWidth()/
+ txtLoader.getTextureHeight();
+
+ if(txtLoader.getTextureWidth()>txtLoader.getTextureHeight())
+ texMaxPosY = 1f/texAspect;
+ else
+ texMaxPosX = texAspect;
+ System.out.println("texture succesfully loaded !");
+ System.out.println("texture: "+txtLoader);
+ }
+ glj.gljCheckGL();
+ glj.gljFree();
+ if(ok)
+ repaint();
+ return ok;
+ }
+
+ public void display()
+ {
+ int i;
+
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ // just render it
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ SetCamera();
+
+ DrawScene();
+
+ if(textGrab4Snapshot!=null)
+ {
+ textGrab4Snapshot.grabPixels(GL_BACK,
+ 0, 0, cvsGetWidth(), cvsGetHeight());
+ if(textGrab4SnapshotFName!=null)
+ textGrab4Snapshot.write2File(textGrab4SnapshotFName);
+
+ textGrab4Snapshot =null;
+ textGrab4SnapshotFName=null;
+ }
+
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glViewport (0, 0, w, h);
+ gl.glLoadIdentity();
+ SetCamera();
+ }
+
+
+ public void drawGrid(float x0, float y0,
+ float width, float height, float step)
+ {
+ float i,j;
+
+ /* draw grid */
+ gl.glBegin(GL_LINES);
+ for(i=x0;i<width;i+=step)
+ for(j=y0;j<height;j+=step)
+ {
+ if(i==0f && j==0f)
+ gl.glColor3f (1f,0f,0f);
+ else
+ gl.glColor3f (0.6f,0.5f,0.5f);
+ gl.glVertex2f(0f,j);
+ gl.glVertex2f(width,j);
+ gl.glVertex2f(i,height);
+ gl.glVertex2f(i,0f);
+ }
+ gl.glEnd();
+ }
+
+ void DrawScene()
+ {
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glLoadMatrixf(mPosObjTrans);
+ gl.glMultMatrixf(mPosObjRot);
+
+ gl.glPushMatrix();
+ gl.glDisable(GL_TEXTURE_2D);
+ drawGrid(0f, 0f, 10f, 10f, 0.5f);
+ gl.glPopMatrix();
+
+ // obj zeichnen
+
+ gl.glPushMatrix();
+ gl.glScalef(2f,2f,2f);
+ gl.glColor3f(1f,0f,0f);
+ gl.glDisable(GL_TEXTURE_2D);
+ DrawObj();
+ gl.glPopMatrix();
+
+ if(texName[0]!=0)
+ gl.glEnable(GL_TEXTURE_2D);
+
+ gl.glEnable(GL_BLEND);
+ gl.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+
+ gl.glColor3f(1f,1f,1f);
+
+ gl.glPushMatrix();
+ gl.glScalef(3f,3f,3f);
+ gl.glTranslatef(-1f,0f,1f);
+ DrawObj();
+ gl.glPopMatrix();
+
+ gl.glPushMatrix();
+ gl.glScalef(3f,3f,3f);
+ gl.glTranslatef(1f,0f,1f);
+ DrawObj();
+ gl.glPopMatrix();
+
+ gl.glPushMatrix();
+ gl.glScalef(3f,3f,3f);
+ gl.glTranslatef(-2f,1f,1f);
+ Billboard();
+ DrawObj();
+ gl.glPopMatrix();
+
+ gl.glDisable(GL_BLEND);
+ }
+
+ void DrawObj()
+ {
+ gl.glPushMatrix();
+ gl.glBegin(GL_QUADS);
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(0f,0f);
+ gl.glVertex3f(0f,0f,0f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(0f,1f);
+ gl.glVertex3f(0f,texMaxPosY,0f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(1f,1f);
+ gl.glVertex3f(texMaxPosX,texMaxPosY,0f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(1f,0f);
+ gl.glVertex3f(texMaxPosX,0f,0f);
+ gl.glEnd();
+ gl.glPopMatrix();
+ }
+
+ float winaspect = 1f;
+ float imgaspect = 1f;
+ float imgwidth = 1f;
+ float imgheight = 1f;
+
+ void SetCamera()
+ {
+ Dimension dim=getSize();
+ float aspect=(float)dim.width/(float)dim.height;
+
+ gl.glMatrixMode (GL_PROJECTION);
+ gl.glLoadIdentity ();
+ glu.gluPerspective(60f,aspect,.01,100);
+ }
+
+ void RotateObj(float degree,
+ float axisX,
+ float axisY,
+ float axisZ)
+ {
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glRotatef(degree,axisX,axisY,axisZ);
+ gl.glMultMatrixf(mPosObjRot);
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjRot);
+
+ repaint();
+ }
+
+ void TranlateObj(float x,float y,float z)
+ {
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glLoadMatrixf(mPosObjTrans);
+ gl.glTranslatef(x,y,z);
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjTrans);
+
+ repaint();
+ }
+
+ // entfernt rotationen aus aktueller matrix
+ double Billboard()
+ {
+ float[] mat=new float[16];
+
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mat);
+ mat[0] = mat[5] = mat[10] = 1;
+ mat[1] = mat[2] = mat[4] = mat[6] = mat[8] = mat[9] = 0;
+ gl.glLoadMatrixf(mat);
+
+ return mat[14];
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered( MouseEvent evt )
+ {
+ }
+
+ public void mouseExited( MouseEvent evt )
+ {
+ }
+
+ public void mousePressed( MouseEvent evt )
+ {
+ if(mouseMoveFlag==false)
+ { // start drag
+ mouseMoveFlag=true;
+ mousePoint=evt.getPoint();
+ }
+ }
+
+ public void mouseReleased( MouseEvent evt )
+ {
+ mouseMoveFlag=false;
+ }
+
+ public void mouseClicked( MouseEvent evt )
+ {
+ Component comp = evt.getComponent();
+ }
+
+ public void mouseDragged(MouseEvent e)
+ {
+ if(mouseMoveFlag==true)
+ {
+ oldMousePoint=new Point(mousePoint);
+ mousePoint=e.getPoint();
+
+ Point dif=new Point(mousePoint.x-oldMousePoint.x,
+ mousePoint.y-oldMousePoint.y);
+
+ if(e.isShiftDown()==true)
+ TranlateObj((float)dif.x/6.0f,(float)dif.y/-6.0f,0f);
+ else if(e.isAltDown()==true)
+ {
+ TranlateObj(0f,0f,(float)dif.y/6.0f);
+ RotateObj(dif.x,0f,0f,1f);
+ }
+ else
+ {
+ RotateObj(dif.x,0f,1f,0f);
+ RotateObj(dif.y,1f,0f,0f);
+ }
+ }
+ }
+ public void mouseMoved(MouseEvent e)
+ {
+ }
+
+
+}
+
diff --git a/demos/MiscDemos/PerformanceCheck.sh b/demos/MiscDemos/PerformanceCheck.sh
new file mode 100755
index 0000000..5934e9d
--- /dev/null
+++ b/demos/MiscDemos/PerformanceCheck.sh
@@ -0,0 +1,56 @@
+#! /bin/sh
+
+#
+# Prerequisites:
+#
+# - Unix Shell Environment, e.g. A Unix :-), cygwin32, ...
+#
+# - The native gears executabel in your PATH environment
+#
+# - The Shell Setup scripts for all your installed java1.1.X-java2 JVM's
+# under ./PerformanceEtc/profile.jdk* !!!
+# Here you have to setup the PATH, CLASSPATH well !
+#
+
+if [ -z "$1" -o -z "$2" ] ; then
+ echo usage: $0 \<nativeprog and java class\> \<logfilename\>
+ echo e.g.: $0 gears gl4j2.4.1-linux-xf68-4.0.1-tdfx-gears.log
+ exit 1
+fi
+
+testdelay=40s
+
+tstprog=$1
+logfile=$2
+rm -f $logfile
+
+echo >> $logfile
+echo =============================================== >> $logfile
+echo >> $logfile
+echo using native $tstprog >> $logfile
+($tstprog -info >> $logfile 2>&1) &
+sleep $testdelay && kill -15 $!
+sleep 5s
+echo >> $logfile
+echo >> $logfile
+
+for i in ./PerformanceEtc/profile.jdk* ; do
+ echo >> $logfile
+ echo =============================================== >> $logfile
+ echo >> $logfile
+ echo using $tstprog on $i >> $logfile
+ echo >> $logfile
+ . $i
+ if [ -z "$(echo $i | grep ibm)" ] ; then
+ java -version >> $logfile 2>&1
+ else
+ java -fullversion >> $logfile 2>&1
+ fi
+ echo JAVA_COMPILER $JAVA_COMPILER >> $logfile
+ echo >> $logfile
+ ( java $tstprog -perftest >> $logfile 2>&1) &
+ sleep $testdelay && kill -15 $!
+ sleep 5s
+ echo >> $logfile
+ echo >> $logfile
+done
diff --git a/demos/MiscDemos/PerformanceEtc/profile.jdk1.2-sun b/demos/MiscDemos/PerformanceEtc/profile.jdk1.2-sun
new file mode 100644
index 0000000..6483b1e
--- /dev/null
+++ b/demos/MiscDemos/PerformanceEtc/profile.jdk1.2-sun
@@ -0,0 +1,48 @@
+
+export NS_JAVA=
+# export DYN_JAVA=true # some motif bugs are there :-(
+export DYN_JAVA=
+
+export JAVA_HOME=/usr/local/lib/jdk1.2-sun
+export JDK_HOME=$JAVA_HOME
+
+export JAVA_COMPILER=javacomp
+
+THREADS_FLAG=native
+export THREADS_FLAG
+
+CLASSPATH=.
+
+#
+# 1st the PATH for classes
+#
+for i in /usr/local/projects/java \
+ $HOME/lib/classes \
+ /usr/local/lib-java \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+
+#
+# 2nd the JAR/ZIP-Archives for classes
+#
+for i in $HOME/lib/classes/*.jar \
+ /usr/local/lib-java/*.jar \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+export CLASSPATH
+
+#
+# Be sure to respect, that the latter directory in this
+# for-loop is the first entry in the PATH env-var !!!!!
+#
+for i in /usr/local/lib-java/JavaCC/bin \
+ /usr/local/lib-java/bin \
+ /usr/local/lib-java/JSDK/bin \
+ $JAVA_HOME/bin \
+ ; do
+ test -e $i && PATH=$i:$PATH
+done
+export PATH
+
diff --git a/demos/MiscDemos/PerformanceEtc/profile.jdk1.3-ibm b/demos/MiscDemos/PerformanceEtc/profile.jdk1.3-ibm
new file mode 100644
index 0000000..841718d
--- /dev/null
+++ b/demos/MiscDemos/PerformanceEtc/profile.jdk1.3-ibm
@@ -0,0 +1,52 @@
+
+export NS_JAVA=
+# export DYN_JAVA=true # some motif bugs are there :-(
+export DYN_JAVA=
+
+export JAVA_HOME=/usr/local/lib/jdk1.3-ibm
+export JDK_HOME=$JAVA_HOME
+
+export JAVA_COMPILER=jitc
+#unset JAVA_COMPILER
+
+export HOTJAVA_HOME=/usr/local/lib-java/HotJava
+export SWING_HOME=
+
+THREADS_FLAG=native
+export THREADS_FLAG
+
+CLASSPATH=.
+
+#
+# 1st the PATH for classes
+#
+for i in /usr/local/projects/java \
+ $HOME/lib/classes \
+ /usr/local/lib-java \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+
+#
+# 2nd the JAR/ZIP-Archives for classes
+#
+for i in $HOME/lib/classes/*.jar \
+ /usr/local/lib-java/*.jar \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+export CLASSPATH
+
+#
+# Be sure to respect, that the latter directory in this
+# for-loop is the first entry in the PATH env-var !!!!!
+#
+for i in /usr/local/lib-java/JavaCC/bin \
+ /usr/local/lib-java/bin \
+ /usr/local/lib-java/JSDK/bin \
+ $JAVA_HOME/bin \
+ ; do
+ test -e $i && PATH=$i:$PATH
+done
+export PATH
+
diff --git a/demos/MiscDemos/PerformanceEtc/profile.jdk1.3-sun b/demos/MiscDemos/PerformanceEtc/profile.jdk1.3-sun
new file mode 100644
index 0000000..752c6fe
--- /dev/null
+++ b/demos/MiscDemos/PerformanceEtc/profile.jdk1.3-sun
@@ -0,0 +1,52 @@
+
+export NS_JAVA=
+# export DYN_JAVA=true # some motif bugs are there :-(
+export DYN_JAVA=
+
+export JAVA_HOME=/usr/local/lib/jdk1.3-sun
+export JDK_HOME=$JAVA_HOME
+
+unset JAVA_COMPILER
+export TYA_LOGFILE=
+
+export HOTJAVA_HOME=/usr/local/lib-java/HotJava
+export SWING_HOME=
+
+THREADS_FLAG=native
+export THREADS_FLAG
+
+CLASSPATH=.
+
+#
+# 1st the PATH for classes
+#
+for i in /usr/local/projects/java \
+ $HOME/lib/classes \
+ /usr/local/lib-java \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+
+#
+# 2nd the JAR/ZIP-Archives for classes
+#
+for i in $HOME/lib/classes/*.jar \
+ /usr/local/lib-java/*.jar \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+export CLASSPATH
+
+#
+# Be sure to respect, that the latter directory in this
+# for-loop is the first entry in the PATH env-var !!!!!
+#
+for i in /usr/local/lib-java/JavaCC/bin \
+ /usr/local/lib-java/bin \
+ /usr/local/lib-java/JSDK/bin \
+ $JAVA_HOME/bin \
+ ; do
+ test -e $i && PATH=$i:$PATH
+done
+export PATH
+
diff --git a/demos/MiscDemos/PerformanceEtc/profile.jdk118-ibm b/demos/MiscDemos/PerformanceEtc/profile.jdk118-ibm
new file mode 100644
index 0000000..925684a
--- /dev/null
+++ b/demos/MiscDemos/PerformanceEtc/profile.jdk118-ibm
@@ -0,0 +1,48 @@
+
+export NS_JAVA=
+# export DYN_JAVA=true # some motif bugs are there :-(
+export DYN_JAVA=
+
+export JAVA_HOME=/usr/local/lib/jdk118-ibm
+export JDK_HOME=$JAVA_HOME
+
+export JAVA_COMPILER=jitc
+
+THREADS_FLAG=native
+export THREADS_FLAG
+
+CLASSPATH=$JAVA_HOME/lib/classes.zip:.
+
+#
+# 1st the PATH for classes
+#
+for i in /usr/local/projects/java \
+ $HOME/lib/classes \
+ /usr/local/lib-java \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+
+#
+# 2nd the JAR/ZIP-Archives for classes
+#
+for i in $HOME/lib/classes/*.jar \
+ /usr/local/lib-java/*.jar \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+export CLASSPATH
+
+#
+# Be sure to respect, that the latter directory in this
+# for-loop is the first entry in the PATH env-var !!!!!
+#
+for i in /usr/local/lib-java/JavaCC/bin \
+ /usr/local/lib-java/bin \
+ $JAVA_HOME/bin \
+ ; do
+ test -e $i && PATH=$i:$PATH
+done
+export PATH
+
+
diff --git a/demos/MiscDemos/PerformanceEtc/profile.jdk118_v1 b/demos/MiscDemos/PerformanceEtc/profile.jdk118_v1
new file mode 100644
index 0000000..f36395a
--- /dev/null
+++ b/demos/MiscDemos/PerformanceEtc/profile.jdk118_v1
@@ -0,0 +1,50 @@
+
+export NS_JAVA=
+# export DYN_JAVA=true # some motif bugs are there :-(
+export DYN_JAVA=
+
+export JAVA_HOME=/usr/local/lib/jdk118_v1
+export JDK_HOME=$JAVA_HOME
+
+export JAVA_COMPILER=tya
+export TYA_LOGFILE=/var/log/tya.log
+
+THREADS_FLAG=native
+export THREADS_FLAG
+
+CLASSPATH=$JAVA_HOME/lib/classes.zip:.
+
+#
+# 1st the PATH for classes
+#
+for i in /usr/local/projects/java \
+ $HOME/lib/classes \
+ /usr/local/lib-java \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+
+#
+# 2nd the JAR/ZIP-Archives for classes
+#
+for i in $HOME/lib/classes/*.jar \
+ /usr/local/lib-java/*.jar \
+ ; do
+ test -e $i && CLASSPATH=$CLASSPATH:$i
+done
+export CLASSPATH
+
+#
+# Be sure to respect, that the latter directory in this
+# for-loop is the first entry in the PATH env-var !!!!!
+#
+for i in /usr/local/lib-java/JavaCC/bin \
+ /usr/local/lib-java/bin \
+ /usr/local/lib-java/JSDK/bin \
+ $JAVA_HOME/bin \
+ ; do
+ test -e $i && PATH=$i:$PATH
+done
+export PATH
+
+
diff --git a/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-ppc-500mhz-xf68-4.0.1-DRI-soft.log b/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-ppc-500mhz-xf68-4.0.1-DRI-soft.log
new file mode 100644
index 0000000..cc0831c
--- /dev/null
+++ b/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-ppc-500mhz-xf68-4.0.1-DRI-soft.log
@@ -0,0 +1,82 @@
+
+===============================================
+
+using native gears
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk118
+
+dirname: too many arguments
+Try `dirname --help' for more information.
+java version "1.1.8"
+JAVA_COMPILER mwjit
+
+dirname: too many arguments
+Try `dirname --help' for more information.
+libmwjit.so: cannot open shared object file: No such file or directory (libmwjit.so)
+Warning: JIT compiler "mwjit" not found. Will use interpreter.
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.3 beta
+GL RENDERER: Mesa GLX Indirect
+GL VENDOR : Precision Insight, Inc.
+453 frames in 5.004 seconds = 90.5275779376499 FPS
+455 frames in 5.001 seconds = 90.98180363927214 FPS
+454 frames in 5.003 seconds = 90.74555266839896 FPS
+456 frames in 5.009 seconds = 91.03613495707725 FPS
+454 frames in 5.003 seconds = 90.74555266839896 FPS
+456 frames in 5.01 seconds = 91.0179640718563 FPS
+453 frames in 5.005 seconds = 90.5094905094905 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk122
+
+java version "1.2.2"
+Classic VM (build Linux_JDK_1.2.2_FCS, native threads, nojit)
+JAVA_COMPILER
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.3 beta
+GL RENDERER: Mesa GLX Indirect
+GL VENDOR : Precision Insight, Inc.
+450 frames in 5.007 seconds = 89.87417615338526 FPS
+450 frames in 5.009 seconds = 89.83829107606309 FPS
+452 frames in 5.007 seconds = 90.2736169362892 FPS
+454 frames in 5.009 seconds = 90.63685366340586 FPS
+452 frames in 5.002 seconds = 90.36385445821672 FPS
+454 frames in 5.005 seconds = 90.70929070929071 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk13
+
+java version "1.3.0beta"
+Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.3.0beta-b02)
+Classic VM (build Blackdown-1.3.0beta-b02, native threads, nojit)
+JAVA_COMPILER
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.3 beta
+GL RENDERER: Mesa GLX Indirect
+GL VENDOR : Precision Insight, Inc.
+447 frames in 5.007 seconds = 89.27501497902936 FPS
+449 frames in 5.01 seconds = 89.62075848303394 FPS
+450 frames in 5.005 seconds = 89.91008991008991 FPS
+451 frames in 5.002 seconds = 90.16393442622952 FPS
+450 frames in 5.005 seconds = 89.91008991008991 FPS
+452 frames in 5.009 seconds = 90.23757236973447 FPS
+
+
diff --git a/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-Mesa321-soft-gears.log b/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-Mesa321-soft-gears.log
new file mode 100644
index 0000000..91f2e6f
--- /dev/null
+++ b/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-Mesa321-soft-gears.log
@@ -0,0 +1,130 @@
+
+===============================================
+
+using native gears
+GL_RENDERER = Mesa X11
+GL_VERSION = 1.2 Mesa 3.2.1
+GL_VENDOR = Brian Paul
+GL_EXTENSIONS = GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_logic_op GL_EXT_blend_subtract GL_EXT_packed_pixels GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_polygon_offset GL_EXT_vertex_array GL_EXT_texture_object GL_EXT_texture3D GL_MESA_window_pos GL_MESA_resize_buffers GL_EXT_shared_texture_palette GL_EXT_rescale_normal GL_EXT_abgr GL_SGIS_texture_edge_clamp GL_EXT_stencil_wrap GL_INGR_blend_func_separate GL_ARB_multitexture GL_NV_texgen_reflection GL_PGI_misc_hints GL_EXT_compiled_vertex_array GL_EXT_clip_volume_hint
+492 frames in 5.004 seconds = 98.3213 FPS
+510 frames in 5.007 seconds = 101.857 FPS
+510 frames in 5.007 seconds = 101.857 FPS
+510 frames in 5.007 seconds = 101.857 FPS
+510 frames in 5.006 seconds = 101.878 FPS
+510 frames in 5.006 seconds = 101.878 FPS
+510 frames in 5.007 seconds = 101.857 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk118-ibm
+
+java full version "JDK 1.1.8 IBM build l118-19991221 (JIT enabled: jitc)"
+JAVA_COMPILER jitc
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+Xt error: attempt to add non-widget child "dsm" to parent "MToolkit app" which supports only widgets
+SIGABRT received at bfffdc98 in /lib/libpthread.so.0. Processing terminated
+Writing stack trace to javacore4308.txt ... OK
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk118_v1
+
+java version "1.1.8"
+JAVA_COMPILER tya
+
+ TYA 1.5 (for J117 / Linux). Copyright (c) 1997,98,99 The TYA Team
+ Contact The TYA Team via Albrecht Kleine <[email protected]>
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.2.1
+GL RENDERER: Mesa X11
+GL VENDOR : Brian Paul
+500 frames in 5.003 seconds = 99.94003597841295 FPS
+501 frames in 5.004 seconds = 100.11990407673862 FPS
+502 frames in 5.009 seconds = 100.21960471151925 FPS
+502 frames in 5.01 seconds = 100.1996007984032 FPS
+502 frames in 5.008 seconds = 100.23961661341853 FPS
+502 frames in 5.009 seconds = 100.21960471151925 FPS
+502 frames in 5.004 seconds = 100.3197442046363 FPS
+502 frames in 5.007 seconds = 100.25963650888757 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.2-sun
+
+java version "1.2.2"
+Classic VM (build 1.2.2_006, native threads, javacomp)
+JAVA_COMPILER javacomp
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.2.1
+GL RENDERER: Mesa X11
+GL VENDOR : Brian Paul
+499 frames in 5.007 seconds = 99.66047533453167 FPS
+501 frames in 5.006 seconds = 100.07990411506192 FPS
+502 frames in 5.003 seconds = 100.3397961223266 FPS
+501 frames in 5.0 seconds = 100.2 FPS
+502 frames in 5.008 seconds = 100.23961661341853 FPS
+502 frames in 5.003 seconds = 100.3397961223266 FPS
+501 frames in 5.009 seconds = 100.01996406468356 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.3-ibm
+
+java full version "J2RE 1.3.0 IBM build cxdev-20000502"
+JAVA_COMPILER jitc
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.2.1
+GL RENDERER: Mesa X11
+GL VENDOR : Brian Paul
+498 frames in 5.005 seconds = 99.5004995004995 FPS
+500 frames in 5.0 seconds = 100.0 FPS
+500 frames in 5.0 seconds = 100.0 FPS
+501 frames in 5.009 seconds = 100.01996406468356 FPS
+497 frames in 5.0 seconds = 99.4 FPS
+504 frames in 5.001 seconds = 100.77984403119376 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.3-sun
+
+java version "1.3.0beta_refresh"
+Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
+Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)
+JAVA_COMPILER
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.2.1
+GL RENDERER: Mesa X11
+GL VENDOR : Brian Paul
+498 frames in 5.0 seconds = 99.6 FPS
+499 frames in 5.007 seconds = 99.66047533453167 FPS
+500 frames in 5.0 seconds = 100.0 FPS
+498 frames in 5.007 seconds = 99.46075494307969 FPS
+501 frames in 5.0 seconds = 100.2 FPS
+501 frames in 5.0 seconds = 100.2 FPS
+500 frames in 5.008 seconds = 99.84025559105432 FPS
+
+
diff --git a/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-DRI-soft-gears.log b/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-DRI-soft-gears.log
new file mode 100644
index 0000000..355b563
--- /dev/null
+++ b/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-DRI-soft-gears.log
@@ -0,0 +1,137 @@
+
+===============================================
+
+using native gears
+GL_RENDERER = Mesa GLX Indirect
+GL_VERSION = 1.2 Mesa 3.3 beta
+GL_VENDOR = Precision Insight, Inc.
+GL_EXTENSIONS = GL_EXT_abgr GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract
+455 frames in 5.002 seconds = 90.9636 FPS
+464 frames in 5.003 seconds = 92.7444 FPS
+471 frames in 5.01 seconds = 94.012 FPS
+471 frames in 5.008 seconds = 94.0495 FPS
+471 frames in 5.009 seconds = 94.0307 FPS
+471 frames in 5.008 seconds = 94.0495 FPS
+470 frames in 5.002 seconds = 93.9624 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk118-ibm
+
+java full version "JDK 1.1.8 IBM build l118-19991221 (JIT enabled: jitc)"
+JAVA_COMPILER jitc
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.3 beta
+GL RENDERER: Mesa GLX Indirect
+GL VENDOR : Precision Insight, Inc.
+446 frames in 5.004 seconds = 89.12869704236611 FPS
+445 frames in 5.006 seconds = 88.89332800639232 FPS
+455 frames in 5.004 seconds = 90.92725819344525 FPS
+455 frames in 5.003 seconds = 90.94543274035578 FPS
+455 frames in 5.002 seconds = 90.96361455417833 FPS
+455 frames in 5.002 seconds = 90.96361455417833 FPS
+454 frames in 5.005 seconds = 90.70929070929071 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk118_v1
+
+java version "1.1.8"
+JAVA_COMPILER tya
+
+ TYA 1.5 (for J117 / Linux). Copyright (c) 1997,98,99 The TYA Team
+ Contact The TYA Team via Albrecht Kleine <[email protected]>
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.3 beta
+GL RENDERER: Mesa GLX Indirect
+GL VENDOR : Precision Insight, Inc.
+461 frames in 5.0 seconds = 92.2 FPS
+462 frames in 5.005 seconds = 92.3076923076923 FPS
+463 frames in 5.008 seconds = 92.4520766773163 FPS
+463 frames in 5.007 seconds = 92.47054124226084 FPS
+463 frames in 5.008 seconds = 92.4520766773163 FPS
+463 frames in 5.007 seconds = 92.47054124226084 FPS
+462 frames in 5.01 seconds = 92.21556886227545 FPS
+462 frames in 5.002 seconds = 92.36305477808877 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.2-sun
+
+java version "1.2.2"
+Classic VM (build 1.2.2_006, native threads, javacomp)
+JAVA_COMPILER javacomp
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.3 beta
+GL RENDERER: Mesa GLX Indirect
+GL VENDOR : Precision Insight, Inc.
+461 frames in 5.004 seconds = 92.12629896083135 FPS
+463 frames in 5.008 seconds = 92.4520766773163 FPS
+464 frames in 5.007 seconds = 92.67026163371281 FPS
+464 frames in 5.005 seconds = 92.70729270729271 FPS
+464 frames in 5.006 seconds = 92.6887734718338 FPS
+464 frames in 5.008 seconds = 92.65175718849841 FPS
+462 frames in 5.001 seconds = 92.38152369526094 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.3-ibm
+
+java full version "J2RE 1.3.0 IBM build cxdev-20000502"
+JAVA_COMPILER jitc
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.3 beta
+GL RENDERER: Mesa GLX Indirect
+GL VENDOR : Precision Insight, Inc.
+456 frames in 5.006 seconds = 91.09069117059528 FPS
+459 frames in 5.006 seconds = 91.68997203355973 FPS
+459 frames in 5.005 seconds = 91.70829170829171 FPS
+459 frames in 5.003 seconds = 91.74495302818309 FPS
+455 frames in 5.009 seconds = 90.83649431024156 FPS
+462 frames in 5.0 seconds = 92.4 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.3-sun
+
+java version "1.3.0beta_refresh"
+Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
+Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)
+JAVA_COMPILER
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2 Mesa 3.3 beta
+GL RENDERER: Mesa GLX Indirect
+GL VENDOR : Precision Insight, Inc.
+462 frames in 5.009 seconds = 92.23397883809143 FPS
+461 frames in 5.007 seconds = 92.07110045935691 FPS
+463 frames in 5.005 seconds = 92.50749250749251 FPS
+462 frames in 5.007 seconds = 92.27082085080887 FPS
+466 frames in 5.005 seconds = 93.10689310689311 FPS
+466 frames in 5.004 seconds = 93.12549960031976 FPS
+464 frames in 5.005 seconds = 92.70729270729271 FPS
+
+
diff --git a/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-NVidia-GForce256-gears.log b/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-NVidia-GForce256-gears.log
new file mode 100644
index 0000000..e21c362
--- /dev/null
+++ b/demos/MiscDemos/PerformanceLogs/gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-NVidia-GForce256-gears.log
@@ -0,0 +1,131 @@
+
+===============================================
+
+using native gears
+GL_RENDERER = GeForce 256/AGP
+GL_VERSION = 1.2.1
+GL_VENDOR = NVIDIA Corporation
+GL_EXTENSIONS = GL_ARB_multitexture GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_transpose_matrix GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_fog_coord GL_EXT_packed_pixels GL_EXT_paletted_texture GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shared_texture_palette GL_EXT_stencil_wrap GL_EXT_texture_compression_s3tc GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_cube_map GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_object GL_EXT_vertex_array GL_EXT_vertex_weighting GL_KTX_buffer_region GL_NV_blend_square GL_NV_fence GL_NV_fog_distance GL_NV_light_max_exponent GL_NV_register_combiners GL_NV_texgen_emboss GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_NV_vertex_array_range GL_S3_s3tc GL_SGIS_multitexture GL_SGIS_texture_lod
+5380 frames in 5 seconds = 1076 FPS
+5452 frames in 5 seconds = 1090.4 FPS
+5496 frames in 5 seconds = 1099.2 FPS
+5495 frames in 5 seconds = 1099 FPS
+5496 frames in 5 seconds = 1099.2 FPS
+5496 frames in 5 seconds = 1099.2 FPS
+5494 frames in 5 seconds = 1098.8 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk118-ibm
+
+java full version "JDK 1.1.8 IBM build l118-19991221 (JIT enabled: jitc)"
+JAVA_COMPILER jitc
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2.1
+GL RENDERER: GeForce 256/AGP
+GL VENDOR : NVIDIA Corporation
+4969 frames in 5.0 seconds = 993.8 FPS
+4937 frames in 5.0 seconds = 987.4 FPS
+5065 frames in 5.0 seconds = 1013.0 FPS
+5062 frames in 5.0 seconds = 1012.4 FPS
+5066 frames in 5.0 seconds = 1013.2 FPS
+5062 frames in 5.0 seconds = 1012.4 FPS
+5053 frames in 5.0 seconds = 1010.6 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk118_v1
+
+java version "1.1.8"
+JAVA_COMPILER tya
+
+ TYA 1.5 (for J117 / Linux). Copyright (c) 1997,98,99 The TYA Team
+ Contact The TYA Team via Albrecht Kleine <[email protected]>
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2.1
+GL RENDERER: GeForce 256/AGP
+GL VENDOR : NVIDIA Corporation
+5132 frames in 5.0 seconds = 1026.4 FPS
+5174 frames in 5.0 seconds = 1034.8 FPS
+5180 frames in 5.0 seconds = 1036.0 FPS
+5180 frames in 5.0 seconds = 1036.0 FPS
+5179 frames in 5.0 seconds = 1035.8 FPS
+5179 frames in 5.0 seconds = 1035.8 FPS
+5166 frames in 5.0 seconds = 1033.2 FPS
+5179 frames in 5.0 seconds = 1035.8 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.2-sun
+
+java version "1.2.2"
+Classic VM (build 1.2.2_006, native threads, javacomp)
+JAVA_COMPILER javacomp
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2.1
+GL RENDERER: GeForce 256/AGP
+GL VENDOR : NVIDIA Corporation
+5112 frames in 5.0 seconds = 1022.4 FPS
+5168 frames in 5.0 seconds = 1033.6 FPS
+5176 frames in 5.0 seconds = 1035.2 FPS
+5178 frames in 5.0 seconds = 1035.6 FPS
+5177 frames in 5.0 seconds = 1035.4 FPS
+5178 frames in 5.0 seconds = 1035.6 FPS
+5168 frames in 5.0 seconds = 1033.6 FPS
+
+
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.3-ibm
+
+java full version "J2RE 1.3.0 IBM build cxdev-20000502"
+JAVA_COMPILER jitc
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2.1
+GL RENDERER: GeForce 256/AGP
+GL VENDOR : NVIDIA Corporation
+5079 frames in 5.0 seconds = 1015.8 FPS
+5229 frames in 5.0 seconds = 1045.8 FPS
+5230 frames in 5.0 seconds = 1046.0 FPS
+
+===============================================
+
+using gears on ./PerformanceEtc/profile.jdk1.3-sun
+
+java version "1.3.0beta_refresh"
+Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
+Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)
+JAVA_COMPILER
+
+loading libs(gl, glu): null, null: true
+useFpsSleep: false
+useRepaint: false
+GL VERSION : 1.2.1
+GL RENDERER: GeForce 256/AGP
+GL VENDOR : NVIDIA Corporation
+4894 frames in 5.0 seconds = 978.8 FPS
+5043 frames in 5.0 seconds = 1008.6 FPS
+5063 frames in 5.0 seconds = 1012.6 FPS
+5065 frames in 5.0 seconds = 1013.0 FPS
+5065 frames in 5.0 seconds = 1013.0 FPS
+5064 frames in 5.0 seconds = 1012.8 FPS
+
+
diff --git a/demos/MiscDemos/PerformanceLogs/index.html b/demos/MiscDemos/PerformanceLogs/index.html
new file mode 100644
index 0000000..20ebe96
--- /dev/null
+++ b/demos/MiscDemos/PerformanceLogs/index.html
@@ -0,0 +1,15 @@
+<HEAD>
+<TITLE></TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<H1></H1>
+<HR><PRE>
+<IMG SRC="/icons/back.gif" ALT="[DIR]"> <A HREF="..">Parent Directory</A>
+<IMG SRC="/icons/compressed.gif" ALT="[ ]"> <A HREF="gl4j2.4.1-linux-ppc-500mhz-xf68-4.0.1-DRI-soft.log">gl4j2.4.1-linux-ppc-500mhz-xf68-4.0.1-DRI-soft.log</A> (4 kBytes)
+<IMG SRC="/icons/compressed.gif" ALT="[ ]"> <A HREF="gl4j2.4.1-linux-x86-350mhz-Mesa321-soft-gears.log">gl4j2.4.1-linux-x86-350mhz-Mesa321-soft-gears.log</A> (8 kBytes)
+<IMG SRC="/icons/compressed.gif" ALT="[ ]"> <A HREF="gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-DRI-soft-gears.log">gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-DRI-soft-gears.log</A> (8 kBytes)
+<IMG SRC="/icons/compressed.gif" ALT="[ ]"> <A HREF="gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-NVidia-GForce256-gears.log">gl4j2.4.1-linux-x86-350mhz-xf68-4.0.1-NVidia-GForce256-gears.log</A> (8 kBytes)
+</PRE><HR>
+<PRE>
+<PRE>
+</BODY>
diff --git a/demos/MiscDemos/SharedGLTest.java b/demos/MiscDemos/SharedGLTest.java
new file mode 100644
index 0000000..1377b20
--- /dev/null
+++ b/demos/MiscDemos/SharedGLTest.java
@@ -0,0 +1,73 @@
+import java.awt.*;
+import gl4java.*;
+import gl4java.awt.*;
+
+public class SharedGLTest extends Frame {
+ public static void main(String[] args) {
+ SharedGLTest t1 = new SharedGLTest();
+ t1.setVisible(true);
+
+ do { // Wait until t1 is fully created and displayed.
+ if(t1.getGLContext() != null) break;
+ }
+ while(true);
+
+ SharedGLTest t2 = new SharedGLTest(t1.getGLContext());
+ t2.setVisible(true);
+ }
+
+ public SharedGLTest() { this(null); }
+ public SharedGLTest(GLContext shareWith) {
+ super();
+ setBounds(50, 0, 200, 200);
+ c = new MyCanvas(100, 100, shareWith);
+ add(c);
+ }
+
+ private MyCanvas c;
+ public GLContext getGLContext() { return c.getGLContext(); }
+
+ private class MyCanvas extends GLCanvas {
+
+ public MyCanvas(int w, int h) {
+ super(w, h);
+ }
+
+ public MyCanvas(int w, int h, GLContext shareWith) {
+ super(w, h);
+ sharedGLContext = shareWith;
+ }
+
+ public void display() {
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ GLFunc gl = glj.getGLFunc();
+ buildCallList(gl); // Really build something only once.
+ gl.glCallList(callList);
+
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+ }
+ private static int callList;
+ private static boolean alreadyDone;
+ private static void buildCallList(GLFunc gl) { // Build only one call list for both GLCanvas.
+ if(alreadyDone) return;
+ alreadyDone = true;
+
+ callList = gl.glGenLists(1);
+
+ gl.glNewList(callList, gl.GL_COMPILE);
+ gl.glClearColor(1f, 0f, 0f, 1f);
+ gl.glClear(gl.GL_COLOR_BUFFER_BIT); // Clear the GLCanvas with red.
+ gl.glEndList();
+ }
+}
+
+
+
diff --git a/demos/MiscDemos/SharedGLTest2.html b/demos/MiscDemos/SharedGLTest2.html
new file mode 100644
index 0000000..802e43b
--- /dev/null
+++ b/demos/MiscDemos/SharedGLTest2.html
@@ -0,0 +1,13 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<applet code="SharedGLTest2.class" width=200 height=400>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/SharedGLTest2.java b/demos/MiscDemos/SharedGLTest2.java
new file mode 100755
index 0000000..e1dcb23
--- /dev/null
+++ b/demos/MiscDemos/SharedGLTest2.java
@@ -0,0 +1,144 @@
+import java.applet.*;
+import java.awt.*;
+import java.awt.event.*;
+import gl4java.*;
+import gl4java.awt.*;
+
+public class SharedGLTest2 extends Applet
+ implements MouseListener
+{
+
+ MyCanvas canvas = null;
+ Button addButton = null;
+ int canvasNumber = 0;
+ Panel pAllCvs = null;
+ Dimension d = null;
+
+ public void init()
+ {
+ d = getSize();
+ setLayout(new BorderLayout());
+ addButton = new Button ("add gl");
+ addButton.addMouseListener(this);
+ add("South", addButton);
+
+ pAllCvs = new Panel();
+ pAllCvs.setLayout(new GridLayout(4,1));
+ add("Center", pAllCvs);
+
+ canvas = new MyCanvas (d.width/2, d.height/2, null);
+ pAllCvs.add(canvas);
+ canvasNumber=1;
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("SharedGLTest2");
+
+ SharedGLTest2 applet = new SharedGLTest2();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered( MouseEvent evt )
+ {
+ }
+
+ public void mouseExited( MouseEvent evt )
+ {
+ }
+
+ public void mousePressed( MouseEvent evt )
+ {
+ }
+
+ public void mouseReleased( MouseEvent evt )
+ {
+ }
+
+ public void mouseClicked( MouseEvent evt )
+ {
+ Component comp = evt.getComponent();
+
+ if( canvas!=null && comp.equals(addButton) )
+ {
+ if(canvasNumber<4)
+ {
+ MyCanvas _canvas =
+ new MyCanvas (d.width/2,d.height/2,canvas.getGLContext());
+ pAllCvs.add(_canvas);
+ canvasNumber++;
+ pAllCvs.invalidate();
+ pAllCvs.validate();
+ if(canvasNumber==4)
+ addButton.setEnabled(false);
+ }
+ }
+ }
+
+ private static int callList=0;
+
+ protected class MyCanvas extends GLCanvas
+ {
+ public MyCanvas(int w, int h, GLContext shareWith)
+ {
+ super(w, h);
+ sharedGLContext = shareWith;
+ }
+
+ public void init()
+ {
+ if(sharedGLContext==null && callList==0)
+ {
+ buildCallList(); // Really build something only once.
+ }
+ }
+
+ public void display()
+ {
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ if(callList!=0)
+ gl.glCallList(callList);
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ /**
+ * Build only one call list for both GLCanvas.
+ */
+ protected void buildCallList()
+ {
+ callList = gl.glGenLists(1);
+
+ gl.glNewList(callList, gl.GL_COMPILE);
+ gl.glClearColor(1f, 0f, 0f, 1f);
+ gl.glClear(gl.GL_COLOR_BUFFER_BIT); // Clear the GLCanvas with red.
+ gl.glEndList();
+ }
+ }
+
+}
+
diff --git a/demos/MiscDemos/SharedGLTest2_plugin13.html b/demos/MiscDemos/SharedGLTest2_plugin13.html
new file mode 100644
index 0000000..75bb289
--- /dev/null
+++ b/demos/MiscDemos/SharedGLTest2_plugin13.html
@@ -0,0 +1,45 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 200 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "SharedGLTest2.class" WIDTH = 200 HEIGHT = 400 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "SharedGLTest2.class" WIDTH = 200 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "SharedGLTest2.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "SharedGLTest2.class" WIDTH = 200 HEIGHT = 400>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/TriangleRotate.html b/demos/MiscDemos/TriangleRotate.html
new file mode 100644
index 0000000..5dad555
--- /dev/null
+++ b/demos/MiscDemos/TriangleRotate.html
@@ -0,0 +1,14 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<applet code="TriangleRotate.class" width=500 height=300>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/TriangleRotate.java b/demos/MiscDemos/TriangleRotate.java
new file mode 100755
index 0000000..c2d93f7
--- /dev/null
+++ b/demos/MiscDemos/TriangleRotate.java
@@ -0,0 +1,139 @@
+/**
+ * @(#) TriangleRotate.java
+ * @(#) author: Joe Zimmerman (converted to Java by Sven Goethel)
+ */
+
+/* This program is free software under the license of LGPL */
+
+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.GLAnimCanvas;
+import gl4java.applet.SimpleGLAnimApplet1;
+
+public class TriangleRotate extends SimpleGLAnimApplet1
+{
+
+ public void init()
+ {
+ super.init();
+ Dimension d = getSize();
+ canvas = new gldemo(d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] ) {
+ GLContext.gljNativeDebug = true;
+ GLContext.gljClassDebug = true;
+ TriangleRotate applet =
+ new TriangleRotate();
+
+ Frame f = new Frame("TriangleRotate");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
+ applet.init();
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+
+ private class gldemo extends GLAnimCanvas
+ {
+ float rotate;
+
+ float LightAmbient[] = { 0.75f, 0.75f, 0.75f, 1.5f};
+ float LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 0.9f};
+ float LightSpecular[] = { 0.8f, 0.8f, 0.8f, 1.0f};
+
+ public gldemo(int w, int h)
+ {
+ super(w, h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ setAnimateFps(30.0);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ createOwnWindow = true;
+ }
+
+ public void init()
+ {
+ reshape(getSize().width, getSize().height);
+
+ gl.glEnable(GL_LIGHT0);
+ gl.glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular);
+
+ glj.gljCheckGL();
+ }
+
+ public void reshape(int width, int height)
+ {
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPerspective(45, (float)width/(float)height, 1, 700);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glViewport(0,0,width,height);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+
+ gl.glColor4f(1, 1, 1, 1);
+
+ rotate++;
+
+ gl.glTranslatef(0, 0, -10);
+ gl.glRotatef(rotate, 0, 1, 0);
+ gl.glBegin(GL_POLYGON);
+ gl.glNormal3f( 1, 0, 0);
+ gl.glVertex3f( 0, 1, 0);
+ gl.glVertex3f(-1, -1, 0);
+ gl.glVertex3f( 1, -1, 0);
+ gl.glEnd();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+ }
+}
diff --git a/demos/MiscDemos/TriangleRotate_plugin13.html b/demos/MiscDemos/TriangleRotate_plugin13.html
new file mode 100644
index 0000000..444fa8b
--- /dev/null
+++ b/demos/MiscDemos/TriangleRotate_plugin13.html
@@ -0,0 +1,46 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "TriangleRotate.class" WIDTH = 500 HEIGHT = 300 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "TriangleRotate.class" WIDTH = 500 HEIGHT = 300></XMP>
+<PARAM NAME = CODE VALUE = "TriangleRotate.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "TriangleRotate.class" WIDTH = 500 HEIGHT = 300>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/accanti.html b/demos/MiscDemos/accanti.html
new file mode 100644
index 0000000..9730abd
--- /dev/null
+++ b/demos/MiscDemos/accanti.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<applet code="accanti.class" width=400 height=400>
+</applet>
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/accanti.java b/demos/MiscDemos/accanti.java
new file mode 100644
index 0000000..3191452
--- /dev/null
+++ b/demos/MiscDemos/accanti.java
@@ -0,0 +1,258 @@
+/**
+ * @(#) accanti.java
+ * @(#) author: Silicon Graphics, Inc. (converted to Java by Sven Goethel)
+ */
+
+/*
+ * This program demonstrates lots of material properties.
+ * A single light source illuminates the objects.
+ */
+
+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;
+
+import gl4java.utils.glut.*;
+
+public class accanti extends Applet
+{
+ accantiCanvas canvas = null;
+
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new accantiCanvas(d.width, d.height);
+ add("Center", canvas);
+ }
+
+
+ /* Start the applet */
+
+
+ public void start()
+ {
+ }
+
+
+ /* Stop the applet */
+
+
+ public void stop()
+ {
+ }
+
+ public static void main( String args[] ) {
+ GLContext.gljNativeDebug = true;
+ GLContext.gljClassDebug = true;
+
+ accanti applet =
+ new accanti();
+
+ Frame f = new Frame("accanti");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
+ applet.init();
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+
+ /* Local GLCanvas extension class */
+
+
+ private class accantiCanvas extends GLCanvas
+ {
+ int teapotList;
+ GLUTFunc glut = null;
+
+ public accantiCanvas(int w, int h)
+ {
+ super(w, h);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ accumSize = 8;
+ }
+
+
+ boolean hasAccumulatorBits = false;
+
+ public void init()
+ {
+ int aRbits[] = { 0 };
+ int aGbits[] = { 0 };
+ int aBbits[] = { 0 };
+ int aAbits[] = { 0 };
+
+ glut = new GLUTFuncLightImpl(gl, glu);
+
+ reshape(getSize().width, getSize().height);
+
+ float mat_ambient[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ float mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ float light_position[] = { 0.0f, 0.0f, 10.0f, 1.0f };
+ float lm_ambient[] = { 0.2f, 0.2f, 0.2f, 1.0f };
+
+ gl.glGetIntegerv(GL_ACCUM_RED_BITS, aRbits);
+ gl.glGetIntegerv(GL_ACCUM_GREEN_BITS, aGbits);
+ gl.glGetIntegerv(GL_ACCUM_BLUE_BITS, aBbits);
+ gl.glGetIntegerv(GL_ACCUM_ALPHA_BITS, aAbits);
+
+ System.out.println("Accumulation Buffer Bits:");
+ System.out.println("\t red: "+aRbits[0]);
+ System.out.println("\t green: "+aGbits[0]);
+ System.out.println("\t blue: "+aBbits[0]);
+ System.out.println("\t alpha: "+aAbits[0]);
+
+ hasAccumulatorBits = aRbits[0] > 0 || aGbits[0] > 0 ||
+ aBbits[0] > 0 || aAbits[0] > 0 ;
+
+ System.out.println("Has Accumulator Bits: "+hasAccumulatorBits);
+
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
+ gl.glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
+ gl.glMaterialf(GL_FRONT, GL_SHININESS, 50.0f);
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, light_position);
+ gl.glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient);
+
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_LIGHT0);
+ gl.glDepthFunc(GL_LESS);
+ gl.glEnable(GL_DEPTH_TEST);
+ gl.glShadeModel (GL_FLAT);
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClearAccum(0.0f, 0.0f, 0.0f, 0.0f);
+ }
+
+ void displayObjects()
+ {
+ float torus_diffuse[] = { 0.7f, 0.7f, 0.0f, 1.0f };
+ float cube_diffuse[] = { 0.0f, 0.7f, 0.7f, 1.0f };
+ float sphere_diffuse[] = { 0.7f, 0.0f, 0.7f, 1.0f };
+ float octa_diffuse[] = { 0.7f, 0.4f, 0.4f, 1.0f };
+
+ gl.glPushMatrix ();
+ gl.glRotatef (30.0f, 1.0f, 0.0f, 0.0f);
+
+ gl.glPushMatrix ();
+ gl.glTranslatef (-0.80f, 0.35f, 0.0f);
+ gl.glRotatef (100.0f, 1.0f, 0.0f, 0.0f);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, torus_diffuse);
+ glut.glutSolidTorus (0.275f, 0.85f, 16, 16);
+ gl.glPopMatrix ();
+
+ gl.glPushMatrix ();
+ gl.glTranslatef (-0.75f, -0.50f, 0.0f);
+ gl.glRotatef (45.0f, 0.0f, 0.0f, 1.0f);
+ gl.glRotatef (45.0f, 1.0f, 0.0f, 0.0f);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, cube_diffuse);
+ glut.glutSolidCube (1.5f);
+ gl.glPopMatrix ();
+
+ gl.glPushMatrix ();
+ gl.glTranslatef (0.75f, 0.60f, 0.0f);
+ gl.glRotatef (30.0f, 1.0f, 0.0f, 0.0f);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_diffuse);
+ glut.glutSolidSphere (1.0f, 16, 16);
+ gl.glPopMatrix ();
+
+ gl.glPushMatrix ();
+ gl.glTranslatef (0.70f, -0.90f, 0.25f);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, octa_diffuse);
+ glut.glutSolidOctahedron ();
+ gl.glPopMatrix ();
+
+ gl.glPopMatrix ();
+ }
+
+ public void display()
+ {
+ int viewport[]=new int[4];
+ int jitter;
+ int ACSIZE=8;
+
+ if (glj.gljMakeCurrent() == false) return;
+
+ gl.glGetIntegerv (GL_VIEWPORT, viewport);
+ glj.gljCheckGL();
+
+ if(hasAccumulatorBits)
+ gl.glClear(GL_ACCUM_BUFFER_BIT);
+ glj.gljCheckGL();
+
+ for (jitter = 0; jitter < ACSIZE; jitter++) {
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ gl.glPushMatrix ();
+
+ /* Note that 4.5f is the distance in world space between
+ * left and right and bottom and top.
+ * This formula converts fractional pixel movement to
+ * world coordinates.
+ */
+ gl.glTranslatef (/*j8[jitter].x**/4.5f/viewport[2],
+ /*j8[jitter].y**/4.5f/viewport[3], 0.0f);
+ displayObjects ();
+ gl.glPopMatrix ();
+ if(hasAccumulatorBits)
+ gl.glAccum(GL_ACCUM, 1.0f/(float)ACSIZE);
+ glj.gljCheckGL();
+ }
+ if(hasAccumulatorBits)
+ gl.glAccum (GL_RETURN, 1.0f);
+ glj.gljCheckGL();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glViewport(0, 0, w, h);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ if (w <= h)
+ gl.glOrtho (-2.25f, 2.25f, -2.25f*h/w, 2.25f*h/w, -10.0f, 10.0f);
+ else
+ gl.glOrtho (-2.25f*w/h, 2.25f*w/h, -2.25f, 2.25f, -10.0f, 10.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ }
+ }
+}
diff --git a/demos/MiscDemos/accanti_plugin13.html b/demos/MiscDemos/accanti_plugin13.html
new file mode 100644
index 0000000..0a1597d
--- /dev/null
+++ b/demos/MiscDemos/accanti_plugin13.html
@@ -0,0 +1,48 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "accanti.class" WIDTH = 400 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "accanti.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "accanti.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "accanti.class" WIDTH = 400 HEIGHT = 400>
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/alpha3D.html b/demos/MiscDemos/alpha3D.html
new file mode 100644
index 0000000..43e5aaf
--- /dev/null
+++ b/demos/MiscDemos/alpha3D.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<applet code="alpha3D.class" width=400 height=400>
+</applet>
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/alpha3D.java b/demos/MiscDemos/alpha3D.java
new file mode 100644
index 0000000..a982375
--- /dev/null
+++ b/demos/MiscDemos/alpha3D.java
@@ -0,0 +1,287 @@
+/**
+ * @(#) alpha3D.java
+ * @(#) author: Silicon Graphics, Inc. (converted to Java by Sven Goethel)
+ */
+
+/*
+ * This program demonstrates lots of material properties.
+ * A single light source illuminates the objects.
+ */
+
+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;
+import gl4java.awt.GLAnimCanvas;
+import gl4java.applet.SimpleGLAnimApplet1;
+
+import gl4java.utils.glut.*;
+
+public class alpha3D extends SimpleGLAnimApplet1
+{
+ static final float MAXZ = 8.0f;
+ static final float MINZ = -8.0f;
+ static final float ZINC = 0.4f;
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ super.init();
+ Dimension d = getSize();
+ canvas = new alpha3DCanvas(d.width, d.height);
+ add("Center", canvas);
+ }
+
+
+ public static void main( String args[] ) {
+ alpha3D applet =
+ new alpha3D();
+
+ Frame f = new Frame("alpha3D");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
+ applet.init();
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+ /* Local GLCanvas extension class */
+
+
+ private class alpha3DCanvas extends GLAnimCanvas
+ implements MouseListener, ActionListener
+ {
+ private PopupMenu menu = null;
+ private boolean menu_showing = false;
+ private boolean save_suspended = false;
+ private final String MENUE_0 = "Alpha Mode";
+ private final String MENUE_1 = "Real Mode";
+
+ GLUTFunc glut = null;
+
+ float solidZ = MAXZ;
+ float transparentZ = MINZ;
+ int sphereList, cubeList;
+
+ public alpha3DCanvas(int w, int h)
+ {
+ super(w, h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ setAnimateFps(30.0);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+
+ public void init()
+ {
+ glut = new GLUTFuncLightImpl(gl, glu);
+
+ reshape(getSize().width, getSize().height);
+
+ float mat_specular[] = { 1.0f, 1.0f, 1.0f, 0.15f };
+ float mat_shininess[] = { 100.0f };
+ float position[] = { 0.5f, 0.5f, 1.0f, 0.0f };
+
+ gl.glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
+ gl.glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, position);
+
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_LIGHT0);
+ gl.glEnable(GL_DEPTH_TEST);
+
+ sphereList = gl.glGenLists(1);
+ gl.glNewList(sphereList, GL_COMPILE);
+ glut.glutSolidSphere (0.4f, 16, 16);
+ gl.glEndList();
+
+ cubeList = gl.glGenLists(1);
+ gl.glNewList(cubeList, GL_COMPILE);
+ glut.glutSolidCube (0.6f);
+ gl.glEndList();
+
+ menu = new PopupMenu("Options");
+ menu.add(MENUE_0);
+ menu.add(MENUE_1);
+ menu.addActionListener(this);
+ add(menu);
+
+ addMouseListener(this);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ float mat_solid[] = { 0.75f, 0.75f, 0.0f, 1.0f };
+ float mat_zero[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ float mat_transparent[] = { 0.0f, 0.8f, 0.8f, 0.6f };
+ float mat_emission[] = { 0.0f, 0.3f, 0.3f, 0.6f };
+
+ gl.glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ gl.glPushMatrix ();
+ gl.glTranslatef (-0.15f, -0.15f, solidZ);
+ gl.glMaterialfv(GL_FRONT, GL_EMISSION, mat_zero);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_solid);
+ gl.glCallList (sphereList);
+ gl.glPopMatrix ();
+
+ gl.glPushMatrix ();
+ gl.glTranslatef (0.15f, 0.15f, transparentZ);
+ gl.glRotatef (15.0f, 1.0f, 1.0f, 0.0f);
+ gl.glRotatef (30.0f, 0.0f, 1.0f, 0.0f);
+ gl.glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_transparent);
+ gl.glEnable (GL_BLEND);
+ gl.glDepthMask (GL_FALSE);
+ gl.glBlendFunc (GL_SRC_ALPHA, GL_ONE);
+ gl.glCallList (cubeList);
+ gl.glDepthMask (GL_TRUE);
+ gl.glDisable (GL_BLEND);
+ gl.glPopMatrix ();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+
+ animate();
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glViewport(0, 0, (int) w, (int) h);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ if (w <= h)
+ gl.glOrtho (-1.5f, 1.5f, -1.5f*(float)h/(float)w,
+ 1.5f*(float)h/(float)w, -10.0f, 10.0f);
+ else
+ gl.glOrtho (-1.5f*(float)w/(float)h,
+ 1.5f*(float)w/(float)h, -1.5f, 1.5f, -10.0f, 10.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+ }
+
+ void animate()
+ {
+ if (solidZ <= MINZ || transparentZ >= MAXZ)
+ setSuspended(true);
+ else {
+ solidZ -= ZINC;
+ transparentZ += ZINC;
+ }
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ if (!menu_showing)
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ menu_showing = true;
+ save_suspended = isSuspended();
+ if (!save_suspended)
+ {
+ setSuspended(true);
+ repaint(100);
+ try
+ {
+ Thread.currentThread().sleep(200);
+ }
+ catch (Exception e)
+ { }
+ }
+ menu.show(this,evt.getX(),evt.getY());
+ }
+ else
+ {
+ // Must be left button.
+ if (isSuspended()) repaint();
+ }
+ }
+ else
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ // Method required for the implementation of ActionListener
+ public void actionPerformed(ActionEvent evt)
+ {
+ String c = evt.getActionCommand();
+ if (c.equals(MENUE_0))
+ {
+ solidZ = MAXZ;
+ transparentZ = MINZ;
+ setSuspended(false);
+ return ;
+ }
+ else if (c.equals(MENUE_1))
+ {
+ solidZ = MAXZ;
+ transparentZ = MINZ;
+ setSuspended(true);
+ repaint();
+ }
+ if (menu_showing)
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+ }
+}
diff --git a/demos/MiscDemos/alpha3D_plugin13.html b/demos/MiscDemos/alpha3D_plugin13.html
new file mode 100644
index 0000000..5b0e6b7
--- /dev/null
+++ b/demos/MiscDemos/alpha3D_plugin13.html
@@ -0,0 +1,48 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "alpha3D.class" WIDTH = 400 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "alpha3D.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "alpha3D.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "alpha3D.class" WIDTH = 400 HEIGHT = 400>
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/anti.html b/demos/MiscDemos/anti.html
new file mode 100644
index 0000000..95146a3
--- /dev/null
+++ b/demos/MiscDemos/anti.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<applet code="anti.class" width=400 height=400>
+</applet>
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/anti.java b/demos/MiscDemos/anti.java
new file mode 100644
index 0000000..eafb66a
--- /dev/null
+++ b/demos/MiscDemos/anti.java
@@ -0,0 +1,162 @@
+/**
+ * @(#) anti.java
+ * @(#) author: Silicon Graphics, Inc. (converted to Java by Ron Cemer)
+ */
+
+/*
+ * This program demonstrates lots of material properties.
+ * A single light source illuminates the objects.
+ */
+
+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;
+
+import gl4java.utils.glut.*;
+
+public class anti extends Applet
+{
+ antiCanvas canvas = null;
+
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new antiCanvas(d.width, d.height);
+ add("Center", canvas);
+ }
+
+
+ /* Start the applet */
+
+
+ public void start()
+ {
+ }
+
+
+ /* Stop the applet */
+
+
+ public void stop()
+ {
+ }
+
+ public static void main( String args[] ) {
+ anti applet =
+ new anti();
+
+ Frame f = new Frame("anti");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
+ applet.init();
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+ /* Local GLCanvas extension class */
+
+
+ private class antiCanvas extends GLCanvas
+ {
+ GLUTFunc glut = null;
+
+ public antiCanvas(int w, int h)
+ {
+ super(w, h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+/* Initialize antialia(float)Math.sing for RGBA mode, including alpha
+ * blending, hint, and line width. Print out implementation
+ * specific info on line width granularity and width.
+ */
+ public void init()
+ {
+ glut = new GLUTFuncLightImpl(gl, glu);
+
+ reshape(getSize().width, getSize().height);
+
+ float values[]=new float[2];
+ gl.glGetFloatv (GL_LINE_WIDTH_GRANULARITY, values);
+ System.out.println("GL_LINE_WIDTH_GRANULARITY value is "+values[0]);
+
+ gl.glGetFloatv (GL_LINE_WIDTH_RANGE, values);
+ System.out.println("GL_LINE_WIDTH_RANGE values are "+
+ values[0] + ", " +values[1]);
+
+ gl.glEnable (GL_LINE_SMOOTH);
+ gl.glEnable (GL_BLEND);
+ gl.glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ gl.glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
+ gl.glLineWidth (1.5f);
+
+ gl.glShadeModel(GL_FLAT);
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glDepthFunc(GL_LESS);
+ gl.glEnable(GL_DEPTH_TEST);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ gl.glColor4f (1.0f, 1.0f, 1.0f, 1.0f);
+ glut.glutWireIcosahedron();
+ glj.gljSwap();
+ glj.gljFree();
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glViewport(0, 0, w, h);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPerspective (45.0f, (float) w/(float) h, 3.0f, 5.0f);
+
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity ();
+ gl.glTranslatef (0.0f, 0.0f, -4.0f); /* move object into view */
+ }
+ }
+}
+
diff --git a/demos/MiscDemos/anti_plugin13.html b/demos/MiscDemos/anti_plugin13.html
new file mode 100644
index 0000000..1800131
--- /dev/null
+++ b/demos/MiscDemos/anti_plugin13.html
@@ -0,0 +1,48 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "anti.class" WIDTH = 400 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "anti.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "anti.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "anti.class" WIDTH = 400 HEIGHT = 400>
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/coloredCross.java b/demos/MiscDemos/coloredCross.java
new file mode 100644
index 0000000..52cab5b
--- /dev/null
+++ b/demos/MiscDemos/coloredCross.java
@@ -0,0 +1,111 @@
+import gl4java.awt.*;
+import java.applet.*;
+import java.awt.*;
+import java.awt.Dimension;
+import java.awt.event.*;
+import java.lang.*;
+import java.util.*;
+import gl4java.*;
+
+public class coloredCross extends Applet
+{
+ MyCanvas canvas = null;
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new MyCanvas (d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("coloredCross");
+
+ coloredCross applet = new coloredCross();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ protected class MyCanvas extends GLCanvas
+ {
+ public MyCanvas(int w, int h) {
+ super(w,h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ public void init() {
+ reshape(getSize().width, getSize().height);
+ }
+
+ public void display()
+ {
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ System.out.println("display()");
+
+ gl.glPushMatrix();
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+
+ gl.glBegin(GLEnum.GL_LINES);
+ gl.glColor4f(0f, 0f, 1f, 1f);
+ gl.glVertex3i( 0, 0, 0);
+ gl.glVertex3i( 10, 10, 0);
+
+ gl.glColor4f(0f, 1f, 0f, 1f);
+ gl.glVertex3i( 0, 10, 0);
+ gl.glVertex3i( 10, 0, 0);
+
+ gl.glColor4f(1f, 0f, 0f, 1f);
+ gl.glVertex3i( 0, 5, 0);
+ gl.glVertex3i( 10, 5, 0);
+
+ gl.glColor4f(1f, 1f, 1f, 1f);
+ gl.glVertex3i( 5, 0, 0);
+ gl.glVertex3i( 5, 10, 0);
+ gl.glEnd();
+
+ gl.glPopMatrix();
+
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+
+ System.out.println("display() done");
+
+ }
+
+ public void reshape( int width, int height )
+ {
+ gl.glViewport(0, 0, width, height);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ gl.glOrtho(0, 10, 0, 10, -50.0,50.0);
+ gl.glMatrixMode(GL_MODELVIEW);
+ }
+ }
+}
diff --git a/demos/MiscDemos/depthcue.html b/demos/MiscDemos/depthcue.html
new file mode 100644
index 0000000..53cba75
--- /dev/null
+++ b/demos/MiscDemos/depthcue.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<applet code="depthcue.class" width=400 height=400>
+</applet>
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/depthcue.java b/demos/MiscDemos/depthcue.java
new file mode 100644
index 0000000..3b6f04b
--- /dev/null
+++ b/demos/MiscDemos/depthcue.java
@@ -0,0 +1,140 @@
+/**
+ * @(#) depthcue.java
+ * @(#) author: Silicon Graphics, Inc. (converted to Java by Ron Cemer)
+ */
+
+/*
+ * This program demonstrates lots of material properties.
+ * A single light source illuminates the objects.
+ */
+
+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;
+
+import gl4java.utils.glut.*;
+
+public class depthcue extends Applet
+{
+ depthcueCanvas canvas = null;
+
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new depthcueCanvas(d.width, d.height);
+ add("Center", canvas);
+ }
+
+
+ /* Start the applet */
+
+
+ public void start()
+ {
+ }
+
+
+ /* Stop the applet */
+
+
+ public void stop()
+ {
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("teapots");
+
+ depthcue applet = new depthcue();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+
+ /* Local GLCanvas extension class */
+
+
+ private class depthcueCanvas extends GLCanvas
+ {
+ GLUTFunc glut = null;
+
+ public depthcueCanvas(int w, int h)
+ {
+ super(w, h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+/* Initialize depthcuealia(float)Math.sing for RGBA mode, including alpha
+ * blending, hint, and line width. Print out implementation
+ * specific info on line width granularity and width.
+ */
+ public void init()
+ {
+ glut = new GLUTFuncLightImpl(gl, glu);
+
+ reshape(getSize().width, getSize().height);
+
+ float fogColor[] = {0.0f, 0.0f, 0.0f, 1.0f};
+
+ gl.glEnable(GL_FOG);
+ gl.glFogi (GL_FOG_MODE, GL_LINEAR);
+ gl.glHint (GL_FOG_HINT, GL_NICEST); /* per pixel */
+ gl.glFogf (GL_FOG_START, 3.0f);
+ gl.glFogf (GL_FOG_END, 5.0f);
+ gl.glFogfv (GL_FOG_COLOR, fogColor);
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+
+ gl.glShadeModel(GL_FLAT);
+ gl.glDepthFunc(GL_LESS);
+ gl.glEnable(GL_DEPTH_TEST);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ gl.glColor3f (1.0f, 1.0f, 1.0f);
+ glut.glutWireIcosahedron();
+ glj.gljSwap();
+ glj.gljFree();
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glViewport(0, 0, w, h);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPerspective (45.0f, (float) w/(float) h, 3.0f, 5.0f);
+
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity ();
+ gl.glTranslatef (0.0f, 0.0f, -4.0f); /* move object into view */
+ }
+ }
+}
+
diff --git a/demos/MiscDemos/depthcue_plugin13.html b/demos/MiscDemos/depthcue_plugin13.html
new file mode 100644
index 0000000..a4b4a9e
--- /dev/null
+++ b/demos/MiscDemos/depthcue_plugin13.html
@@ -0,0 +1,48 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "depthcue.class" WIDTH = 400 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "depthcue.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "depthcue.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "depthcue.class" WIDTH = 400 HEIGHT = 400>
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/gears.html b/demos/MiscDemos/gears.html
new file mode 100644
index 0000000..56ebd8e
--- /dev/null
+++ b/demos/MiscDemos/gears.html
@@ -0,0 +1,13 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<applet code="gears.class" width=550 height=400>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/gears.java b/demos/MiscDemos/gears.java
new file mode 100644
index 0000000..b61d711
--- /dev/null
+++ b/demos/MiscDemos/gears.java
@@ -0,0 +1,437 @@
+/**
+ * @(#) gears.java
+ * @(#) author: Brian Paul (converted to Java by Ron Cemer and Sven Goethel)
+ *
+ * This version is equal to Brian Paul's version 1.2 1999/10/21
+ */
+
+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.GLEnum;
+import gl4java.awt.GLAnimCanvas;
+import gl4java.applet.SimpleGLAnimApplet1;
+
+public class gears extends SimpleGLAnimApplet1
+{
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ init(false);
+ }
+
+ public void init(boolean showGL)
+ {
+ super.init();
+ Dimension d = getSize();
+ canvas = new gearsCanvas(showGL, d.width, d.height);
+ add("Center", canvas);
+ }
+
+
+ public static void main( String args[] )
+ {
+ int i = 0;
+ String glLib = null;
+ String gluLib = null;
+ boolean perftest=false;
+
+ while(args.length>i)
+ {
+ if(args[i].equals("-perftest"))
+ {
+ perftest=true;
+ } else if(args[i].equals("-glLib"))
+ {
+ i++;
+ if(args.length>i)
+ glLib=args[i];
+ } else if(args[i].equals("-gluLib"))
+ {
+ i++;
+ if(args.length>i)
+ gluLib=args[i];
+ } else {
+ System.out.println("illegal arg "+i+": "+args[i]);
+ }
+ i++;
+ }
+
+ if(!perftest)
+ {
+ GLContext.gljNativeDebug = true;
+ GLContext.gljClassDebug = true;
+ }
+
+ System.out.println("loading libs(gl, glu): "+
+ glLib+", "+gluLib+": "+
+ GLContext.loadNativeLibraries(null, glLib, gluLib));
+
+ Frame mainFrame = new Frame("gears");
+
+ gears applet = new gears();
+
+ applet.setSize(300, 300);
+ applet.init(true);
+
+ if(perftest)
+ {
+ applet.canvas.setUseFpsSleep(false);
+ applet.canvas.setUseRepaint(false);
+ System.out.println("useFpsSleep: "+
+ applet.canvas.getUseFpsSleep());
+ System.out.println("useRepaint: "+
+ applet.canvas.getUseRepaint());
+ }
+
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+
+ /* Local GLAnimCanvas extension class */
+
+
+ private class gearsCanvas extends GLAnimCanvas implements MouseListener, MouseMotionListener
+ {
+ private static final float M_PI = 3.14159265f;
+
+ private long T0 = 0;
+ private long Frames = 0;
+
+ private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f;
+ private int gear1, gear2, gear3;
+ private float angle = 0.0f;
+
+ private int prevMouseX, prevMouseY;
+ private boolean mouseRButtonDown = false;
+
+ private boolean showGL = false;
+
+ public gearsCanvas(int w, int h)
+ {
+ this(false, w, h);
+ }
+
+ public gearsCanvas(boolean showGL, int w, int h)
+ {
+ super(w, h);
+ setAnimateFps(30.0);
+
+ this.showGL=showGL;
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+ public void init()
+ {
+ reshape(getSize().width, getSize().height);
+
+ float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
+ float red[] = { 0.8f, 0.1f, 0.0f, 1.0f };
+ float green[] = { 0.0f, 0.8f, 0.2f, 1.0f };
+ float blue[] = { 0.2f, 0.2f, 1.0f, 1.0f };
+
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, pos);
+ gl.glEnable(GL_CULL_FACE);
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_LIGHT0);
+ gl.glEnable(GL_DEPTH_TEST);
+
+ /* make the gears */
+ gear1 = gl.glGenLists(1);
+ gl.glNewList(gear1, GL_COMPILE);
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
+ gear(1.0f, 4.0f, 1.0f, 20, 0.7f);
+ gl.glEndList();
+
+ gear2 = gl.glGenLists(1);
+ gl.glNewList(gear2, GL_COMPILE);
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
+ gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
+ gl.glEndList();
+
+ gear3 = gl.glGenLists(1);
+ gl.glNewList(gear3, GL_COMPILE);
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
+ gear(1.3f, 2.0f, 0.5f, 10, 0.7f);
+ gl.glEndList();
+
+ gl.glEnable(GL_NORMALIZE);
+
+ glj.gljCheckGL();
+
+ addMouseListener(this);
+ addMouseMotionListener(this);
+
+ T0=System.currentTimeMillis();
+ }
+
+ public void doCleanup()
+ {
+ System.out.println("destroy(): " + this);
+ removeMouseListener(this);
+ removeMouseMotionListener(this);
+ }
+
+ public void reshape(int width, int height)
+ {
+ float h = (float)height / (float)width;
+
+ gl.glViewport(0,0,width,height);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ gl.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glTranslatef(0.0f, 0.0f, -40.0f);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ if(showGL)
+ {
+ showGL=false;
+ System.out.println("GL VERSION : "+gl.glGetString(GL_VERSION));
+ System.out.println("GL RENDERER: "+gl.glGetString(GL_RENDERER));
+ System.out.println("GL VENDOR : "+gl.glGetString(GL_VENDOR));
+ }
+
+ angle += 2.0f;
+
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ gl.glPushMatrix();
+ gl.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
+ gl.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
+ gl.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
+
+ gl.glPushMatrix();
+ gl.glTranslatef(-3.0f, -2.0f, 0.0f);
+ gl.glRotatef(angle, 0.0f, 0.0f, 1.0f);
+ gl.glCallList(gear1);
+ gl.glPopMatrix();
+
+ gl.glPushMatrix();
+ gl.glTranslatef(3.1f, -2.0f, 0.0f);
+ gl.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
+ gl.glCallList(gear2);
+ gl.glPopMatrix();
+
+ gl.glPushMatrix();
+ gl.glTranslatef(-3.1f, 4.2f, 0.0f);
+ gl.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
+ gl.glCallList(gear3);
+ gl.glPopMatrix();
+
+ gl.glPopMatrix();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+
+ Frames++;
+
+ long t=System.currentTimeMillis();
+ if(t - T0 >= 5000)
+ {
+ double seconds = (double)(t - T0) / 1000.0;
+ double fps = (double)Frames / seconds;
+ System.out.println(Frames+" frames in "+seconds+" seconds = "+
+ fps+" FPS");
+ T0 = t;
+ Frames = 0;
+ }
+ }
+
+ private void gear
+ (float inner_radius,
+ float outer_radius,
+ float width,
+ int teeth,
+ float tooth_depth)
+ {
+ int i;
+ float r0, r1, r2;
+ float angle, da;
+ float u, v, len;
+
+ r0 = inner_radius;
+ r1 = outer_radius - tooth_depth / 2.0f;
+ r2 = outer_radius + tooth_depth / 2.0f;
+
+ da = 2.0f * M_PI / teeth / 4.0f;
+
+ gl.glShadeModel(GL_FLAT);
+
+ gl.glNormal3f(0.0f, 0.0f, 1.0f);
+
+ /* draw front face */
+ gl.glBegin(GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++)
+ {
+ angle = i * 2.0f * M_PI / teeth;
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), width * 0.5f);
+ if(i < teeth)
+ {
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3.0f * da), r1 * (float)Math.sin(angle + 3.0f * da), width * 0.5f);
+ }
+ }
+ gl.glEnd();
+
+ /* draw front sides of teeth */
+ gl.glBegin(GL_QUADS);
+ for (i = 0; i < teeth; i++)
+ {
+ angle = i * 2.0f * M_PI / teeth;
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + da), r2 * (float)Math.sin(angle + da), width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + 2.0f * da), r2 * (float)Math.sin(angle + 2.0f * da), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3.0f * da), r1 * (float)Math.sin(angle + 3.0f * da), width * 0.5f);
+ }
+ gl.glEnd();
+
+ /* draw back face */
+ gl.glBegin(GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++)
+ {
+ angle = i * 2.0f * M_PI / teeth;
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), -width * 0.5f);
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), -width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3 * da), r1 * (float)Math.sin(angle + 3 * da), -width * 0.5f);
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), -width * 0.5f);
+ }
+ gl.glEnd();
+
+ /* draw back sides of teeth */
+ gl.glBegin(GL_QUADS);
+ for (i = 0; i < teeth; i++)
+ {
+ angle = i * 2.0f * M_PI / teeth;
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3 * da), r1 * (float)Math.sin(angle + 3 * da), -width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + 2 * da), r2 * (float)Math.sin(angle + 2 * da), -width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + da), r2 * (float)Math.sin(angle + da), -width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), -width * 0.5f);
+ }
+ gl.glEnd();
+
+ /* draw outward faces of teeth */
+ gl.glBegin(GL_QUAD_STRIP);
+ for (i = 0; i < teeth; i++)
+ {
+ angle = i * 2.0f * M_PI / teeth;
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), -width * 0.5f);
+ u = r2 * (float)Math.cos(angle + da) - r1 * (float)Math.cos(angle);
+ v = r2 * (float)Math.sin(angle + da) - r1 * (float)Math.sin(angle);
+ len = (float)Math.sqrt(u * u + v * v);
+ u /= len;
+ v /= len;
+ gl.glNormal3f(v, -u, 0.0f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + da), r2 * (float)Math.sin(angle + da), width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + da), r2 * (float)Math.sin(angle + da), -width * 0.5f);
+ gl.glNormal3f((float)Math.cos(angle), (float)Math.sin(angle), 0.0f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + 2 * da), r2 * (float)Math.sin(angle + 2 * da), width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + 2 * da), r2 * (float)Math.sin(angle + 2 * da), -width * 0.5f);
+ u = r1 * (float)Math.cos(angle + 3 * da) - r2 * (float)Math.cos(angle + 2 * da);
+ v = r1 * (float)Math.sin(angle + 3 * da) - r2 * (float)Math.sin(angle + 2 * da);
+ gl.glNormal3f(v, -u, 0.0f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3 * da), r1 * (float)Math.sin(angle + 3 * da), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3 * da), r1 * (float)Math.sin(angle + 3 * da), -width * 0.5f);
+ gl.glNormal3f((float)Math.cos(angle), (float)Math.sin(angle), 0.0f);
+ }
+ gl.glVertex3f(r1 * (float)Math.cos(0), r1 * (float)Math.sin(0), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(0), r1 * (float)Math.sin(0), -width * 0.5f);
+ gl.glEnd();
+
+ gl.glShadeModel(GL_SMOOTH);
+
+ /* draw inside radius cylinder */
+ gl.glBegin(GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++)
+ {
+ angle = i * 2.0f * M_PI / teeth;
+ gl.glNormal3f(-(float)Math.cos(angle), -(float)Math.sin(angle), 0.0f);
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), -width * 0.5f);
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), width * 0.5f);
+ }
+ gl.glEnd();
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered( MouseEvent evt )
+ {
+ }
+
+ public void mouseExited( MouseEvent evt )
+ {
+ }
+
+ public void mousePressed( MouseEvent evt )
+ {
+ prevMouseX = evt.getX();
+ prevMouseY = evt.getY();
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ mouseRButtonDown = true;
+ evt.consume();
+ }
+ }
+
+ public void mouseReleased( MouseEvent evt )
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ mouseRButtonDown = false;
+ evt.consume();
+ }
+ }
+
+ public void mouseClicked( MouseEvent evt )
+ {
+ }
+
+ // Methods required for the implementation of MouseMotionListener
+ public void mouseDragged( MouseEvent evt )
+ {
+ int x = evt.getX();
+ int y = evt.getY();
+ Dimension size = getSize();
+
+ float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)size.width);
+ float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)size.height);
+
+ prevMouseX = x;
+ prevMouseY = y;
+
+ view_rotx += thetaX;
+ view_roty += thetaY;
+
+ evt.consume();
+ }
+
+ public void mouseMoved( MouseEvent evt )
+ {
+ }
+ }
+}
diff --git a/demos/MiscDemos/gears_plugin13.html b/demos/MiscDemos/gears_plugin13.html
new file mode 100644
index 0000000..acaaea5
--- /dev/null
+++ b/demos/MiscDemos/gears_plugin13.html
@@ -0,0 +1,45 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 550 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "gears.class" WIDTH = 550 HEIGHT = 400 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "gears.class" WIDTH = 550 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "gears.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "gears.class" WIDTH = 550 HEIGHT = 400>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/glJavaFontTest1.java b/demos/MiscDemos/glJavaFontTest1.java
new file mode 100644
index 0000000..78ccd39
--- /dev/null
+++ b/demos/MiscDemos/glJavaFontTest1.java
@@ -0,0 +1,120 @@
+// Font rendering using GL4Java
+// by Pontus Lidman
+// (c) 2000 MathCore AB
+
+import gl4java.awt.*;
+import javax.swing.*;
+import java.awt.Dimension;
+import gl4java.GLContext;
+import gl4java.GLFunc;
+
+import java.awt.Font;
+import java.awt.Shape;
+import java.awt.font.*;
+import java.awt.geom.*;
+
+public class glJavaFontTest1 {
+
+
+ protected class MyCanvas extends GLCanvas {
+
+
+ public void drawString(String s,double x,double y) {
+
+ Font font=new Font("timesroman",Font.PLAIN,12);
+ AffineTransform identity=new AffineTransform();
+ FontRenderContext frc=new FontRenderContext(identity,false,false);
+ GlyphVector g=font.createGlyphVector(frc,s);
+ Shape shp=g.getOutline();
+ FlatteningPathIterator path=new FlatteningPathIterator(shp.getPathIterator(identity),0.05);
+
+ double [] coords=new double[6];
+ int type;
+
+ while (!path.isDone()) {
+ type=path.currentSegment(coords);
+ switch(type) {
+ case PathIterator.SEG_MOVETO:
+ gl.glBegin(GL_LINE_STRIP);
+ gl.glVertex2d(x+coords[0],y+coords[1]);
+ break;
+ case PathIterator.SEG_LINETO:
+ gl.glVertex2d(x+coords[0],y+coords[1]);
+ break;
+ case PathIterator.SEG_CLOSE:
+ gl.glEnd();
+ break;
+ }
+ path.next();
+ }
+ }
+
+ public MyCanvas(int w, int h) {
+ super(w,h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ public void init() {
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glOrtho(-50,50,50,-50,-50.0,50.0);
+ gl.glMatrixMode(GL_MODELVIEW);
+ glj.gljCheckGL();
+ }
+
+ public void reshape(int w, int h) {
+ Dimension d=new Dimension(w,h);
+ if (!cvsIsInit()) return;
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("problem in use() method");
+ return;
+ }
+ setSize(d);
+ gl.glViewport(0,0,w,h);
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void display() {
+ int i;
+
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glPushMatrix();
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+ glu.gluLookAt(0, 0, 20, 0, 0, 0, 0, 1, 0);
+
+ gl.glColor3d(1,1,1);
+ drawString("Hello world!",-40,0);
+
+
+ gl.glPopMatrix();
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+ }
+
+ protected MyCanvas cvs;
+ protected JFrame frame;
+
+ public glJavaFontTest1() {
+ frame = new JFrame( "OpenGL" );
+ cvs= new MyCanvas(640,480);
+ frame.setSize(640,480);
+ frame.getContentPane().add("Center", cvs);
+ frame.setVisible(true);
+ }
+
+ public static void main(java.lang.String[] args) {
+ try {
+ glJavaFontTest1 g=new glJavaFontTest1();
+ } catch (Throwable exception) {
+ System.err.println("Exception occurred in main()");
+ exception.printStackTrace(System.out);
+ }
+ }
+}
diff --git a/demos/MiscDemos/glutFontBitmapTest.html b/demos/MiscDemos/glutFontBitmapTest.html
new file mode 100644
index 0000000..d70bcd9
--- /dev/null
+++ b/demos/MiscDemos/glutFontBitmapTest.html
@@ -0,0 +1,15 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<br>
+<hr>
+<applet code="glutFontBitmapTest.class" width=600 height=400>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/glutFontBitmapTest.java b/demos/MiscDemos/glutFontBitmapTest.java
new file mode 100644
index 0000000..bb2a2a4
--- /dev/null
+++ b/demos/MiscDemos/glutFontBitmapTest.java
@@ -0,0 +1,137 @@
+// Test program for GLUT Bitmap font rendering functions
+// by Pontus Lidman
+// Copyright 2000 MathCore AB
+//
+// This file/package is licensed under the terms of the LPGL
+// with the permission of Pontus Lidman / Mathcore !
+//
+
+import gl4java.utils.glut.*;
+import gl4java.utils.glut.fonts.*;
+
+import gl4java.awt.*;
+import java.applet.*;
+import java.awt.*;
+import java.awt.Dimension;
+import gl4java.GLContext;
+import gl4java.GLFunc;
+
+public class glutFontBitmapTest extends Applet {
+
+ protected GLUTFunc glut = null;
+
+ protected class MyCanvas extends GLCanvas
+ {
+
+ boolean print_tests=false;
+
+ public MyCanvas(int w, int h) {
+ super(w,h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ public void init() {
+ glut = new GLUTFuncLightImplWithFonts(gl, glu);
+
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glOrtho(-1,1,-1,1,-50.0,50.0);
+ gl.glMatrixMode(GL_MODELVIEW);
+ glj.gljCheckGL();
+ }
+
+ public void reshape(int w, int h) {
+ Dimension d=new Dimension(w,h);
+ if (!cvsIsInit()) return;
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("problem in use() method");
+ return;
+ }
+ setSize(d);
+ gl.glViewport(0,0,w,h);
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void display() {
+ int i;
+
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glPushMatrix();
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+ glu.gluLookAt(0, 0, 20, 0, 0, 0, 0, 1, 0);
+
+ gl.glColor3d(0.3,0,0);
+
+ gl.glBegin(GL_POLYGON);
+ gl.glVertex2d(0,-0.5);
+ gl.glVertex2d(0.5,0.5);
+ gl.glVertex2d(-0.5,0.5);
+ gl.glEnd();
+
+ gl.glColor3d(1,1,1);
+ gl.glRasterPos2d(-0.2,-0.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_8_BY_13,"8x13 Font");
+ gl.glRasterPos2d(-0.2,-0.1);
+ glut.glutBitmapString(glut.GLUT_BITMAP_9_BY_15,"9x15 Font");
+ gl.glRasterPos2d(-0.2,0.0);
+ glut.glutBitmapString(glut.GLUT_BITMAP_HELVETICA_10,"Helvetica 10 Font");
+ gl.glRasterPos2d(-0.2,0.1);
+ glut.glutBitmapString(glut.GLUT_BITMAP_HELVETICA_12,"Helvetica 12 Font");
+ gl.glRasterPos2d(-0.2,0.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_HELVETICA_18,"Helvetica 18 Font");
+ gl.glRasterPos2d(-0.2,0.3);
+ glut.glutBitmapString(glut.GLUT_BITMAP_TIMES_ROMAN_10,"Times Roman 10 Font");
+ gl.glRasterPos2d(-0.2,0.4);
+ glut.glutBitmapString(glut.GLUT_BITMAP_TIMES_ROMAN_24,"Times Roman 24 Font");
+
+ gl.glPopMatrix();
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+ }
+
+ protected MyCanvas cvs;
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ cvs= new MyCanvas(d.width,d.height);
+ add("Center", cvs);
+ }
+
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ public static void main(java.lang.String[] args) {
+ try {
+ Frame mainFrame = new Frame("FontTest");
+
+ glutFontBitmapTest applet=new glutFontBitmapTest();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ } catch (Throwable exception) {
+ System.err.println("Exception occurred in main()");
+ exception.printStackTrace(System.out);
+ }
+ }
+}
diff --git a/demos/MiscDemos/glutFontBitmapTest2Applet$glutF b/demos/MiscDemos/glutFontBitmapTest2Applet$glutF
new file mode 100644
index 0000000..a23aee0
--- /dev/null
+++ b/demos/MiscDemos/glutFontBitmapTest2Applet$glutF
Binary files differ
diff --git a/demos/MiscDemos/glutFontBitmapTest2Applet.html b/demos/MiscDemos/glutFontBitmapTest2Applet.html
new file mode 100644
index 0000000..a10559b
--- /dev/null
+++ b/demos/MiscDemos/glutFontBitmapTest2Applet.html
@@ -0,0 +1,16 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<B>Try to drag the mouse (press-button and move) with/without the SHIFT key!</B>
+<br>
+<hr>
+<applet code="glutFontBitmapTest2Applet.class" width=600 height=400>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/glutFontBitmapTest2Applet.java b/demos/MiscDemos/glutFontBitmapTest2Applet.java
new file mode 100644
index 0000000..0985385
--- /dev/null
+++ b/demos/MiscDemos/glutFontBitmapTest2Applet.java
@@ -0,0 +1,319 @@
+
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.utils.textures.*;
+import gl4java.utils.glut.*;
+import gl4java.utils.glut.fonts.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.*;
+import java.net.*;
+
+public class glutFontBitmapTest2Applet extends Applet
+{
+ glutFontBitmapTest2 canvas = null;
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new glutFontBitmapTest2 (d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("font test 2");
+
+ glutFontBitmapTest2Applet applet =
+ new glutFontBitmapTest2Applet();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+ class glutFontBitmapTest2 extends GLCanvas
+ implements MouseListener,MouseMotionListener
+ {
+ float []mPosObjTrans;
+ float []mPosObjRot;
+
+ Point mousePoint;
+ Point oldMousePoint;
+ boolean mouseMoveFlag;
+
+ protected GLUTFunc glut = null;
+
+ int texName[] = {0};
+
+ public glutFontBitmapTest2 (int w, int h)
+ {
+ super(w, h);
+ }
+
+ public void init()
+ {
+ glut = new GLUTFuncLightImplWithFonts(gl, glu);
+
+ // cameraMatrix init
+ mPosObjTrans=new float[16];
+ for(int i=0;i<16;i++)
+ mPosObjTrans[i]=0f;
+ mPosObjTrans[0]=mPosObjTrans[5]=mPosObjTrans[10]=mPosObjTrans[15]=1f;
+
+ mPosObjRot=new float[16];
+ for(int i=0;i<16;i++)
+ mPosObjRot[i]=0f;
+ mPosObjRot[0]=mPosObjRot[5]=mPosObjRot[10]=mPosObjRot[15]=1f;
+
+ TranlateObj(0f,0f,-10f);
+
+ gl.glShadeModel (GL_SMOOTH);
+ gl.glEnable(GL_DEPTH_TEST);
+
+ gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
+ gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glj.gljCheckGL();
+
+ canvas.addMouseListener(this);
+ canvas.addMouseMotionListener(this);
+ mouseMoveFlag=false;
+
+ reshape(getSize().width, getSize().height);
+ }
+
+ public void display()
+ {
+ int i;
+
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ // just render it
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ SetCamera();
+
+ DrawScene();
+
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glViewport (0, 0, w, h);
+ gl.glLoadIdentity();
+ SetCamera();
+ }
+
+
+ public void drawGrid(float x0, float y0,
+ float width, float height, float step)
+ {
+ float i,j;
+
+ /* draw grid */
+ gl.glBegin(GL_LINES);
+ for(i=x0;i<width;i+=step)
+ for(j=y0;j<height;j+=step)
+ {
+ if(i==0f && j==0f)
+ gl.glColor3f (1f,0f,0f);
+ else
+ gl.glColor3f (0.6f,0.5f,0.5f);
+ gl.glVertex2f(0f,j);
+ gl.glVertex2f(width,j);
+ gl.glVertex2f(i,height);
+ gl.glVertex2f(i,0f);
+ }
+ gl.glEnd();
+ }
+
+ void DrawScene()
+ {
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glLoadMatrixf(mPosObjTrans);
+ gl.glMultMatrixf(mPosObjRot);
+
+ gl.glPushMatrix();
+ drawGrid(0f, 0f, 10f, 10f, 0.5f);
+ gl.glPopMatrix();
+
+ // obj zeichnen
+ gl.glPushMatrix();
+ gl.glColor3d(0.3,0,0);
+
+ gl.glBegin(GL_POLYGON);
+ gl.glVertex2d(0,-0.5);
+ gl.glVertex2d(0.5,0.5);
+ gl.glVertex2d(-0.5,0.5);
+ gl.glEnd();
+
+ gl.glColor3d(1,1,1);
+ gl.glRasterPos2d(-2.2,-1.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_8_BY_13,"8x13 Font");
+ gl.glRasterPos2d(-2.2,0.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_9_BY_15,"9x15 Font");
+ gl.glRasterPos2d(-2.2,1.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_HELVETICA_10,"Helvetica 10 Font");
+ gl.glRasterPos2d(-2.2,2.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_HELVETICA_12,"Helvetica 12 Font");
+ gl.glRasterPos2d(-2.2,3.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_HELVETICA_18,"Helvetica 18 Font");
+ gl.glRasterPos2d(-2.2,4.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_TIMES_ROMAN_10,"Times Roman 10 Font");
+ gl.glRasterPos2d(-2.2,5.2);
+ glut.glutBitmapString(glut.GLUT_BITMAP_TIMES_ROMAN_24,"Times Roman 24 Font");
+ gl.glPopMatrix();
+
+ }
+
+ void SetCamera()
+ {
+ Dimension dim=getSize();
+ float aspect=(float)dim.width/(float)dim.height;
+
+ gl.glMatrixMode (GL_PROJECTION);
+ gl.glLoadIdentity ();
+ glu.gluPerspective(60f,aspect,.01,100);
+ }
+
+ void RotateObj(float degree,
+ float axisX,
+ float axisY,
+ float axisZ)
+ {
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glRotatef(degree,axisX,axisY,axisZ);
+ gl.glMultMatrixf(mPosObjRot);
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjRot);
+
+ repaint();
+ }
+
+ void TranlateObj(float x,float y,float z)
+ {
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glLoadMatrixf(mPosObjTrans);
+ gl.glTranslatef(x,y,z);
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjTrans);
+
+ repaint();
+ }
+
+ // entfernt rotationen aus aktueller matrix
+ double Billboard()
+ {
+ float[] mat=new float[16];
+
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mat);
+ mat[0] = mat[5] = mat[10] = 1;
+ mat[1] = mat[2] = mat[4] = mat[6] = mat[8] = mat[9] = 0;
+ gl.glLoadMatrixf(mat);
+
+ return mat[14];
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered( MouseEvent evt )
+ {
+ }
+
+ public void mouseExited( MouseEvent evt )
+ {
+ }
+
+ public void mousePressed( MouseEvent evt )
+ {
+ if(mouseMoveFlag==false)
+ { // start drag
+ mouseMoveFlag=true;
+ mousePoint=evt.getPoint();
+ }
+ }
+
+ public void mouseReleased( MouseEvent evt )
+ {
+ mouseMoveFlag=false;
+ }
+
+ public void mouseClicked( MouseEvent evt )
+ {
+ Component comp = evt.getComponent();
+ }
+
+ public void mouseDragged(MouseEvent e)
+ {
+ if(mouseMoveFlag==true)
+ {
+ oldMousePoint=new Point(mousePoint);
+ mousePoint=e.getPoint();
+
+ Point dif=new Point(mousePoint.x-oldMousePoint.x,
+ mousePoint.y-oldMousePoint.y);
+
+ if(e.isShiftDown()==true)
+ TranlateObj((float)dif.x/6.0f,(float)dif.y/-6.0f,0f);
+ else if(e.isAltDown()==true)
+ {
+ TranlateObj(0f,0f,(float)dif.y/6.0f);
+ RotateObj(dif.x,0f,0f,1f);
+ }
+ else
+ {
+ RotateObj(dif.x,0f,1f,0f);
+ RotateObj(dif.y,1f,0f,0f);
+ }
+ }
+ }
+ public void mouseMoved(MouseEvent e)
+ {
+ }
+
+
+ }
+}
diff --git a/demos/MiscDemos/glutFontBitmapTest2Applet_plugin13.html b/demos/MiscDemos/glutFontBitmapTest2Applet_plugin13.html
new file mode 100644
index 0000000..2acee05
--- /dev/null
+++ b/demos/MiscDemos/glutFontBitmapTest2Applet_plugin13.html
@@ -0,0 +1,48 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<B>Try to drag the mouse (press-button and move) with/without the SHIFT key!</B>
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 600 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "glutFontBitmapTest2Applet.class" WIDTH = 600 HEIGHT = 400 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "glutFontBitmapTest2Applet.class" WIDTH = 600 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "glutFontBitmapTest2Applet.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "glutFontBitmapTest2Applet.class" WIDTH = 600 HEIGHT = 400>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/glutFontBitmapTest_plugin13.html b/demos/MiscDemos/glutFontBitmapTest_plugin13.html
new file mode 100644
index 0000000..2c747d1
--- /dev/null
+++ b/demos/MiscDemos/glutFontBitmapTest_plugin13.html
@@ -0,0 +1,47 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 600 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "glutFontBitmapTest.class" WIDTH = 600 HEIGHT = 400 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "glutFontBitmapTest.class" WIDTH = 600 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "glutFontBitmapTest.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "glutFontBitmapTest.class" WIDTH = 600 HEIGHT = 400>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/glutFontStrokeTest.html b/demos/MiscDemos/glutFontStrokeTest.html
new file mode 100644
index 0000000..0264ee6
--- /dev/null
+++ b/demos/MiscDemos/glutFontStrokeTest.html
@@ -0,0 +1,15 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<br>
+<hr>
+<applet code="glutFontStrokeTest.class" width=600 height=400>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/glutFontStrokeTest.java b/demos/MiscDemos/glutFontStrokeTest.java
new file mode 100644
index 0000000..27d95fc
--- /dev/null
+++ b/demos/MiscDemos/glutFontStrokeTest.java
@@ -0,0 +1,128 @@
+// Test program for GLUT Stroke font rendering functions
+// by Pontus Lidman
+// Copyright 2000 MathCore AB
+//
+// This file/package is licensed under the terms of the LPGL
+// with the permission of Pontus Lidman / Mathcore !
+//
+
+import gl4java.utils.glut.*;
+import gl4java.utils.glut.fonts.*;
+
+import gl4java.awt.*;
+import java.applet.*;
+import java.awt.*;
+import java.awt.Dimension;
+import gl4java.GLContext;
+import gl4java.GLFunc;
+
+public class glutFontStrokeTest extends Applet {
+
+ protected GLUTFunc glut = null;
+
+ protected class MyCanvas extends GLCanvas {
+
+ public MyCanvas(int w, int h) {
+ super(w,h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ public void init() {
+ glut = new GLUTFuncLightImplWithFonts(gl, glu);
+
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glOrtho(-1000,1000,-1000,1000,-50.0,50.0);
+ gl.glMatrixMode(GL_MODELVIEW);
+ glj.gljCheckGL();
+ }
+
+ public void reshape(int w, int h) {
+ Dimension d=new Dimension(w,h);
+ if (!cvsIsInit()) return;
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("problem in use() method");
+ return;
+ }
+ setSize(d);
+ gl.glViewport(0,0,w,h);
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void display() {
+ int i;
+
+ if( glj.gljMakeCurrent() == false ) {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glPushMatrix();
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+ glu.gluLookAt(0, 0, 20, 0, 0, 0, 0, 1, 0);
+
+ gl.glColor3d(0.3,0,0);
+
+ gl.glBegin(GL_POLYGON);
+ gl.glVertex2d(0,-0.5);
+ gl.glVertex2d(0.5,0.5);
+ gl.glVertex2d(-0.5,0.5);
+ gl.glEnd();
+
+ gl.glColor3d(1,1,1);
+ gl.glPushMatrix();
+ gl.glTranslated(-900,-100,0);
+ glut.glutStrokeString(glut.GLUT_STROKE_ROMAN,"Roman Font");
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glTranslated(-900,100,0);
+ glut.glutStrokeString(glut.GLUT_STROKE_MONO_ROMAN,"Mono Roman Font");
+ gl.glPopMatrix();
+
+ gl.glPopMatrix();
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+ }
+
+ protected MyCanvas cvs;
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ cvs= new MyCanvas(d.width,d.height);
+ add("Center", cvs);
+ }
+
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ public static void main(java.lang.String[] args) {
+ try {
+ Frame mainFrame = new Frame("Stroke Test");
+
+ glutFontStrokeTest applet=new glutFontStrokeTest();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ } catch (Throwable exception) {
+ System.err.println("Exception occurred in main()");
+ exception.printStackTrace(System.out);
+ }
+ }
+}
diff --git a/demos/MiscDemos/glutFontStrokeTest_plugin13.html b/demos/MiscDemos/glutFontStrokeTest_plugin13.html
new file mode 100644
index 0000000..6c74a92
--- /dev/null
+++ b/demos/MiscDemos/glutFontStrokeTest_plugin13.html
@@ -0,0 +1,47 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 600 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "glutFontStrokeTest.class" WIDTH = 600 HEIGHT = 400 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "glutFontStrokeTest.class" WIDTH = 600 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "glutFontStrokeTest.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "glutFontStrokeTest.class" WIDTH = 600 HEIGHT = 400>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/index.html b/demos/MiscDemos/index.html
new file mode 100644
index 0000000..0c01565
--- /dev/null
+++ b/demos/MiscDemos/index.html
@@ -0,0 +1,78 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="Ron Cemer & Sven Goethel">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>Misc Demos</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<p>Here are the demos-II for <B> GL4Java >= 2.4.0.0: </B> <br>
+<br>
+<p><a href="index_plugin13.html">To use the Java2 Plug-In (Java2, JRE, Plug-In 1.3), click here !</a><br>
+<br>
+<B>Try to use the right-mouse-button for a pop-up menu within the demos !</B>
+<br>
+<p>&nbsp;<a href="TriangleRotate.html">TriangleRotate</a>
+: TriangleRotate at 500x300
+<p>&nbsp;<a href="DrawColoredPrimitives.html">DrawColoredPrimitives</a>
+: DrawColoredPrimitives at 500x300
+<p>&nbsp;<a href="DrawColoredPrimitives2.html">DrawColoredPrimitives2</a>
+: DrawColoredPrimitives2 at 500x300
+<p>&nbsp;<a href="nurbs.html">nurbs</a>
+: nurbs at 500x300
+<p>&nbsp;<a href="spectex.html">spectex</a>
+: spectex at 400x400
+<p>&nbsp;<a href="morph3d.html">morph3d</a>
+: morph3d at 400x400
+<p>&nbsp;<a href="gears.html">gears</a>
+: gears at 400x400
+<br>&nbsp;
+<br>
+<p>&nbsp;<a href="accanti.html">accanti</a>
+: accanti at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="alpha3D.html">alpha3D</a>
+: alpha3D at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="anti.html">anti</a>
+: anti at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="depthcue.html">depthcue</a>
+: depthcue at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="teaambient.html">teaambient</a>
+: teaambient at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="teapots.html">teapots</a>
+: teapots at 400x400 (GLUT DEMO)
+<br>&nbsp;
+<br>
+<p>&nbsp;<a href="pngTextureTestApplet.html">pngTextureTestApplet</a>
+: png texture test at 600x400 (GLUT DEMO)
+<br>&nbsp;
+<br>
+<br>&nbsp;<a href="stencil.html">Stencil Test</a>
+: test/shows geometry with 0 and 8 stencil-bits
+<p>&nbsp;<a href="glutFontStrokeTest.html">GLUT Font Stroke 1</a>
+: GLUT Font Stroke 1 (GLUT DEMO)
+<p>&nbsp;<a href="glutFontBitmapTest.html">GLUT Font Bitmap 1</a>
+: GLUT Font Bitmap 1 (GLUT DEMO)
+<p>&nbsp;<a href="glutFontBitmapTest2Applet.html">GLUT Font Bitmap 2</a>
+: GLUT Font Bitmap 2 (GLUT DEMO)
+<br>&nbsp;
+<br>
+<br>&nbsp;<a href="tess.html">Tessellator Demo 1</a>
+: test/shows 2 tesselated geometries
+<br>&nbsp;<a href="tesswind.html">Tessellator Demo 2</a>
+: test/shows tesselated geometries with different winding rules
+<br>&nbsp;<a href="tessdemo.html">Tessellator Demo 3</a>
+: test/shows self created tesselated geometries
+<br>&nbsp;
+<br>
+<br>&nbsp;<a href="SharedGLTest2.html">Shared GL-Context</a>
+: test/shows the usage of a shared GLContext for Display-Lists
+<br>&nbsp;
+<br>
+<br>&nbsp;<a href="select.html">Selection Demo 1</a>
+: test/shows selection
+<br>&nbsp;
+<br>
+<br>
+</body>
+</html>
diff --git a/demos/MiscDemos/index_plugin13.html b/demos/MiscDemos/index_plugin13.html
new file mode 100644
index 0000000..082aab8
--- /dev/null
+++ b/demos/MiscDemos/index_plugin13.html
@@ -0,0 +1,80 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="Ron Cemer & Sven Goethel">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>Misc Demos</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<p>Here are the demos-II for <B> GL4Java >= 2.4.0.0: & Java2 Plug-In 1.3</B>
+<hr>
+<br>&nbsp;
+<a href="../../Installer/java.policy">The Java2 (sdk, jre, plugin 1.3) policy file example to give GL4Java the necessary permissions (Click here) !</a>
+<br>&nbsp;
+<hr>
+<B>Try to use the right-mouse-button for a pop-up menu within the demos !</B>
+<br>
+<p>&nbsp;<a href="TriangleRotate_plugin13.html">TriangleRotate</a>
+: TriangleRotate at 500x300
+<p>&nbsp;<a href="DrawColoredPrimitives_plugin13.html">DrawColoredPrimitives</a>
+: DrawColoredPrimitives at 500x300
+<p>&nbsp;<a href="DrawColoredPrimitives2_plugin13.html">DrawColoredPrimitives2</a>
+: DrawColoredPrimitives2 at 500x300
+<p>&nbsp;<a href="nurbs_plugin13.html">nurbs</a>
+: nurbs at 500x300
+<p>&nbsp;<a href="spectex_plugin13.html">spectex</a>
+: spectex at 400x400
+<p>&nbsp;<a href="morph3d_plugin13.html">morph3d</a>
+: morph3d at 400x400
+<p>&nbsp;<a href="gears_plugin13.html">gears</a>
+: gears at 400x400
+<br>&nbsp;
+<br>
+<p>&nbsp;<a href="accanti_plugin13.html">accanti</a>
+: accanti at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="alpha3D_plugin13.html">alpha3D</a>
+: alpha3D at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="anti_plugin13.html">anti</a>
+: anti at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="depthcue_plugin13.html">depthcue</a>
+: depthcue at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="teaambient_plugin13.html">teaambient</a>
+: teaambient at 400x400 (GLUT DEMO)
+<p>&nbsp;<a href="teapots_plugin13.html">teapots</a>
+: teapots at 400x400 (GLUT DEMO)
+<br>&nbsp;
+<br>
+<p>&nbsp;<a href="pngTextureTestApplet_plugin13.html">pngTextureTestApplet</a>
+: png texture test at 600x400 (GLUT DEMO)
+<br>&nbsp;
+<br>
+<br>&nbsp;<a href="stencil_plugin13.html">Stencil Test</a>
+: test/shows geometry with 0 and 8 stencil-bits
+<p>&nbsp;<a href="glutFontStrokeTest_plugin13.html">GLUT Font Stroke 1</a>
+: GLUT Font Stroke 1 (GLUT DEMO)
+<p>&nbsp;<a href="glutFontBitmapTest_plugin13.html">GLUT Font Bitmap 1</a>
+: GLUT Font Bitmap 1 (GLUT DEMO)
+<p>&nbsp;<a href="glutFontBitmapTest2Applet_plugin13.html">GLUT Font Bitmap 2</a>
+: GLUT Font Bitmap 2 (GLUT DEMO)
+<br>&nbsp;
+<br>
+<br>&nbsp;<a href="tess_plugin13.html">Tessellator Demo 1</a>
+: test/shows 2 tesselated geometries
+<br>&nbsp;<a href="tesswind_plugin13.html">Tessellator Demo 2</a>
+: test/shows tesselated geometries with different winding rules
+<br>&nbsp;<a href="tessdemo_plugin13.html">Tessellator Demo 3</a>
+: test/shows self created tesselated geometries
+<br>&nbsp;
+<br>
+<br>&nbsp;<a href="SharedGLTest2_plugin13.html">Shared GL-Context</a>
+: test/shows the usage of a shared GLContext for Display-Lists
+<br>&nbsp;
+<br>
+<br>&nbsp;<a href="select_plugin13.html">Selection Demo 1</a>
+: test/shows selection
+<br>&nbsp;
+<br>
+<br>
+</body>
+</html>
diff --git a/demos/MiscDemos/morph3d.html b/demos/MiscDemos/morph3d.html
new file mode 100644
index 0000000..b99094a
--- /dev/null
+++ b/demos/MiscDemos/morph3d.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<applet code="morph3d.class" width=400 height=400>
+</applet>
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/morph3d.java b/demos/MiscDemos/morph3d.java
new file mode 100755
index 0000000..7c8a8fe
--- /dev/null
+++ b/demos/MiscDemos/morph3d.java
@@ -0,0 +1,1060 @@
+/*-
+ * morph3d.c - Shows 3D morphing objects
+ *
+ * Converted to GLUT by brianp on 1/1/98
+ *
+ * This program was inspired on a WindowsNT(R)'s screen saver. It was written
+ * from scratch and it was not based on any other source code.
+ *
+ * Porting it to xlock (the final objective of this code (float)Math.since the moment I
+ * decided to create it) was possible by comparing the original Mesa's gear
+ * demo with it's ported version, so thanks for Danny Sung for his indirect
+ * help (look at gear.c in xlock source tree). NOTE: At the moment this code
+ * was sent to Brian Paul for package inclusion, the XLock Version was not
+ * available. In fact, I'll wait it to appear on the next Mesa release (If you
+ * are reading this, it means THIS release) to send it for xlock package
+ * inclusion). It will probably there be a GLUT version too.
+ *
+ * Thanks goes also to Brian Paul for making it possible and inexpensive
+ * to use OpenGL at home.
+ *
+ * Since I'm not a native english speaker, my apologies for any gramatical
+ * mistake.
+ *
+ * My e-mail addresses are
+ *
+ * and
+ *
+ * Marcelo F. Vianna (Feb-13-1997)
+ */
+
+/*
+This document is VERY incomplete, but tries to describe the mathematics used
+in the program. At this moment it just describes how the polyhedra are
+generated. On futhurer versions, this document will be probabbly improved.
+
+Since I'm not a native english speaker, my apologies for any gramatical
+mistake.
+
+Marcelo Fernandes Vianna
+- Undergraduate in Computer Engeneering at Catholic Pontifical University
+- of Rio de Janeiro (PUC-Rio) Brasil.
+- Feb-13-1997
+
+POLYHEDRA GENERATION
+
+For the purpose of this program it's not sufficient to know the polyhedra
+vertexes coordinates. Since the morphing algorithm applies a nonlinear
+transformation over the surfaces (faces) of the polyhedron, each face has
+to be divided into smaller ones. The morphing algorithm needs to transform
+each vertex of these smaller faces individually. It's a very time consoming
+task.
+
+In order to reduce calculation overload, and (float)Math.since all the macro faces of
+the polyhedron are transformed by the same way, the generation is made by
+creating only one face of the polyhedron, morphing it and then rotating it
+around the polyhedron center.
+
+What we need to know is the face radius of the polyhedron (the radius of
+the inscribed sphere) and the angle between the center of two adjacent
+faces u(float)Math.sing the center of the sphere as the angle's vertex.
+
+The face radius of the regular polyhedra are known values which I decided
+to not waste my time calculating. Following is a table of face radius for
+the regular polyhedra with edge length = 1:
+
+ TETRAHEDRON : 1/(2*(float)Math.sqrt(2))/(float)Math.sqrt(3)
+ CUBE : 1/2
+ OCTAHEDRON : 1/(float)Math.sqrt(6)
+ DODECAHEDRON : T^2 * (float)Math.sqrt((T+2)/5) / 2 -> where T=((float)Math.sqrt(5)+1)/2
+ ICOSAHEDRON : (3*(float)Math.sqrt(3)+(float)Math.sqrt(15))/12
+
+I've not found any reference about the mentioned angles, so I needed to
+calculate them, not a trivial task until I figured out how :)
+Curiously these angles are the same for the tetrahedron and octahedron.
+A way to obtain this value is inscribing the tetrahedron inside the cube
+by matching their vertexes. So you'll notice that the remaining unmatched
+vertexes are in the same straight line starting in the cube/tetrahedron
+center and cros(float)Math.sing the center of each tetrahedron's face. At this point
+it's easy to obtain the bigger angle of the isosceles triangle formed by
+the center of the cube and two opposite vertexes on the same cube face.
+The edges of this triangle have the following lenghts: (float)Math.sqrt(2) for the base
+and (float)Math.sqrt(3)/2 for the other two other edges. So the angle we want is:
+ +-----------------------------------------------------------+
+ | 2*ARCSIN((float)Math.sqrt(2)/(float)Math.sqrt(3)) = 109.47122063449069174f degrees |
+ +-----------------------------------------------------------+
+For the cube this angle is obvious, but just for formality it can be
+easily obtained because we also know it's isosceles edge lenghts:
+(float)Math.sqrt(2)/2 for the base and 1/2 for the other two edges. So the angle we
+want is:
+ +-----------------------------------------------------------+
+ | 2*ARCSIN(((float)Math.sqrt(2)/2)/1) = 90.000000000000000000f degrees |
+ +-----------------------------------------------------------+
+For the octahedron we use the same idea used for the tetrahedron, but now
+we inscribe the cube inside the octahedron so that all cubes's vertexes
+matches excatly the center of each octahedron's face. It's now clear that
+this angle is the same of the thetrahedron one:
+ +-----------------------------------------------------------+
+ | 2*ARCSIN((float)Math.sqrt(2)/(float)Math.sqrt(3)) = 109.47122063449069174f degrees |
+ +-----------------------------------------------------------+
+For the dodecahedron it's a little bit harder because it's only relationship
+with the cube is useless to us. So we need to solve the problem by another
+way. The concept of Face radius also exists on 2D polygons with the name
+Edge radius:
+ Edge Radius For Pentagon (ERp)
+ ERp = (1/2)/TAN(36 degrees) * VRp = 0.6881909602355867905f
+ (VRp is the pentagon's vertex radio).
+ Face Radius For Dodecahedron
+ FRd = T^2 * (float)Math.sqrt((T+2)/5) / 2 = 1.1135163644116068404f
+Why we need ERp? Well, ERp and FRd segments forms a 90 degrees angle,
+completing this triangle, the lesser angle is a half of the angle we are
+looking for, so this angle is:
+ +-----------------------------------------------------------+
+ | 2*ARCTAN(ERp/FRd) = 63.434948822922009981f degrees |
+ +-----------------------------------------------------------+
+For the icosahedron we can use the same method used for dodecahedron (well
+the method used for dodecahedron may be used for all regular polyhedra)
+ Edge Radius For Triangle (this one is well known: 1/3 of the triangle height)
+ ERt = (float)Math.sin(60)/3 = (float)Math.sqrt(3)/6 = 0.2886751345948128655f
+ Face Radius For Icosahedron
+ FRi= (3*(float)Math.sqrt(3)+(float)Math.sqrt(15))/12 = 0.7557613140761707538f
+So the angle is:
+ +-----------------------------------------------------------+
+ | 2*ARCTAN(ERt/FRi) = 41.810314895778596167f degrees |
+ +-----------------------------------------------------------+
+
+*/
+
+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;
+import gl4java.awt.GLAnimCanvas;
+import gl4java.applet.SimpleGLAnimApplet1;
+import gl4java.utils.textures.*;
+
+public class morph3d extends SimpleGLAnimApplet1
+{
+ static final float Scale =0.3f;
+ static final float tetraangle = 109.47122063449069174f;
+ static final float cubeangle = 90.000000000000000000f;
+ static final float octaangle = 109.47122063449069174f;
+ static final float dodecaangle = 63.434948822922009981f;
+ static final float icoangle = 41.810314895778596167f;
+
+ static final float Pi = 3.1415926535897932385f;
+ static final float SQRT2 = 1.4142135623730951455f;
+ static final float SQRT3 = 1.7320508075688771932f;
+ static final float SQRT5 = 2.2360679774997898051f;
+ static final float SQRT6 = 2.4494897427831778813f;
+ static final float SQRT15 = 3.8729833462074170214f;
+ static final float cossec36_2 = 0.8506508083520399322f;
+ static final float cos72 = 0.3090169943749474241f;
+ static final float sin72 = 0.9510565162951535721f;
+ static final float cos36 = 0.8090169943749474241f;
+ static final float sin36 = 0.5877852522924731292f;
+
+ static final float TAU = (SQRT5+1f)/2.0f;
+
+
+ /* Initialize the applet */
+
+ boolean isAnApplet = true;
+
+ public void init()
+ {
+ super.init();
+ Dimension d = getSize();
+ canvas = new morph3dCanvas(d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("morph3d");
+
+ GLContext.gljNativeDebug = true;
+ GLContext.gljClassDebug = true;
+
+ morph3d applet = new morph3d();
+
+ applet.isAnApplet = false;
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+ /* Local GLCanvas extension class */
+
+
+ private class morph3dCanvas extends GLAnimCanvas
+ implements MouseListener, ActionListener
+ {
+ private PopupMenu menu = null;
+ private boolean menu_showing = false;
+ private boolean save_suspended = false;
+ private final String MENUE_0 = "Tetrahedron";
+ private final String MENUE_1 = "Hexahedron (Cube)";
+ private final String MENUE_2 = "Octahedron";
+ private final String MENUE_3 = "Dodecahedron";
+ private final String MENUE_4 = "Icosahedron";
+ private final String MENUE_5 = "Toggle colored faces";
+ private final String MENUE_6 = "Toggle smooth/flat shading";
+ private final String MENU_SNAPSHOT = "Snapshot";
+
+ TGATextureGrabber textgrab = null;
+
+ boolean doSnapshot=false;
+
+ /* Increasing this values produces better image quality,
+ the price is speed. */
+ /* Very low values produces erroneous/incorrect plotting */
+ int tetradivisions = 23;
+ int cubedivisions = 20;
+ int octadivisions = 21;
+ int dodecadivisions = 10;
+ int icodivisions = 15;
+
+ boolean mono=false;
+ boolean smooth=true;
+ int WindH, WindW;
+ float step=0;
+ float seno;
+ int object;
+ int edgedivisions;
+ float Magnitude;
+ // float *MaterialColor[20];
+ float MaterialColor[][];
+
+ float front_shininess[] = {60.0f};
+ float front_specular[] = { 0.7f, 0.7f, 0.7f, 1.0f };
+ float ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+ float diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ float position0[] = { 1.0f, 1.0f, 1.0f, 0.0f };
+ float position1[] = {-1.0f,-1.0f, 1.0f, 0.0f };
+ float lmodel_ambient[] = { 0.5f, 0.5f, 0.5f, 1.0f };
+ float lmodel_twoside[] = {1.0f};
+
+ float MaterialRed[] = { 0.7f, 0.0f, 0.0f, 1.0f };
+ float MaterialGreen[] = { 0.1f, 0.5f, 0.2f, 1.0f };
+ float MaterialBlue[] = { 0.0f, 0.0f, 0.7f, 1.0f };
+ float MaterialCyan[] = { 0.2f, 0.5f, 0.7f, 1.0f };
+ float MaterialYellow[] = { 0.7f, 0.7f, 0.0f, 1.0f };
+ float MaterialMagenta[] = { 0.6f, 0.2f, 0.5f, 1.0f };
+ float MaterialWhite[] = { 0.7f, 0.7f, 0.7f, 1.0f };
+ float MaterialGray[] = { 0.2f, 0.2f, 0.2f, 1.0f };
+
+ public morph3dCanvas(int w, int h)
+ {
+ super(w, h);
+ setAnimateFps(30.0);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ rgba = true;
+ }
+
+
+ final float VectMulX(float Y1,float Z1,float Y2,float Z2)
+ { return (Y1)*(Z2)-(Z1)*(Y2);
+ }
+
+ final float VectMulY(float X1,float Z1,float X2,float Z2)
+ { return (Z1)*(X2)-(X1)*(Z2);
+ }
+
+ final float VectMulZ(float X1,float Y1,float X2,float Y2)
+ { return (X1)*(Y2)-(Y1)*(X2);
+ }
+
+ final float sqr(float A)
+ { return (A)*(A); }
+
+ final void TRIANGLE(float Edge, float Amp, int Divisions, float Z)
+ {
+ float Xf,Yf,Xa,Yb,Xf2,Yf2;
+ float Factor,Factor1,Factor2;
+ float VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ;
+ float Ax,Ay,Bx;
+ int Ri,Ti;
+ float Vr=(Edge)*SQRT3/3;
+ float AmpVr2=(Amp)/sqr(Vr);
+ float Zf=(Edge)*(Z);
+
+ Ax=(Edge)*(+0.5f/(Divisions)); Ay=(Edge)*(-SQRT3/(2*Divisions));
+ Bx=(Edge)*(-0.5f/(Divisions));
+ for (Ri=1; Ri<=(Divisions); Ri++) {
+ gl.glBegin(GL_TRIANGLE_STRIP);
+ for (Ti=0; Ti<Ri; Ti++) {
+ Xf=(float)(Ri-Ti)*Ax + (float)Ti*Bx;
+ Yf=Vr+(float)(Ri-Ti)*Ay + (float)Ti*Ay;
+ Xa=Xf+0.001f; Yb=Yf+0.001f;
+ Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2);
+ Factor1=1-((sqr(Xa)+Yf2)*AmpVr2);
+ Factor2=1-((Xf2+sqr(Yb))*AmpVr2);
+ VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf;
+ NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ;
+ NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ;
+ gl.glNormal3f(VectMulX(NeiAY, NeiAZ, NeiBY, NeiBZ),
+ VectMulY(NeiAX, NeiAZ, NeiBX, NeiBZ),
+ VectMulZ(NeiAX, NeiAY, NeiBX, NeiBY));
+ gl.glVertex3f(VertX, VertY, VertZ);
+
+ Xf=(float)(Ri-Ti-1)*Ax + (float)Ti*Bx;
+ Yf=Vr+(float)(Ri-Ti-1)*Ay + (float)Ti*Ay;
+ Xa=Xf+0.001f; Yb=Yf+0.001f;
+ Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2);
+ Factor1=1-((sqr(Xa)+Yf2)*AmpVr2);
+ Factor2=1-((Xf2+sqr(Yb))*AmpVr2);
+ VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf;
+ NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ;
+ NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ;
+ gl.glNormal3f(VectMulX(NeiAY, NeiAZ, NeiBY, NeiBZ),
+ VectMulY(NeiAX, NeiAZ, NeiBX, NeiBZ),
+ VectMulZ(NeiAX, NeiAY, NeiBX, NeiBY));
+ gl.glVertex3f(VertX, VertY, VertZ);
+
+ }
+ Xf=(float)Ri*Bx;
+ Yf=Vr+(float)Ri*Ay;
+ Xa=Xf+0.001f; Yb=Yf+0.001f;
+ Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2);
+ Factor1=1-((sqr(Xa)+Yf2)*AmpVr2);
+ Factor2=1-((Xf2+sqr(Yb))*AmpVr2);
+ VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf;
+ NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ;
+ NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ;
+ gl.glNormal3f(VectMulX(NeiAY, NeiAZ, NeiBY, NeiBZ),
+ VectMulY(NeiAX, NeiAZ, NeiBX, NeiBZ),
+ VectMulZ(NeiAX, NeiAY, NeiBX, NeiBY));
+ gl.glVertex3f(VertX, VertY, VertZ);
+ gl.glEnd();
+ }
+ }
+
+ final void SQUARE(float Edge, float Amp, int Divisions, float Z)
+ {
+ int Xi,Yi;
+ float Xf,Yf,Y,Xf2,Yf2,Y2,Xa,Yb;
+ float Factor,Factor1,Factor2;
+ float VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ;
+ float Zf=(Edge)*(Z);
+ float AmpVr2=(Amp)/sqr((Edge)*SQRT2/2);
+
+ for (Yi=0; Yi<(Divisions); Yi++) {
+ Yf=-((Edge)/2.0f) + ((float)Yi)/(Divisions)*(Edge);
+ Yf2=sqr(Yf);
+ Y=Yf+1.0f/(Divisions)*(Edge);
+ Y2=sqr(Y);
+ gl.glBegin(GL_QUAD_STRIP);
+ for (Xi=0; Xi<=(Divisions); Xi++) {
+ Xf=-((Edge)/2.0f) + ((float)Xi)/(Divisions)*(Edge);
+ Xf2=sqr(Xf);
+
+ Xa=Xf+0.001f; Yb=Y+0.001f;
+ Factor=1-((Xf2+Y2)*AmpVr2);
+ Factor1=1-((sqr(Xa)+Y2)*AmpVr2);
+ Factor2=1-((Xf2+sqr(Yb))*AmpVr2);
+ VertX=Factor*Xf; VertY=Factor*Y; VertZ=Factor*Zf;
+ NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Y-VertY; NeiAZ=Factor1*Zf-VertZ;
+ NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ;
+ gl.glNormal3f(VectMulX(NeiAY, NeiAZ, NeiBY, NeiBZ),
+ VectMulY(NeiAX, NeiAZ, NeiBX, NeiBZ),
+ VectMulZ(NeiAX, NeiAY, NeiBX, NeiBY));
+ gl.glVertex3f(VertX, VertY, VertZ);
+
+ Xa=Xf+0.001f; Yb=Yf+0.001f;
+ Factor=1-((Xf2+Yf2)*AmpVr2);
+ Factor1=1-((sqr(Xa)+Yf2)*AmpVr2);
+ Factor2=1-((Xf2+sqr(Yb))*AmpVr2);
+ VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf;
+ NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ;
+ NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ;
+ gl.glNormal3f(VectMulX(NeiAY, NeiAZ, NeiBY, NeiBZ),
+ VectMulY(NeiAX, NeiAZ, NeiBX, NeiBZ),
+ VectMulZ(NeiAX, NeiAY, NeiBX, NeiBY));
+ gl.glVertex3f(VertX, VertY, VertZ);
+ }
+ gl.glEnd();
+ }
+ }
+
+ final void PENTAGON(float Edge, float Amp, int Divisions, float Z)
+ {
+ int Ri,Ti,Fi;
+ float Xf,Yf,Xa,Yb,Xf2,Yf2;
+ float x[]=new float[6],y[]=new float[6];
+ float Factor,Factor1,Factor2;
+ float VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ;
+ float Zf=(Edge)*(Z);
+ float AmpVr2=(Amp)/sqr((Edge)*cossec36_2);
+
+ for(Fi=0;Fi<6;Fi++) {
+ x[Fi]=-(float)Math.cos( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge);
+ y[Fi]=(float)Math.sin( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge);
+ }
+
+ for (Ri=1; Ri<=(Divisions); Ri++) {
+ for (Fi=0; Fi<5; Fi++) {
+ gl.glBegin(GL_TRIANGLE_STRIP);
+ for (Ti=0; Ti<Ri; Ti++) {
+ Xf=(float)(Ri-Ti)*x[Fi] + (float)Ti*x[Fi+1];
+ Yf=(float)(Ri-Ti)*y[Fi] + (float)Ti*y[Fi+1];
+ Xa=Xf+0.001f; Yb=Yf+0.001f;
+ Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2);
+ Factor1=1-((sqr(Xa)+Yf2)*AmpVr2);
+ Factor2=1-((Xf2+sqr(Yb))*AmpVr2);
+ VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf;
+ NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ;
+ NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ;
+ gl.glNormal3f(VectMulX(NeiAY, NeiAZ, NeiBY, NeiBZ),
+ VectMulY(NeiAX, NeiAZ, NeiBX, NeiBZ),
+ VectMulZ(NeiAX, NeiAY, NeiBX, NeiBY));
+ gl.glVertex3f(VertX, VertY, VertZ);
+
+ Xf=(float)(Ri-Ti-1)*x[Fi] + (float)Ti*x[Fi+1];
+ Yf=(float)(Ri-Ti-1)*y[Fi] + (float)Ti*y[Fi+1];
+ Xa=Xf+0.001f; Yb=Yf+0.001f;
+ Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2);
+ Factor1=1-((sqr(Xa)+Yf2)*AmpVr2);
+ Factor2=1-((Xf2+sqr(Yb))*AmpVr2);
+ VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf;
+ NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ;
+ NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ;
+ gl.glNormal3f(VectMulX(NeiAY, NeiAZ, NeiBY, NeiBZ),
+ VectMulY(NeiAX, NeiAZ, NeiBX, NeiBZ),
+ VectMulZ(NeiAX, NeiAY, NeiBX, NeiBY));
+ gl.glVertex3f(VertX, VertY, VertZ);
+
+ }
+ Xf=(float)Ri*x[Fi+1];
+ Yf=(float)Ri*y[Fi+1];
+ Xa=Xf+0.001f; Yb=Yf+0.001f;
+ Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2);
+ Factor1=1-((sqr(Xa)+Yf2)*AmpVr2);
+ Factor2=1-((Xf2+sqr(Yb))*AmpVr2);
+ VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf;
+ NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ;
+ NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ;
+ gl.glNormal3f(VectMulX(NeiAY, NeiAZ, NeiBY, NeiBZ),
+ VectMulY(NeiAX, NeiAZ, NeiBX, NeiBZ),
+ VectMulZ(NeiAX, NeiAY, NeiBX, NeiBY));
+ gl.glVertex3f(VertX, VertY, VertZ);
+ gl.glEnd();
+ }
+ }
+ }
+
+ void draw_tetra( )
+ {
+ int list;
+
+ list = gl.glGenLists( 1 );
+ gl.glNewList( list, GL_COMPILE );
+ TRIANGLE(2,seno,edgedivisions,0.5f/SQRT6);
+ gl.glEndList();
+
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-tetraangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+tetraangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+tetraangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
+ gl.glCallList(list);
+
+ gl.glDeleteLists(list,1);
+ }
+
+ void draw_cube()
+ {
+ int list;
+
+ list = gl.glGenLists( 1 );
+ gl.glNewList( list, GL_COMPILE );
+ SQUARE(2.0f, seno, edgedivisions, 0.5f);
+ gl.glEndList();
+
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
+ gl.glCallList(list);
+ gl.glRotatef(cubeangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
+ gl.glCallList(list);
+ gl.glRotatef(cubeangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
+ gl.glCallList(list);
+ gl.glRotatef(cubeangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
+ gl.glCallList(list);
+ gl.glRotatef(cubeangle,0,1,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
+ gl.glCallList(list);
+ gl.glRotatef(2*cubeangle,0,1,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
+ gl.glCallList(list);
+
+ gl.glDeleteLists(list,1);
+ }
+
+ void draw_octa()
+ {
+ int list;
+
+ list = gl.glGenLists( 1 );
+ gl.glNewList( list, GL_COMPILE );
+ TRIANGLE(2,seno,edgedivisions,1/SQRT6);
+ gl.glEndList();
+
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-180+octaangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-octaangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-octaangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-180+octaangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-octaangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-octaangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
+ gl.glCallList(list);
+
+ gl.glDeleteLists(list,1);
+ }
+
+ void draw_dodeca()
+ {
+ int list;
+
+
+ list = gl.glGenLists( 1 );
+ gl.glNewList( list, GL_COMPILE );
+ PENTAGON(1,seno,edgedivisions,sqr(TAU) * (float)Math.sqrt((TAU+2)/5) / 2);
+ gl.glEndList();
+
+ gl.glPushMatrix();
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
+ gl.glCallList(list);
+ gl.glRotatef(180,0,0,1);
+ gl.glPushMatrix();
+ gl.glRotatef(-dodecaangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(-dodecaangle,cos72,sin72,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(-dodecaangle,cos72,-sin72,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(dodecaangle,cos36,-sin36,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(dodecaangle,cos36,sin36,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
+ gl.glCallList(list);
+ gl.glRotatef(180,0,0,1);
+ gl.glPushMatrix();
+ gl.glRotatef(-dodecaangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(-dodecaangle,cos72,sin72,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(-dodecaangle,cos72,-sin72,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(dodecaangle,cos36,-sin36,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(dodecaangle,cos36,sin36,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]);
+ gl.glCallList(list);
+
+ gl.glDeleteLists(list,1);
+ }
+
+ void draw_ico()
+ {
+ int list;
+
+ list = gl.glGenLists( 1 );
+ gl.glNewList( list, GL_COMPILE );
+ TRIANGLE(1.5f,seno,edgedivisions,(3*SQRT3+SQRT15)/12);
+ gl.glEndList();
+
+ gl.glPushMatrix();
+
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-icoangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-icoangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-icoangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-icoangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[12]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[13]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[14]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[15]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-icoangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[16]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[17]);
+ gl.glCallList(list);
+ gl.glPushMatrix();
+ gl.glRotatef(180,0,1,0);
+ gl.glRotatef(-180+icoangle,0.5f,-SQRT3/2,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[18]);
+ gl.glCallList(list);
+ gl.glPopMatrix();
+ gl.glRotatef(180,0,0,1);
+ gl.glRotatef(-icoangle,1,0,0);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[19]);
+ gl.glCallList(list);
+
+ gl.glDeleteLists(list,1);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ gl.glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+
+ gl.glPushMatrix();
+
+ gl.glTranslatef( 0.0f, 0.0f, -10.0f );
+ gl.glScalef( Scale*WindH/WindW, Scale, Scale );
+ gl.glTranslatef(2.5f*WindW/WindH*(float)Math.sin(step*1.11f),2.5f*(float)Math.cos(step*1.25f*1.11f),0);
+ gl.glRotatef(step*100,1,0,0);
+ gl.glRotatef(step*95,0,1,0);
+ gl.glRotatef(step*90,0,0,1);
+
+ seno=((float)Math.sin(step)+1.0f/3.0f)*(4.0f/5.0f)*Magnitude;
+
+ switch(object) {
+ case 1:
+ draw_tetra();
+ break;
+ case 2:
+ draw_cube();
+ break;
+ case 3:
+ draw_octa();
+ break;
+ case 4:
+ draw_dodeca();
+ break;
+ case 5:
+ draw_ico();
+ break;
+ }
+
+ gl.glPopMatrix();
+
+
+ if(!isAnApplet && doSnapshot)
+ {
+ doSnapshot=false;
+ textgrab.grabPixels(GL_BACK,
+ 0, 0, cvsGetWidth(), cvsGetHeight());
+ textgrab.write2File("morph3d.tga");
+ }
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+
+ step+=0.05f;
+ }
+
+ public void reshape(int width, int height)
+ {
+ WindW=width; WindH=height;
+ gl.glViewport(0, 0, WindW, WindH);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ gl.glFrustum( -1.0f, 1.0f, -1.0f, 1.0f, 5.0f, 15.0f );
+ gl.glMatrixMode(GL_MODELVIEW);
+ }
+
+ final void pinit()
+ {
+ switch(object) {
+ case 1:
+ MaterialColor[0]=MaterialRed;
+ MaterialColor[1]=MaterialGreen;
+ MaterialColor[2]=MaterialBlue;
+ MaterialColor[3]=MaterialWhite;
+ edgedivisions=tetradivisions;
+ Magnitude=2.5f;
+ break;
+ case 2:
+ MaterialColor[0]=MaterialRed;
+ MaterialColor[1]=MaterialGreen;
+ MaterialColor[2]=MaterialCyan;
+ MaterialColor[3]=MaterialMagenta;
+ MaterialColor[4]=MaterialYellow;
+ MaterialColor[5]=MaterialBlue;
+ edgedivisions=cubedivisions;
+ Magnitude=2.0f;
+ break;
+ case 3:
+ MaterialColor[0]=MaterialRed;
+ MaterialColor[1]=MaterialGreen;
+ MaterialColor[2]=MaterialBlue;
+ MaterialColor[3]=MaterialWhite;
+ MaterialColor[4]=MaterialCyan;
+ MaterialColor[5]=MaterialMagenta;
+ MaterialColor[6]=MaterialGray;
+ MaterialColor[7]=MaterialYellow;
+ edgedivisions=octadivisions;
+ Magnitude=2.5f;
+ break;
+ case 4:
+ MaterialColor[ 0]=MaterialRed;
+ MaterialColor[ 1]=MaterialGreen;
+ MaterialColor[ 2]=MaterialCyan;
+ MaterialColor[ 3]=MaterialBlue;
+ MaterialColor[ 4]=MaterialMagenta;
+ MaterialColor[ 5]=MaterialYellow;
+ MaterialColor[ 6]=MaterialGreen;
+ MaterialColor[ 7]=MaterialCyan;
+ MaterialColor[ 8]=MaterialRed;
+ MaterialColor[ 9]=MaterialMagenta;
+ MaterialColor[10]=MaterialBlue;
+ MaterialColor[11]=MaterialYellow;
+ edgedivisions=dodecadivisions;
+ Magnitude=2.0f;
+ break;
+ case 5:
+ MaterialColor[ 0]=MaterialRed;
+ MaterialColor[ 1]=MaterialGreen;
+ MaterialColor[ 2]=MaterialBlue;
+ MaterialColor[ 3]=MaterialCyan;
+ MaterialColor[ 4]=MaterialYellow;
+ MaterialColor[ 5]=MaterialMagenta;
+ MaterialColor[ 6]=MaterialRed;
+ MaterialColor[ 7]=MaterialGreen;
+ MaterialColor[ 8]=MaterialBlue;
+ MaterialColor[ 9]=MaterialWhite;
+ MaterialColor[10]=MaterialCyan;
+ MaterialColor[11]=MaterialYellow;
+ MaterialColor[12]=MaterialMagenta;
+ MaterialColor[13]=MaterialRed;
+ MaterialColor[14]=MaterialGreen;
+ MaterialColor[15]=MaterialBlue;
+ MaterialColor[16]=MaterialCyan;
+ MaterialColor[17]=MaterialYellow;
+ MaterialColor[18]=MaterialMagenta;
+ MaterialColor[19]=MaterialGray;
+ edgedivisions=icodivisions;
+ Magnitude=2.5f;
+ break;
+ }
+ if (mono) {
+ int loop;
+ for (loop=0; loop<20; loop++) MaterialColor[loop]=MaterialGray;
+ }
+ if (smooth) {
+ gl.glShadeModel( GL_SMOOTH );
+ } else {
+ gl.glShadeModel( GL_FLAT );
+ }
+
+ }
+
+ public void init()
+ {
+ textgrab = new TGATextureGrabber(gl);
+ reshape(getSize().width, getSize().height);
+
+ object=1;
+
+ MaterialColor = new float[20][];
+
+ gl.glClearDepth(1.0f);
+ gl.glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
+ gl.glColor3f( 1.0f, 1.0f, 1.0f );
+
+ gl.glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+ glj.gljSwap();
+
+ gl.glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, position0);
+ gl.glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
+ gl.glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
+ gl.glLightfv(GL_LIGHT1, GL_POSITION, position1);
+ gl.glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ gl.glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_LIGHT0);
+ gl.glEnable(GL_LIGHT1);
+ gl.glEnable(GL_DEPTH_TEST);
+ gl.glEnable(GL_NORMALIZE);
+
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_shininess);
+ gl.glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular);
+
+ gl.glHint(GL_FOG_HINT, GL_FASTEST);
+ gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
+ gl.glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
+
+ pinit();
+
+ menu = new PopupMenu("Options");
+ menu.add(MENUE_0);
+ menu.add(MENUE_1);
+ menu.add(MENUE_2);
+ menu.add(MENUE_3);
+ menu.add(MENUE_4);
+ menu.add(MENUE_5);
+ menu.add(MENUE_6);
+ if(!isAnApplet)
+ menu.add(MENU_SNAPSHOT);
+ menu.addActionListener(this);
+ add(menu);
+
+ addMouseListener(this);
+
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ if (!menu_showing)
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ menu_showing = true;
+ save_suspended = isSuspended();
+ if (!save_suspended)
+ {
+ setSuspended(true);
+ repaint(100);
+ try
+ {
+ Thread.currentThread().sleep(200);
+ }
+ catch (Exception e)
+ { }
+ }
+ menu.show(this,evt.getX(),evt.getY());
+ }
+ else
+ {
+ // Must be left button.
+ if (isSuspended()) repaint();
+ }
+ }
+ else
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ // Method required for the implementation of ActionListener
+ public void actionPerformed(ActionEvent evt)
+ {
+ String c = evt.getActionCommand();
+ if (c.equals(MENUE_0))
+ {
+ object=1;
+ }
+ else if (c.equals(MENUE_1))
+ {
+ object=2;
+ }
+ else if (c.equals(MENUE_2))
+ {
+ object=3;
+ }
+ else if (c.equals(MENUE_3))
+ {
+ object=4;
+ }
+ else if (c.equals(MENUE_4))
+ {
+ object=5;
+ }
+ else if (c.equals(MENUE_5))
+ {
+ mono=!mono;
+ }
+ else if (c.equals(MENUE_6))
+ {
+ smooth=!smooth;
+ }
+ else if (c.equals(MENU_SNAPSHOT))
+ {
+ doSnapshot=true;
+ }
+ if (menu_showing)
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ pinit();
+ }
+ }
+}
+
diff --git a/demos/MiscDemos/morph3d_plugin13.html b/demos/MiscDemos/morph3d_plugin13.html
new file mode 100644
index 0000000..1472b89
--- /dev/null
+++ b/demos/MiscDemos/morph3d_plugin13.html
@@ -0,0 +1,48 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "morph3d.class" WIDTH = 400 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "morph3d.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "morph3d.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "morph3d.class" WIDTH = 400 HEIGHT = 400>
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/nurbs.html b/demos/MiscDemos/nurbs.html
new file mode 100644
index 0000000..6f0f2fe
--- /dev/null
+++ b/demos/MiscDemos/nurbs.html
@@ -0,0 +1,14 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<applet code="nurbs.class" width=500 height=300>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/nurbs.java b/demos/MiscDemos/nurbs.java
new file mode 100644
index 0000000..52ecd99
--- /dev/null
+++ b/demos/MiscDemos/nurbs.java
@@ -0,0 +1,314 @@
+/**
+ * @(#) DrawColoredPrimitives2.java
+ * @(#) author: Joe Zimmerman (converted to Java by Sven Goethel)
+ */
+
+/* This program is free software under the license of LGPL */
+
+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.GLAnimCanvas;
+import gl4java.applet.SimpleGLAnimApplet1;
+
+public class nurbs extends SimpleGLAnimApplet1
+{
+ public void init()
+ {
+ super.init();
+ Dimension d = getSize();
+ canvas = new gldemo(d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("nurbs");
+
+ nurbs applet = new nurbs();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+
+ private class gldemo extends GLAnimCanvas
+ implements MouseListener, ActionListener
+ {
+ private PopupMenu menu = null;
+ private boolean menu_showing = false;
+ private boolean save_suspended = false;
+ private final String VIEW_ROTATION = "Toggle Rotation";
+ private final String VIEW_FRONT = "View Front";
+ private final String VIEW_TOP = "View Top";
+ private final String VIEW_BOTTOM = "View Bottom";
+
+ final float M_PI = 3.14159265f;
+ final float M_PI_2 = 1.57079632f;
+ float rotate=0;
+ float rotationStep = 1;
+ boolean rotationOn = true;
+ int view = 0; /* 0 = front, 1 = top, 2 = bottom */
+
+ static final int S_NUMPOINTS = 13;
+ static final int S_ORDER = 3;
+ static final int S_NUMKNOTS = (S_NUMPOINTS + S_ORDER);
+ static final int T_NUMPOINTS = 3;
+ static final int T_ORDER = 3;
+ static final int T_NUMKNOTS = (T_NUMPOINTS + T_ORDER);
+ static final float SQRT2 = 1.41421356237309504880f;
+
+ /* initialized local data */
+
+ float sknots[/*S_NUMKNOTS*/] =
+ {-1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 9.0f, 9.0f};
+ float tknots[/*T_NUMKNOTS*/] = {1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f};
+
+ // float ctlpoints[/*S_NUMPOINTS*/][/*T_NUMPOINTS*/][/*4*/] = {
+ float ctlpoints[] = {
+ 4f,2f,2f,1f, 4f,1.6f,2.5f,1f , 4f,2f,3.0f,1f ,
+ 5f,4f,2f,1f , 5f,4f,2.5f,1f , 5f,4f,3.0f,1f ,
+ 6f,5f,2f,1f , 6f,5f,2.5f,1f , 6f,5f,3.0f,1f ,
+ SQRT2*6f,SQRT2*6f,SQRT2*2f,SQRT2 ,
+ SQRT2*6f,SQRT2*6f,SQRT2*2.5f,SQRT2 ,
+ SQRT2*6f,SQRT2*6f,SQRT2*3.0f,SQRT2 ,
+ 5.2f,6.7f,2f,1f , 5.2f,6.7f,2.5f,1f , 5.2f,6.7f,3.0f,1f ,
+ SQRT2*4f,SQRT2*6f,SQRT2*2f,SQRT2 ,
+ SQRT2*4f,SQRT2*6f,SQRT2*2.5f,SQRT2 ,
+ SQRT2*4f,SQRT2*6f,SQRT2*3.0f,SQRT2 ,
+ 4f,5.2f,2f,1f , 4f,4.6f,2.5f,1f , 4f,5.2f,3.0f,1f ,
+ SQRT2*4f,SQRT2*6f,SQRT2*2f,SQRT2 ,
+ SQRT2*4f,SQRT2*6f,SQRT2*2.5f,SQRT2 ,
+ SQRT2*4f,SQRT2*6f,SQRT2*3.0f,SQRT2 ,
+ 2.8f,6.7f,2f,1f , 2.8f,6.7f,2.5f,1f , 2.8f,6.7f,3.0f,1f ,
+ SQRT2*2f,SQRT2*6f,SQRT2*2f,SQRT2 ,
+ SQRT2*2f,SQRT2*6f,SQRT2*2.5f,SQRT2 ,
+ SQRT2*2f,SQRT2*6f,SQRT2*3.0f,SQRT2 ,
+ 2f,5f,2f,1f , 2f,5f,2.5f,1f , 2f,5f,3.0f,1f ,
+ 3f,4f,2f,1f , 3f,4f,2.5f,1f , 3f,4f,3.0f,1f ,
+ 4f,2f,2f,1f , 4f,1.6f,2.5f,1f , 4f,2f,3.0f,1f
+ };
+
+
+ int theNurb;
+
+ public gldemo(int w, int h)
+ {
+ super(w, h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ setAnimateFps(30.0);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+ public void init()
+ {
+ reshape(getSize().width, getSize().height);
+
+ float mat_ambient[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ float mat_diffuse[] = { 1.0f, 0.2f, 1.0f, 1.0f };
+ float mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ float mat_shininess[] = { 50.0f };
+
+ float light0_position[] = { 1.0f, 0.1f, 1.0f, 0.0f };
+ float light1_position[] = { -1.0f, 0.1f, 1.0f, 0.0f };
+
+ float lmodel_ambient[] = { 0.3f, 0.3f, 0.3f, 1.0f };
+
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
+ gl.glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
+ gl.glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
+ gl.glLightfv(GL_LIGHT1, GL_POSITION, light1_position);
+ gl.glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_LIGHT0);
+ gl.glEnable(GL_LIGHT1);
+ gl.glDepthFunc(GL_LESS);
+ gl.glEnable(GL_DEPTH_TEST);
+ gl.glEnable(GL_AUTO_NORMAL);
+
+ theNurb = glu.gluNewNurbsRenderer();
+
+ glu.gluNurbsProperty(theNurb, GLU_SAMPLING_TOLERANCE, 25.0f);
+ glu.gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL);
+ glj.gljCheckGL();
+
+ menu = new PopupMenu("Options");
+ menu.add(VIEW_ROTATION);
+ menu.add(VIEW_FRONT);
+ menu.add(VIEW_TOP);
+ menu.add(VIEW_BOTTOM);
+ menu.addActionListener(this);
+ add(menu);
+
+ addMouseListener(this);
+ }
+
+ public void doCleanup()
+ {
+ removeMouseListener(this);
+ menu.removeActionListener(this);
+ }
+
+ public void reshape(int width, int height)
+ {
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPerspective(90, (float)width/(float)height, 1, 700);
+
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glViewport(0,0,width,height);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+
+ gl.glTranslatef(0, 0, -7.5f);
+
+ gl.glPushMatrix();
+
+ gl.glTranslatef(-5f, -4.5f, -2.5f);
+
+ if(view==1)
+ {
+ gl.glRotatef(90f, 1, 0, 0);
+ } else if(view==2)
+ {
+ gl.glRotatef(-90f, 1, 0, 0);
+ }
+
+ if(rotationOn)
+ {
+ rotate+=rotationStep;
+ if(rotate>=180.0f || rotate<=0.0f)
+ rotationStep*=-1.0f;
+
+ gl.glRotatef(rotate, 0, 1, 0);
+ } else rotate=0;
+
+ glu.gluBeginSurface(theNurb);
+ glu.gluNurbsSurface(theNurb,
+ S_NUMKNOTS, sknots,
+ T_NUMKNOTS, tknots,
+ 4 * T_NUMPOINTS,
+ 4,
+ ctlpoints,
+ S_ORDER, T_ORDER,
+ GL_MAP2_VERTEX_4);
+ glu.gluEndSurface(theNurb);
+
+ gl.glPopMatrix();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ if (!menu_showing)
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ menu_showing = true;
+ save_suspended = isSuspended();
+ if (!save_suspended)
+ {
+ setSuspended(true);
+ repaint(100);
+ try
+ {
+ Thread.currentThread().sleep(200);
+ }
+ catch (Exception e)
+ { }
+ }
+ menu.show(this,evt.getX(),evt.getY());
+ }
+ else
+ {
+ // Must be left button.
+ if (isSuspended()) repaint();
+ }
+ }
+ else
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ // Method required for the implementation of ActionListener
+ public void actionPerformed(ActionEvent evt)
+ {
+ String c = evt.getActionCommand();
+ if (c.equals(VIEW_ROTATION))
+ {
+ rotationOn=!rotationOn;
+ }
+ else if (c.equals(VIEW_FRONT))
+ {
+ view=0;
+ }
+ else if (c.equals(VIEW_TOP))
+ {
+ view=1;
+ }
+ else if (c.equals(VIEW_BOTTOM))
+ {
+ view=2;
+ }
+ if (menu_showing)
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+
+
+ }
+}
diff --git a/demos/MiscDemos/nurbs_plugin13.html b/demos/MiscDemos/nurbs_plugin13.html
new file mode 100644
index 0000000..ac13d9e
--- /dev/null
+++ b/demos/MiscDemos/nurbs_plugin13.html
@@ -0,0 +1,46 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "nurbs.class" WIDTH = 500 HEIGHT = 300 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "nurbs.class" WIDTH = 500 HEIGHT = 300></XMP>
+<PARAM NAME = CODE VALUE = "nurbs.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "nurbs.class" WIDTH = 500 HEIGHT = 300>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/pngTextureTestApplet.html b/demos/MiscDemos/pngTextureTestApplet.html
new file mode 100644
index 0000000..4887df3
--- /dev/null
+++ b/demos/MiscDemos/pngTextureTestApplet.html
@@ -0,0 +1,16 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<B>Try to drag the mouse (press-button and move) with/without the SHIFT key!</B>
+<br>
+<hr>
+<applet code="pngTextureTestApplet.class" width=600 height=400>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/pngTextureTestApplet.java b/demos/MiscDemos/pngTextureTestApplet.java
new file mode 100755
index 0000000..99ea0bb
--- /dev/null
+++ b/demos/MiscDemos/pngTextureTestApplet.java
@@ -0,0 +1,420 @@
+///////////////////////////////////////////////////
+// pngTextureTest in opgl
+///////////////////////////////////////////////////
+// progMaxRheiner
+///////////////////////////////////////////////////
+// 5.12.1999
+///////////////////////////////////////////////////
+
+import gl4java.*;
+import gl4java.awt.*;
+import gl4java.utils.textures.*;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.*;
+import java.net.*;
+
+public class pngTextureTestApplet extends Applet
+{
+ pngTextureTest canvas = null;
+ boolean isAnApplet = true;
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ if(isAnApplet)
+ canvas = new pngTextureTest (d.width, d.height, getCodeBase());
+ else
+ canvas = new pngTextureTest (d.width, d.height, null);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] ) {
+ pngTextureTestApplet applet =
+ new pngTextureTestApplet();
+
+ Frame f = new Frame("pngTextureTestApplet");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
+ applet.isAnApplet = false;
+ applet.init();
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ class pngTextureTest extends GLCanvas
+ implements MouseListener,MouseMotionListener
+ {
+ float []mPosObjTrans;
+ float []mPosObjRot;
+
+ Point mousePoint;
+ Point oldMousePoint;
+ boolean mouseMoveFlag;
+
+
+ int texName[] = {0};
+ URL base;
+
+ public pngTextureTest (int w, int h, URL base)
+ {
+ super(w, h);
+ this.base=base;
+ }
+
+ public void preInit()
+ {
+ createOwnWindow = true;
+ }
+
+ public void init()
+ {
+ // texture laden
+ PngTextureLoader txtLoader1 = new PngTextureLoader(gl, glu);
+ if(base!=null)
+ txtLoader1.readTexture(base, "tex/DAISYX.png");
+ else {
+ try {
+ txtLoader1.readTexture("tex/DAISYX.png");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ byte[] pixels1 = txtLoader1.getTexture();
+
+ if(txtLoader1.isOk())
+ {
+ gl.glEnable(GL_TEXTURE_2D);
+
+ // JAU: let's show us the scaled,
+ // and the tricky one using glTexSubImage2D
+ gl.glGenTextures(1,texName);
+ gl.glBindTexture(GL_TEXTURE_2D,texName[0]);
+
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+ gl.glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+
+ txtLoader1.texImage2DNonScaled(true);
+ // The Scaled Way
+ // txtLoader1.texImage2DScaled2Pow2();
+
+ gl.glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ System.out.println("texture succesfully loaded !");
+ System.out.println("texture: "+txtLoader1);
+ }
+ // cameraMatrix init
+ mPosObjTrans=new float[16];
+ for(int i=0;i<16;i++)
+ mPosObjTrans[i]=0f;
+ mPosObjTrans[0]=mPosObjTrans[5]=mPosObjTrans[10]=mPosObjTrans[15]=1f;
+
+ mPosObjRot=new float[16];
+ for(int i=0;i<16;i++)
+ mPosObjRot[i]=0f;
+ mPosObjRot[0]=mPosObjRot[5]=mPosObjRot[10]=mPosObjRot[15]=1f;
+
+ TranlateObj(0f,0f,-10f);
+
+ gl.glShadeModel (GL_SMOOTH);
+ gl.glEnable(GL_DEPTH_TEST);
+
+ gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
+ gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glj.gljCheckGL();
+
+ canvas.addMouseListener(this);
+ canvas.addMouseMotionListener(this);
+ mouseMoveFlag=false;
+
+ reshape(getSize().width, getSize().height);
+ }
+
+ public void display()
+ {
+ int i;
+
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ // just render it
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ SetCamera();
+
+ DrawScene();
+
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glViewport (0, 0, w, h);
+ gl.glLoadIdentity();
+ SetCamera();
+ }
+
+
+ public void drawGrid(float x0, float y0,
+ float width, float height, float step)
+ {
+ float i,j;
+
+ /* draw grid */
+ gl.glBegin(GL_LINES);
+ for(i=x0;i<width;i+=step)
+ for(j=y0;j<height;j+=step)
+ {
+ if(i==0f && j==0f)
+ gl.glColor3f (1f,0f,0f);
+ else
+ gl.glColor3f (0.6f,0.5f,0.5f);
+ gl.glVertex2f(0f,j);
+ gl.glVertex2f(width,j);
+ gl.glVertex2f(i,height);
+ gl.glVertex2f(i,0f);
+ }
+ gl.glEnd();
+ }
+
+ void DrawScene()
+ {
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glLoadMatrixf(mPosObjTrans);
+ gl.glMultMatrixf(mPosObjRot);
+
+ gl.glPushMatrix();
+ gl.glDisable(GL_TEXTURE_2D);
+ drawGrid(0f, 0f, 10f, 10f, 0.5f);
+ gl.glPopMatrix();
+
+ // obj zeichnen
+
+ gl.glPushMatrix();
+ gl.glScalef(2f,2f,2f);
+ gl.glColor3f(1f,0f,0f);
+ gl.glDisable(GL_TEXTURE_2D);
+ DrawObj();
+ gl.glPopMatrix();
+
+ gl.glEnable(GL_BLEND);
+ gl.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+
+ if(texName[0]!=0)
+ gl.glEnable(GL_TEXTURE_2D);
+
+ gl.glColor3f(1f,1f,1f);
+
+ gl.glPushMatrix();
+ gl.glScalef(3f,3f,3f);
+ gl.glTranslatef(-1f,0f,1f);
+ DrawObj();
+ gl.glPopMatrix();
+
+ gl.glPushMatrix();
+ gl.glScalef(3f,3f,3f);
+ gl.glTranslatef(1f,0f,1f);
+ DrawObj();
+ gl.glPopMatrix();
+
+ gl.glPushMatrix();
+ gl.glScalef(3f,3f,3f);
+ gl.glTranslatef(-2f,1f,1f);
+ Billboard();
+ DrawObj();
+ gl.glPopMatrix();
+
+ gl.glDisable(GL_BLEND);
+ }
+
+ void DrawObj()
+ {
+ gl.glPushMatrix();
+ gl.glBegin(GL_QUADS);
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(0f,0f);
+ gl.glVertex3f(-.5f,-.5f,0f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(0f,1f);
+ gl.glVertex3f(.5f,-.5f,0f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(1f,1f);
+ gl.glVertex3f(.5f,.5f,0f);
+
+ gl.glNormal3f(0f,0f,1f);
+ gl.glTexCoord2f(1f,0f);
+ gl.glVertex3f(-.5f,.5f,0f);
+ gl.glEnd();
+ gl.glPopMatrix();
+ }
+
+ void SetCamera()
+ {
+ Dimension dim=getSize();
+ float aspect=(float)dim.width/(float)dim.height;
+
+ gl.glMatrixMode (GL_PROJECTION);
+ gl.glLoadIdentity ();
+ glu.gluPerspective(60f,aspect,.01,100);
+ }
+
+ void RotateObj(float degree,
+ float axisX,
+ float axisY,
+ float axisZ)
+ {
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glRotatef(degree,axisX,axisY,axisZ);
+ gl.glMultMatrixf(mPosObjRot);
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjRot);
+
+ repaint();
+ }
+
+ void TranlateObj(float x,float y,float z)
+ {
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glMatrixMode (GL_MODELVIEW);
+ gl.glLoadIdentity ();
+
+ // kamera setzen
+ gl.glLoadMatrixf(mPosObjTrans);
+ gl.glTranslatef(x,y,z);
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjTrans);
+
+ repaint();
+ }
+
+ // entfernt rotationen aus aktueller matrix
+ double Billboard()
+ {
+ float[] mat=new float[16];
+
+ gl.glGetFloatv(GL_MODELVIEW_MATRIX,mat);
+ mat[0] = mat[5] = mat[10] = 1;
+ mat[1] = mat[2] = mat[4] = mat[6] = mat[8] = mat[9] = 0;
+ gl.glLoadMatrixf(mat);
+
+ return mat[14];
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered( MouseEvent evt )
+ {
+ }
+
+ public void mouseExited( MouseEvent evt )
+ {
+ }
+
+ public void mousePressed( MouseEvent evt )
+ {
+ if(mouseMoveFlag==false)
+ { // start drag
+ mouseMoveFlag=true;
+ mousePoint=evt.getPoint();
+ }
+ }
+
+ public void mouseReleased( MouseEvent evt )
+ {
+ mouseMoveFlag=false;
+ }
+
+ public void mouseClicked( MouseEvent evt )
+ {
+ Component comp = evt.getComponent();
+ }
+
+ public void mouseDragged(MouseEvent e)
+ {
+ if(mouseMoveFlag==true)
+ {
+ oldMousePoint=new Point(mousePoint);
+ mousePoint=e.getPoint();
+
+ Point dif=new Point(mousePoint.x-oldMousePoint.x,
+ mousePoint.y-oldMousePoint.y);
+
+ if(e.isShiftDown()==true)
+ TranlateObj((float)dif.x/6.0f,(float)dif.y/-6.0f,0f);
+ else if(e.isAltDown()==true)
+ {
+ TranlateObj(0f,0f,(float)dif.y/6.0f);
+ RotateObj(dif.x,0f,0f,1f);
+ }
+ else
+ {
+ RotateObj(dif.x,0f,1f,0f);
+ RotateObj(dif.y,1f,0f,0f);
+ }
+ }
+ }
+ public void mouseMoved(MouseEvent e)
+ {
+ }
+
+
+ }
+}
diff --git a/demos/MiscDemos/pngTextureTestApplet_plugin13.html b/demos/MiscDemos/pngTextureTestApplet_plugin13.html
new file mode 100644
index 0000000..929700a
--- /dev/null
+++ b/demos/MiscDemos/pngTextureTestApplet_plugin13.html
@@ -0,0 +1,48 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<B>Try to drag the mouse (press-button and move) with/without the SHIFT key!</B>
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 600 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "pngTextureTestApplet.class" WIDTH = 600 HEIGHT = 400 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "pngTextureTestApplet.class" WIDTH = 600 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "pngTextureTestApplet.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "pngTextureTestApplet.class" WIDTH = 600 HEIGHT = 400>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/select.html b/demos/MiscDemos/select.html
new file mode 100644
index 0000000..14b27a6
--- /dev/null
+++ b/demos/MiscDemos/select.html
@@ -0,0 +1,17 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Left-Mouse Button to change the color! <br>
+Press the Middle-Mouse Button to zoom! <br>
+Press the Right-Mouse Button to delete! <br>
+<br>
+<hr>
+<applet code="select.class" width=500 height=300>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/select.java b/demos/MiscDemos/select.java
new file mode 100644
index 0000000..a1020c3
--- /dev/null
+++ b/demos/MiscDemos/select.java
@@ -0,0 +1,596 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any adverti(float)Math.sing or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+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;
+
+import gl4java.utils.glut.*;
+
+public class select extends Applet
+{
+ selectCanvas canvas = null;
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new selectCanvas(d.width, d.height);
+ add("Center", canvas);
+ }
+
+
+ /* Start the applet */
+
+
+ public void start()
+ {
+ }
+
+
+ /* Stop the applet */
+
+
+ public void stop()
+ {
+ }
+
+ public static void main( String args[] ) {
+ GLContext.gljNativeDebug = true;
+ GLContext.gljClassDebug = true;
+
+ select applet =
+ new select();
+
+ Frame f = new Frame("select");
+
+ f.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
+ f.setLayout(new BorderLayout());
+ f.add("Center", applet);
+ applet.setSize(500,300);
+ applet.init();
+ applet.start();
+ Dimension ps = applet.getPreferredSize();
+ f.setBounds(-100,-100,99,99);
+ f.setVisible(true);
+ f.setVisible(false);
+ Insets i = f.getInsets();
+ f.setBounds(0,0,
+ ps.width+i.left+i.right,
+ ps.height+i.top+i.bottom);
+ f.setVisible(true);
+ }
+
+ /* Local GLCanvas extension class */
+
+ static final int MAXOBJS =10000;
+ static final int MAXSELECT =100;
+ static final int MAXFEED =300;
+ static final int SOLID =1;
+ static final int LINE =2;
+ static final int POINT =3;
+
+ protected class object {
+ float v1[];
+ float v2[];
+ float v3[];
+ float color[];
+
+ public object()
+ {
+ v1=new float[2];
+ v2=new float[2];
+ v3=new float[2];
+ color=new float[3];
+ }
+ } /* objects[MAXOBJS] */
+
+
+ private class selectCanvas extends GLCanvas
+ implements MouseListener
+ {
+ int windW, windH;
+
+ object[] objects=null;
+ int selectBuf[/*MAXSELECT*/];
+ float feedBuf[/*MAXFEED*/];
+ int vp[/*4*/];
+ float zRotation = 90.0f;
+ float zoom = 1.0f;
+ int objectCount;
+ int numObjects;
+ boolean linePoly = false;
+
+ public selectCanvas(int w, int h)
+ {
+ super(w, h);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+
+ public void init()
+ {
+ int i;
+
+ windW = getSize().width;
+ windH = getSize().height;
+
+ objects = new object[MAXOBJS];
+ for(i=0; i<MAXOBJS; i++)
+ objects[i]=new object();
+
+ selectBuf=new int[MAXSELECT];
+ feedBuf=new float[MAXFEED];
+ vp=new int[4];
+
+ numObjects = 10;
+ InitObjects(numObjects);
+ gl.glGetIntegerv(GL_VIEWPORT, vp);
+
+ addMouseListener(this);
+ }
+
+ public void InitObjects(int num)
+ {
+ int i;
+ double x, y;
+
+ if (num > MAXOBJS) {
+ num = MAXOBJS;
+ }
+ if (num < 1) {
+ num = 1;
+ }
+ objectCount = num;
+
+ // srand((unsigned int)time(NULL));
+ for (i = 0; i < num; i++) {
+ /*
+ x = (rand() % 300) - 150;
+ y = (rand() % 300) - 150;
+ */
+ x = (Math.random() * 300.0) - 150.0;
+ y = (Math.random() * 300.0) - 150.0;
+
+ objects[i].v1[0] = (float) (x + (Math.random() * 50.0) - 25.0);
+ objects[i].v2[0] = (float) (x + (Math.random() * 50.0) - 25.0);
+ objects[i].v3[0] = (float) (x + (Math.random() * 50.0) - 25.0);
+ objects[i].v1[1] = (float) (y + (Math.random() * 50.0) - 25.0);
+ objects[i].v2[1] = (float) (y + (Math.random() * 50.0) - 25.0);
+ objects[i].v3[1] = (float) (y + (Math.random() * 50.0) - 25.0);
+ objects[i].color[0] = (float)
+ (((Math.random() * 100.0) + 50.0) / 150.0f);
+ objects[i].color[1] = (float)
+ (((Math.random() * 100.0) + 50.0) / 150.0f);
+ objects[i].color[2] = (float)
+ (((Math.random() * 100.0) + 50.0) / 150.0f);
+ }
+ }
+
+
+ public void reshape(int width, int height)
+ {
+
+ windW = (int)width;
+ windH = (int)height;
+ }
+
+ public void Render(int mode)
+ {
+ int i;
+
+ for (i = 0; i < objectCount; i++) {
+ if (mode == GL_SELECT) {
+ gl.glLoadName(i);
+ }
+ gl.glColor3fv(objects[i].color);
+ gl.glBegin(GL_POLYGON);
+ gl.glVertex2fv(objects[i].v1);
+ gl.glVertex2fv(objects[i].v2);
+ gl.glVertex2fv(objects[i].v3);
+ gl.glEnd();
+ }
+ }
+
+ public int DoSelect(int x, int y)
+ {
+ int hits;
+
+ gl.glSelectBuffer(MAXSELECT, selectBuf);
+ gl.glRenderMode(GL_SELECT);
+ gl.glInitNames();
+ gl.glPushName(~0);
+
+ gl.glPushMatrix();
+
+ gl.glViewport(0, 0, windW, windH);
+ gl.glGetIntegerv(GL_VIEWPORT, vp);
+
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPickMatrix(x, windH-y, 4, 4, vp);
+ glu.gluOrtho2D(-175, 175, -175, 175);
+ gl.glMatrixMode(GL_MODELVIEW);
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+
+ gl.glScalef(zoom, zoom, zoom);
+ gl.glRotatef(zRotation, 0, 0, 1);
+
+ Render(GL_SELECT);
+
+ gl.glPopMatrix();
+
+ hits = gl.glRenderMode(GL_RENDER);
+ if (hits <= 0) {
+ return -1;
+ }
+
+ return selectBuf[(hits-1)*4+3];
+ }
+
+ public void RecolorTri(int h)
+ {
+
+ objects[h].color[0] = (float)
+ (((Math.random() * 100.0) + 50.0) / 150.0);
+ objects[h].color[1] = (float)
+ (((Math.random() * 100.0) + 50.0) / 150.0);
+ objects[h].color[2] = (float)
+ (((Math.random() * 100.0) + 50.0) / 150.0);
+ }
+
+ public void DeleteTri(int h)
+ {
+
+ objects[h] = objects[objectCount-1];
+ objectCount--;
+ }
+
+ public void GrowTri(int h)
+ {
+ float v[/*2*/];
+ int i;
+
+ v = new float[2];
+
+ v[0] = objects[h].v1[0] + objects[h].v2[0] + objects[h].v3[0];
+ v[1] = objects[h].v1[1] + objects[h].v2[1] + objects[h].v3[1];
+ v[0] /= 3f;
+ v[1] /= 3f;
+
+ for (i = 0; i < 3; i++) {
+ switch (i) {
+ case 0:
+ objects[h].v1[0] = 1.5f * (objects[h].v1[0] - v[0]) + v[0];
+ objects[h].v1[1] = 1.5f * (objects[h].v1[1] - v[1]) + v[1];
+ break;
+ case 1:
+ objects[h].v2[0] = 1.5f * (objects[h].v2[0] - v[0]) + v[0];
+ objects[h].v2[1] = 1.5f * (objects[h].v2[1] - v[1]) + v[1];
+ break;
+ case 2:
+ objects[h].v3[0] = 1.5f * (objects[h].v3[0] - v[0]) + v[0];
+ objects[h].v3[1] = 1.5f * (objects[h].v3[1] - v[1]) + v[1];
+ break;
+ }
+ }
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ int x1 = evt.getX();
+ int y1 = evt.getY();
+
+ /* translate GLUT into GL coordinates */
+ // y1 = getSize().height -y1;
+
+ int hit;
+
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("mouseClicked: problem in GL-use() method");
+ return;
+ }
+
+ hit = DoSelect(x1, y1);
+
+ glj.gljCheckGL();
+ glj.gljFree();
+
+ if (hit != -1) {
+ if ((evt.getModifiers() & evt.BUTTON1_MASK) != 0) {
+ RecolorTri(hit);
+ }
+ if ((evt.getModifiers() & evt.BUTTON2_MASK) != 0) {
+ GrowTri(hit);
+ }
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0) {
+ DeleteTri(hit);
+ }
+ }
+
+ repaint();
+ }
+
+ public void display()
+ {
+
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glPushMatrix();
+
+ gl.glViewport(0, 0, windW, windH);
+ gl.glGetIntegerv(GL_VIEWPORT, vp);
+
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluOrtho2D(-175, 175, -175, 175);
+ gl.glMatrixMode(GL_MODELVIEW);
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+
+ gl.glScalef(zoom, zoom, zoom);
+ gl.glRotatef(zRotation, 0, 0, 1);
+
+ Render(GL_RENDER);
+
+ gl.glPopMatrix();
+
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void DrawZoom(int x, int y)
+ {
+
+ gl.glPushMatrix();
+
+ gl.glViewport(0, 0, windW, windH);
+ gl.glGetIntegerv(GL_VIEWPORT, vp);
+
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPickMatrix(x, windH-y, 4, 4, vp);
+ glu.gluOrtho2D(-175, 175, -175, 175);
+ gl.glMatrixMode(GL_MODELVIEW);
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+
+ gl.glScalef(zoom, zoom, zoom);
+ gl.glRotatef(zRotation, 0, 0, 1);
+
+ Render(GL_RENDER);
+
+ gl.glPopMatrix();
+ }
+
+ public int DumpFeedbackVert(int i, int n)
+ {
+ int index;
+
+ index = i;
+ if (index+7 > n) {
+ System.out.println(" ???");
+ return n;
+ }
+ System.out.println(" ("+feedBuf[index]+" "+
+ feedBuf[index+1]+" "+
+ feedBuf[index+2]+"), color = ("+
+ feedBuf[index+3]+" "+
+ feedBuf[index+4]+" "+
+ feedBuf[index+5]+")");
+ return index + 7;
+ }
+
+ public void DrawFeedback(int n)
+ {
+ int i;
+ int verts;
+
+ System.out.println("Feedback results ("+n+" floats):");
+ for (i = 0; i < n; i++) {
+ switch ((int)feedBuf[i]) {
+ case GL_POLYGON_TOKEN:
+ System.out.print("Polygon");
+ i++;
+ if (i < n) {
+ verts = (int)feedBuf[i];
+ i++;
+ System.out.print(": "+verts+" vertices");
+ } else {
+ verts = 0;
+ }
+ System.out.print("\n");
+ while (verts>0) {
+ i=DumpFeedbackVert(i, n);
+ verts--;
+ }
+ i--;
+ break;
+ case GL_LINE_TOKEN:
+ System.out.print("Line:");
+ i++;
+ i=DumpFeedbackVert(i, n);
+ i=DumpFeedbackVert(i, n);
+ i--;
+ break;
+ case GL_LINE_RESET_TOKEN:
+ System.out.print("Line Reset:\n");
+ i++;
+ i=DumpFeedbackVert(i, n);
+ i=DumpFeedbackVert(i, n);
+ i--;
+ break;
+ default:
+ System.out.print(feedBuf[i]+"\n");
+ break;
+ }
+ }
+ if (i == MAXFEED) {
+ System.out.print("...\n");
+ }
+ System.out.print("\n");
+ }
+
+ public void DoFeedback()
+ {
+ int x;
+
+ gl.glFeedbackBuffer(MAXFEED, GL_3D_COLOR, feedBuf);
+ gl.glRenderMode(GL_FEEDBACK);
+
+ gl.glPushMatrix();
+
+ gl.glViewport(0, 0, windW, windH);
+ gl.glGetIntegerv(GL_VIEWPORT, vp);
+
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluOrtho2D(-175, 175, -175, 175);
+ gl.glMatrixMode(GL_MODELVIEW);
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+
+ gl.glScalef(zoom, zoom, zoom);
+ gl.glRotatef(zRotation, 0, 0, 1);
+
+ Render(GL_FEEDBACK);
+
+ gl.glPopMatrix();
+
+ x = gl.glRenderMode(GL_RENDER);
+ if (x == -1) {
+ x = MAXFEED;
+ }
+
+ DrawFeedback((int)x);
+ }
+
+ /*
+ static void Key2(int key, int x, int y)
+ {
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ zRotation += 0.5f;
+ break;
+ case GLUT_KEY_RIGHT:
+ zRotation -= 0.5f;
+ break;
+ default:
+ return;
+ }
+
+ glut.glutPostRedisplay();
+ }
+
+ static void Key(unsigned char key, int x, int y)
+ {
+ switch (key) {
+ case 27:
+ exit(1);
+ case 'Z':
+ zoom /= 0.75f;
+ break;
+ case 'z':
+ zoom *= 0.75f;
+ break;
+ case 'f':
+ DoFeedback();
+ break;
+ case 'd':
+ DrawZoom(x, y);
+ break;
+ case 'l':
+ linePoly = !linePoly;
+ if (linePoly) {
+ gl.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ } else {
+ gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ }
+ break;
+ default:
+ return;
+ }
+
+ glut.glutPostRedisplay();
+ }
+ */
+
+ }
+}
diff --git a/demos/MiscDemos/select_plugin13.html b/demos/MiscDemos/select_plugin13.html
new file mode 100644
index 0000000..f4e0e54
--- /dev/null
+++ b/demos/MiscDemos/select_plugin13.html
@@ -0,0 +1,49 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Left-Mouse Button to change the color! <br>
+Press the Middle-Mouse Button to zoom! <br>
+Press the Right-Mouse Button to delete! <br>
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "select.class" WIDTH = 500 HEIGHT = 300 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "select.class" WIDTH = 500 HEIGHT = 300></XMP>
+<PARAM NAME = CODE VALUE = "select.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "select.class" WIDTH = 500 HEIGHT = 300>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/spectex.html b/demos/MiscDemos/spectex.html
new file mode 100644
index 0000000..4ceb658
--- /dev/null
+++ b/demos/MiscDemos/spectex.html
@@ -0,0 +1,14 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<applet code="spectex.class" width=400 height=400>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/spectex.java b/demos/MiscDemos/spectex.java
new file mode 100644
index 0000000..55d4aae
--- /dev/null
+++ b/demos/MiscDemos/spectex.java
@@ -0,0 +1,336 @@
+/**
+ * @(#) spectex.java
+ * @(#) author: Joe Zimmerman (converted to Java by Sven Goethel)
+ */
+
+/* This program is free software under the license of LGPL */
+
+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.GLAnimCanvas;
+import gl4java.applet.SimpleGLAnimApplet1;
+
+public class spectex extends SimpleGLAnimApplet1
+{
+
+ public void init()
+ {
+ super.init();
+ Dimension d = getSize();
+ canvas = new gldemo(d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("spectex");
+
+ spectex applet = new spectex();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+ private class gldemo extends GLAnimCanvas
+ implements MouseListener, ActionListener
+ {
+ private PopupMenu menu = null;
+ private boolean menu_showing = false;
+ private boolean save_suspended = false;
+ private final String MENUE_0 = "1-pass lighting + texturing";
+ private final String MENUE_1 = "specular lighting";
+ private final String MENUE_2 = "diffuse lighting + texturing";
+ private final String MENUE_3 = "2-pass lighting + texturing";
+ private final String MENUE_4 = "OpenGL 1.2f separate specular";
+
+ final float M_PI = 3.14159265f;
+ final float M_PI_2 = 1.57079632f;
+ int view = 0; /* 0 = front, 1 = top, 2 = bottom */
+
+ int Quadric;
+ int Sphere;
+ float LightPos[/*4*/] = {10.0f, 10.0f, 10.0f, 1.0f};
+ float Delta = 1.0f;
+ int Mode = 0;
+
+ /*static float Blue[4] = {0.0f, 0.0f, 1.0f, 1.0f};*/
+ /*static float Gray[4] = {0.5f, 0.5f, 0.5f, 1.0f};*/
+ float Black[/*4*/] = {0.0f, 0.0f, 0.0f, 1.0f};
+ float White[/*4*/] = {1.0f, 1.0f, 1.0f, 1.0f};
+
+ public gldemo(int w, int h)
+ {
+ super(w, h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ setAnimateFps(30.0);
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+ public void init()
+ {
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_LIGHT0);
+ gl.glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
+ gl.glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Black);
+
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, White);
+ gl.glMaterialfv(GL_FRONT, GL_SPECULAR, White);
+ gl.glMaterialf(GL_FRONT, GL_SHININESS, 20.0f);
+
+ /* Actually, these are set again later */
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, White);
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, White);
+
+ Quadric = glu.gluNewQuadric();
+ glu.gluQuadricTexture( Quadric, GL_TRUE );
+
+ Sphere= gl.glGenLists(1);
+ gl.glNewList( Sphere, GL_COMPILE );
+ glu.gluSphere( Quadric, 1.0f, 24, 24 );
+ gl.glEndList();
+
+ gl.glEnable(GL_DEPTH_TEST);
+ gl.glEnable(GL_CULL_FACE);
+
+ // byte texImage[64][64][3];
+ byte texImage[] = new byte[64 * 64 * 3];
+ int i,j;
+
+ for (i=0;i<64;i++) {
+ for (j=0;j<64;j++) {
+ int k = ((i>>3)&1) ^ ((j>>3)&1);
+ texImage[i*64*3 + j*3 + 0] = (byte)(255*k);
+ texImage[i*64*3 + j*3 + 1] = (byte)(255*(1-k));
+ texImage[i*64*3 + j*3 + 2] = (byte)(0);
+ }
+ }
+
+ gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ gl.glTexImage2D( GL_TEXTURE_2D,
+ 0,
+ 3,
+ 64, 64,
+ 0,
+ GL_RGB, GL_UNSIGNED_BYTE,
+ texImage );
+ gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ gl.glEnable(GL_TEXTURE_2D);
+
+ gl.glBlendFunc(GL_ONE, GL_ONE);
+
+ glj.gljCheckGL();
+
+ reshape(getSize().width, getSize().height);
+
+ glj.gljCheckGL();
+
+ menu = new PopupMenu("Options");
+ menu.add(MENUE_0);
+ menu.add(MENUE_1);
+ menu.add(MENUE_2);
+ menu.add(MENUE_3);
+ menu.add(MENUE_4);
+ menu.addActionListener(this);
+ add(menu);
+
+ addMouseListener(this);
+ }
+
+ public void doCleanup()
+ {
+ removeMouseListener(this);
+ menu.removeActionListener(this);
+ }
+
+ public void reshape(int width, int height)
+ {
+ gl.glViewport( 0, 0, width, height );
+ gl.glMatrixMode( GL_PROJECTION );
+ gl.glLoadIdentity();
+ gl.glFrustum( -1.0f, 1.0f, -1.0f, 1.0f, 5.0f, 25.0f );
+ gl.glMatrixMode( GL_MODELVIEW );
+ gl.glLoadIdentity();
+ gl.glTranslatef( 0.0f, 0.0f, -12.0f );
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ gl.glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
+
+ gl.glPushMatrix();
+ gl.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
+
+ if (Mode==0) {
+ /* Typical method: diffuse + specular + texture */
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */
+ //gl.glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
+ // glj.gljCheckGL();
+ gl.glCallList(Sphere);
+ }
+ else if (Mode==1) {
+ /* just specular highlight */
+ gl.glDisable(GL_TEXTURE_2D);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, Black); /* disable diffuse */
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */
+ //gl.glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
+ gl.glCallList(Sphere);
+ }
+ else if (Mode==2) {
+ /* diffuse textured */
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, Black); /* disable specular */
+ //gl.glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
+ gl.glCallList(Sphere);
+ }
+ else if (Mode==3) {
+ /* 2-pass: diffuse textured then add specular highlight*/
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, Black); /* disable specular */
+ //gl.glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
+ gl.glCallList(Sphere);
+ /* specular highlight */
+ gl.glDepthFunc(GL_EQUAL); /* redraw same pixels */
+ gl.glDisable(GL_TEXTURE_2D);
+ gl.glEnable(GL_BLEND); /* add */
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, Black); /* disable diffuse */
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */
+ gl.glCallList(Sphere);
+ gl.glDepthFunc(GL_LESS);
+ gl.glDisable(GL_BLEND);
+ }
+ else if (Mode==4) {
+ /* OpenGL 1.2f's separate diffuse and specular color */
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */
+ //gl.glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
+ gl.glCallList(Sphere);
+ }
+
+ gl.glPopMatrix();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+
+ LightPos[0] += Delta;
+ if (LightPos[0]>15.0f)
+ Delta = -1.0f;
+ else if (LightPos[0]<-15.0f)
+ Delta = 1.0f;
+
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ if (!menu_showing)
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ menu_showing = true;
+ save_suspended = isSuspended();
+ if (!save_suspended)
+ {
+ setSuspended(true);
+ repaint(100);
+ try
+ {
+ Thread.currentThread().sleep(200);
+ }
+ catch (Exception e)
+ { }
+ }
+ menu.show(this,evt.getX(),evt.getY());
+ }
+ else
+ {
+ // Must be left button.
+ if (isSuspended()) repaint();
+ }
+ }
+ else
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ // Method required for the implementation of ActionListener
+ public void actionPerformed(ActionEvent evt)
+ {
+ String c = evt.getActionCommand();
+ if (c.equals(MENUE_0))
+ {
+ Mode=0;
+ }
+ else if (c.equals(MENUE_1))
+ {
+ Mode=1;
+ }
+ else if (c.equals(MENUE_2))
+ {
+ Mode=2;
+ }
+ else if (c.equals(MENUE_3))
+ {
+ Mode=3;
+ }
+ else if (c.equals(MENUE_4))
+ {
+ Mode=4;
+ }
+ if (menu_showing)
+ {
+ menu_showing = false;
+ setSuspended(save_suspended);
+ }
+ }
+
+
+
+ }
+}
diff --git a/demos/MiscDemos/spectex_plugin13.html b/demos/MiscDemos/spectex_plugin13.html
new file mode 100644
index 0000000..91da5f0
--- /dev/null
+++ b/demos/MiscDemos/spectex_plugin13.html
@@ -0,0 +1,46 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "spectex.class" WIDTH = 400 HEIGHT = 400 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "spectex.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "spectex.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "spectex.class" WIDTH = 400 HEIGHT = 400>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
+
diff --git a/demos/MiscDemos/stencil.html b/demos/MiscDemos/stencil.html
new file mode 100644
index 0000000..099ef91
--- /dev/null
+++ b/demos/MiscDemos/stencil.html
@@ -0,0 +1,20 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>Stencil by Silicon Graphics; ported to Java by Ron Cemer</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Stencil applet
+<br>Originially written by Silicon Graphics
+<br>
+<B> The left canvas should have 0 stencil-bits !
+<B> The right canvas should have 8 stencil-bits !
+<br>
+<hr>
+<applet code="stencil.class" width=400 height=400>
+</applet>
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/stencil.java b/demos/MiscDemos/stencil.java
new file mode 100644
index 0000000..a2d163f
--- /dev/null
+++ b/demos/MiscDemos/stencil.java
@@ -0,0 +1,342 @@
+/**
+ * @(#) stencil.java
+ * @(#) author: Silicon Graphics (converted to Java by Ron Cemer)
+ */
+
+/*
+ * Copyright (c) 1993-1997, Silicon Graphics, Inc.
+ * ALL RIGHTS RESERVED
+ * Permission to use, copy, modify, and distribute this software for
+ * any purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation, and that
+ * the name of Silicon Graphics, Inc. not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.
+ *
+ * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
+ * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
+ * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
+ * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
+ * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
+ * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
+ * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
+ * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
+ * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * US Government Users Restricted Rights
+ * Use, duplication, or disclosure by the Government is subject to
+ * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
+ * clause at DFARS 252.227-7013 and/or in similar or successor
+ * clauses in the FAR or the DOD or NASA FAR Supplement.
+ * Unpublished-- rights reserved under the copyright laws of the
+ * United States. Contractor/manufacturer is Silicon Graphics,
+ * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
+ *
+ * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
+ */
+
+/*
+ * This program demonstrates use of the stencil buffer for
+ * masking nonrectangular regions.
+ * Whenever the window is redrawn, a value of 1 is drawn
+ * into a diamond-shaped region in the stencil buffer.
+ * Elsewhere in the stencil buffer, the value is 0.
+ * Then a blue sphere is drawn where the stencil value is 1,
+ * and yellow torii are drawn where the stencil value is not 1.
+ */
+
+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 stencil extends Applet
+{
+ stencilCanvas canvas1 = null;
+ stencilCanvas canvas2 = null;
+
+ Panel cvs = null;
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+
+ canvas1 = new stencilCanvas(d.width, d.height, 0, false);
+ System.out.println("the left canvas has 0 stencil-bits, self-window");
+ canvas2 = new stencilCanvas(d.width, d.height, 8, true);
+ System.out.println("the right canvas should have 8 stencil-bits, ownWindow");
+
+ cvs = new Panel();
+ cvs.setLayout(new GridLayout(1,2));
+ cvs.add(canvas1);
+ if(canvas2!=null)
+ cvs.add(canvas2);
+ add("Center", cvs);
+ }
+
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("stencil");
+
+ GLContext.gljNativeDebug = true;
+ GLContext.gljClassDebug = true;
+
+ stencil applet = new stencil();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+ /* Start the applet */
+
+
+ public void start()
+ {
+ }
+
+
+ /* Stop the applet */
+
+
+ public void stop()
+ {
+ }
+
+
+ /* Destroy the applet */
+
+
+
+ /* Local GLCanvas extension class */
+
+
+ private class stencilCanvas extends GLCanvas
+ {
+ private static final float M_PI = 3.14159265359f;
+ private static final int YELLOWMAT = 1, BLUEMAT = 2;
+ private boolean initdone = false;
+
+ public stencilCanvas(int w, int h,
+ int _stencilBits,
+ boolean _createOwnWindow)
+ {
+ super(w, h);
+ stencilBits = _stencilBits;
+ createOwnWindow = _createOwnWindow;
+ }
+
+ public void preInit()
+ {
+ doubleBuffer = true;
+ stereoView = false;
+ }
+
+ public void init()
+ {
+ // Examine some OpenGL properties
+ int [] res=new int[6];
+
+ gl.glGetIntegerv(GL_STENCIL_BITS,res);
+
+ System.out.println("init(): " + this + "\n\t" +
+ "Stencil bits are "+res[0] +"\n\t" +
+ "IsOwnCreatedWindow: "+createOwnWindow);
+
+ float yellow_diffuse[] = { 0.7f, 0.7f, 0.0f, 1.0f };
+ float yellow_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+
+ float blue_diffuse[] = { 0.1f, 0.1f, 0.7f, 1.0f };
+ float blue_specular[] = { 0.1f, 1.0f, 1.0f, 1.0f };
+
+ float position_one[] = { 1.0f, 1.0f, 1.0f, 0.0f };
+
+ gl.glNewList(YELLOWMAT, GL_COMPILE);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, yellow_diffuse);
+ gl.glMaterialfv(GL_FRONT, GL_SPECULAR, yellow_specular);
+ gl.glMaterialf(GL_FRONT, GL_SHININESS, 64.0f);
+ gl.glEndList();
+
+ gl.glNewList(BLUEMAT, GL_COMPILE);
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, blue_diffuse);
+ gl.glMaterialfv(GL_FRONT, GL_SPECULAR, blue_specular);
+ gl.glMaterialf(GL_FRONT, GL_SHININESS, 45.0f);
+ gl.glEndList();
+
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, position_one);
+
+ gl.glEnable(GL_LIGHT0);
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_DEPTH_TEST);
+
+ gl.glClearStencil(0);
+ gl.glEnable(GL_STENCIL_TEST);
+
+ glj.gljCheckGL();
+
+ initdone = true;
+ reshape(getSize().width, getSize().height);
+ }
+
+ public void cvsDispose()
+ {
+ System.out.println("destroy(): " + this);
+ super.cvsDispose();
+ }
+
+ public void reshape(int width, int height)
+ {
+ gl.glViewport(0,0,width,height);
+
+ if (initdone)
+ {
+ /* create a diamond shaped stencil area */
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ if (width <= height)
+ glu.gluOrtho2D
+ (-3.0f,
+ 3.0f,
+ -3.0f*(float)height/(float)width,
+ 3.0f*(float)height/(float)width);
+ else
+ glu.gluOrtho2D
+ (-3.0f*(float)width/(float)height,
+ 3.0f*(float)width/(float)height,
+ -3.0f,
+ 3.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+
+ gl.glClear(GL_STENCIL_BUFFER_BIT);
+ gl.glStencilFunc(GL_ALWAYS, 1, 1);
+ gl.glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ gl.glBegin(GL_QUADS);
+ gl.glVertex2f(-1.0f, 0.0f);
+ gl.glVertex2f(0.0f, 1.0f);
+ gl.glVertex2f(1.0f, 0.0f);
+ gl.glVertex2f(0.0f, -1.0f);
+ gl.glEnd();
+ }
+
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPerspective(45.0f, (float)width/(float)height, 3.0f, 7.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glTranslatef(0.0f, 0.0f, -5.0f);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ /* Draw a sphere in a diamond-shaped section in the
+ * middle of a window with 2 torii.
+ */
+
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ /* draw blue sphere where the stencil is 1 */
+ gl.glStencilFunc(GL_EQUAL, 1, 1);
+ gl.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ gl.glCallList(BLUEMAT);
+
+ int qobj = glu.gluNewQuadric();
+ glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
+ glu.gluQuadricNormals(qobj,GLU_SMOOTH);
+ glu.gluQuadricTexture(qobj,false);
+ glu.gluSphere(qobj,0.5f,15,15);
+ glu.gluDeleteQuadric(qobj);
+
+ /* draw the tori where the stencil is not 1 */
+ gl.glStencilFunc(GL_NOTEQUAL, 1, 1);
+ gl.glPushMatrix();
+ gl.glRotatef(45.0f, 0.0f, 0.0f, 1.0f);
+ gl.glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
+ gl.glCallList(YELLOWMAT);
+ glutSolidTorus(0.275f, 0.85f, 15, 15);
+ gl.glPushMatrix();
+ gl.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
+ glutSolidTorus(0.275f, 0.85f, 15, 15);
+ gl.glPopMatrix();
+ gl.glPopMatrix();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ // Imported from glut.
+ private void glutSolidTorus
+ (float innerRadius,
+ float outerRadius,
+ int nsides,
+ int rings)
+ {
+ doughnut(innerRadius, outerRadius, nsides, rings);
+ }
+
+ // Imported from glut.
+ private void doughnut(float r, float R, int nsides, int rings)
+ {
+ int i, j;
+ float theta, phi, theta1;
+ float cosTheta, sinTheta;
+ float cosTheta1, sinTheta1;
+ float ringDelta, sideDelta;
+
+ ringDelta = 2.0f * M_PI / rings;
+ sideDelta = 2.0f * M_PI / nsides;
+
+ theta = 0.0f;
+ cosTheta = 1.0f;
+ sinTheta = 0.0f;
+ for (i = rings - 1; i >= 0; i--)
+ {
+ theta1 = theta + ringDelta;
+ cosTheta1 = (float)Math.cos(theta1);
+ sinTheta1 = (float)Math.sin(theta1);
+ gl.glBegin(GL_QUAD_STRIP);
+ phi = 0.0f;
+ for (j = nsides; j >= 0; j--)
+ {
+ float cosPhi, sinPhi, dist;
+
+ phi += sideDelta;
+ cosPhi = (float)Math.cos(phi);
+ sinPhi = (float)Math.sin(phi);
+ dist = R + r * cosPhi;
+
+ gl.glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
+ gl.glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
+ gl.glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
+ gl.glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi);
+ }
+ gl.glEnd();
+ theta = theta1;
+ cosTheta = cosTheta1;
+ sinTheta = sinTheta1;
+ }
+ }
+ }
+}
diff --git a/demos/MiscDemos/stencil_plugin13.html b/demos/MiscDemos/stencil_plugin13.html
new file mode 100644
index 0000000..3a654f8
--- /dev/null
+++ b/demos/MiscDemos/stencil_plugin13.html
@@ -0,0 +1,51 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>Stencil by Silicon Graphics; ported to Java by Ron Cemer</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Stencil applet
+<br>Originially written by Silicon Graphics
+<br>
+<B> The left canvas should have 0 stencil-bits !
+<B> The right canvas should have 8 stencil-bits !
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "stencil.class" WIDTH = 400 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "stencil.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "stencil.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "stencil.class" WIDTH = 400 HEIGHT = 400>
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/teaambient.html b/demos/MiscDemos/teaambient.html
new file mode 100644
index 0000000..2bdbdcd
--- /dev/null
+++ b/demos/MiscDemos/teaambient.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<applet code="teaambient.class" width=400 height=400>
+</applet>
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/teaambient.java b/demos/MiscDemos/teaambient.java
new file mode 100755
index 0000000..aaebf71
--- /dev/null
+++ b/demos/MiscDemos/teaambient.java
@@ -0,0 +1,182 @@
+/**
+ * @(#) teaambient.java
+ * @(#) author: Silicon Graphics, Inc. (converted to Java by Ron Cemer)
+ */
+
+/*
+ * This program demonstrates lots of material properties.
+ * A single light source illuminates the objects.
+ */
+
+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;
+
+import gl4java.utils.glut.*;
+
+public class teaambient extends Applet
+{
+ teaambientCanvas canvas = null;
+
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new teaambientCanvas(d.width, d.height);
+ add("Center", canvas);
+ }
+
+
+ /* Start the applet */
+
+
+ public void start()
+ {
+ }
+
+
+ /* Stop the applet */
+
+
+ public void stop()
+ {
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("teaambient");
+
+ teaambient applet = new teaambient();
+
+ applet.setSize(400, 600);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+
+ /* Local GLCanvas extension class */
+
+
+ private class teaambientCanvas extends GLCanvas
+ {
+ GLUTFunc glut = null;
+
+ public teaambientCanvas(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);
+
+ glut = new GLUTFuncLightImpl(gl, glu);
+
+ reshape(getSize().width, getSize().height);
+
+ float light_ambient[] =
+ {0.0f, 0.0f, 0.0f, 1.0f};
+ float light_diffuse[] =
+ {1.0f, 1.0f, 1.0f, 1.0f};
+ float light_specular[] =
+ {1.0f, 1.0f, 1.0f, 1.0f};
+ /* light_position is NOT default value */
+ float light_position[] =
+ {1.0f, 0.0f, 0.0f, 0.0f};
+ float global_ambient[] =
+ {0.75f, 0.75f, 0.75f, 1.0f};
+
+ gl.glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
+ gl.glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, light_position);
+
+ gl.glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient);
+
+ gl.glFrontFace(GL_CW);
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_LIGHT0);
+ gl.glEnable(GL_AUTO_NORMAL);
+ gl.glEnable(GL_NORMALIZE);
+ gl.glDepthFunc(GL_LESS);
+ gl.glEnable(GL_DEPTH_TEST);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ float low_ambient[] =
+ {0.1f, 0.1f, 0.1f, 1.0f};
+ float more_ambient[] =
+ {0.4f, 0.4f, 0.4f, 1.0f};
+ float most_ambient[] =
+ {1.0f, 1.0f, 1.0f, 1.0f};
+
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ /* material has small ambient reflection */
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT, low_ambient);
+ gl.glMaterialf(GL_FRONT, GL_SHININESS, 40.0f);
+ gl.glPushMatrix();
+ gl.glTranslatef(0.0f, 2.0f, 0.0f);
+ glut.glutSolidTeapot(1.0f);
+ gl.glPopMatrix();
+
+ /* material has moderate ambient reflection */
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT, more_ambient);
+ gl.glPushMatrix();
+ gl.glTranslatef(0.0f, 0.0f, 0.0f);
+ glut.glutSolidTeapot(1.0f);
+ gl.glPopMatrix();
+
+ /* material has large ambient reflection */
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT, most_ambient);
+ gl.glPushMatrix();
+ gl.glTranslatef(0.0f, -2.0f, 0.0f);
+ glut.glutSolidTeapot(1.0f);
+ gl.glPopMatrix();
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glViewport(0, 0, w, h);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ if (w <= h)
+ gl.glOrtho(-4.0f, 4.0f, -4.0f * (float) h / (float) w,
+ 4.0f * (float) h / (float) w, -10.0f, 10.0f);
+ else
+ gl.glOrtho(-4.0f * (float) w / (float) h,
+ 4.0f * (float) w / (float) h, -4.0f, 4.0f, -10.0f, 10.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ }
+
+ }
+}
diff --git a/demos/MiscDemos/teaambient_plugin13.html b/demos/MiscDemos/teaambient_plugin13.html
new file mode 100644
index 0000000..b1ddbb8
--- /dev/null
+++ b/demos/MiscDemos/teaambient_plugin13.html
@@ -0,0 +1,48 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>OpenGL Demo - ported by Sven Goethel</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Sven Goethel
+<br>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "teaambient.class" WIDTH = 400 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "teaambient.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "teaambient.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "teaambient.class" WIDTH = 400 HEIGHT = 400>
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/teapots.html b/demos/MiscDemos/teapots.html
new file mode 100644
index 0000000..834c206
--- /dev/null
+++ b/demos/MiscDemos/teapots.html
@@ -0,0 +1,17 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>Teapots by Silicon Graphics; ported to Java by Ron Cemer</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Ron Cemer
+<br>
+<applet code="teapots.class" width=400 height=400>
+</applet>
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/teapots.java b/demos/MiscDemos/teapots.java
new file mode 100644
index 0000000..63d42aa
--- /dev/null
+++ b/demos/MiscDemos/teapots.java
@@ -0,0 +1,279 @@
+/**
+ * @(#) teapots.java
+ * @(#) author: Silicon Graphics, Inc. (converted to Java by Ron Cemer)
+ */
+
+/*
+ * This program demonstrates lots of material properties.
+ * A single light source illuminates the objects.
+ */
+
+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;
+
+import gl4java.utils.glut.*;
+
+public class teapots extends Applet
+{
+ teapotsCanvas canvas = null;
+
+
+ /* Initialize the applet */
+
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new teapotsCanvas(d.width, d.height);
+ add("Center", canvas);
+ }
+
+
+ /* Start the applet */
+
+
+ public void start()
+ {
+ }
+
+
+ /* Stop the applet */
+
+
+ public void stop()
+ {
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("teapots");
+
+ teapots applet = new teapots();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+
+ /* Local GLCanvas extension class */
+
+
+ private class teapotsCanvas extends GLCanvas
+ {
+ int teapotList;
+ GLUTFunc glut = null;
+
+ public teapotsCanvas(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);
+
+ glut = new GLUTFuncLightImpl(gl, glu);
+
+ reshape(getSize().width, getSize().height);
+
+ float ambient[] = {0.0f, 0.0f, 0.0f, 1.0f};
+ float diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
+ float specular[] = {1.0f, 1.0f, 1.0f, 1.0f};
+ float position[] = {0.0f, 3.0f, 3.0f, 0.0f};
+
+ float lmodel_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};
+ float local_view[] = {0.0f};
+
+ gl.glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ gl.glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ gl.glLightfv(GL_LIGHT0, GL_POSITION, position);
+ gl.glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ gl.glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view);
+
+ gl.glFrontFace(GL_CW);
+ gl.glEnable(GL_LIGHTING);
+ gl.glEnable(GL_LIGHT0);
+ gl.glEnable(GL_AUTO_NORMAL);
+ gl.glEnable(GL_NORMALIZE);
+ gl.glEnable(GL_DEPTH_TEST);
+ /* be efficient--make teapot display list */
+ teapotList = gl.glGenLists(1);
+ gl.glNewList(teapotList, GL_COMPILE);
+ glut.glutSolidTeapot(1.0);
+ gl.glEndList();
+
+ glj.gljCheckGL();
+ }
+
+ public void reshape(int width, int height)
+ {
+ gl.glViewport(0,0,width,height);
+ gl.glMatrixMode(GL_PROJECTION);
+ gl.glLoadIdentity();
+ if (width <= height)
+ gl.glOrtho
+ (0.0f,
+ 16.0f,
+ 0.0f,
+ 16.0f*(float)height/(float)width,
+ -10.0f,
+ 10.0f);
+ else
+ gl.glOrtho
+ (0.0f,
+ 16.0f*(float)width/(float)height,
+ 0.0f,
+ 16.0,
+ -10.0f,
+ 10.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ }
+
+ public void display()
+ {
+ if (glj.gljMakeCurrent() == false) return;
+
+ /**
+ * First column: emerald, jade, obsidian, pearl, ruby, turquoise
+ * 2nd column: brass, bronze, chrome, copper, gold, silver
+ * 3rd column: black, cyan, green, red, white, yellow plastic
+ * 4th column: black, cyan, green, red, white, yellow rubber
+ */
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ renderTeapot
+ (2.0f, 17.0f, 0.0215f, 0.1745f, 0.0215f,
+ 0.07568f, 0.61424f, 0.07568f, 0.633f, 0.727811f, 0.633f, 0.6f);
+ renderTeapot
+ (2.0f, 14.0f, 0.135f, 0.2225f, 0.1575f,
+ 0.54f, 0.89f, 0.63f, 0.316228f, 0.316228f, 0.316228f, 0.1f);
+ renderTeapot
+ (2.0f, 11.0f, 0.05375f, 0.05f, 0.06625f,
+ 0.18275f, 0.17f, 0.22525f, 0.332741f, 0.328634f, 0.346435f, 0.3f);
+ renderTeapot
+ (2.0f, 8.0f, 0.25f, 0.20725f, 0.20725f,
+ 1f, 0.829f, 0.829f, 0.296648f, 0.296648f, 0.296648f, 0.088f);
+ renderTeapot
+ (2.0f, 5.0f, 0.1745f, 0.01175f, 0.01175f,
+ 0.61424f, 0.04136f, 0.04136f, 0.727811f, 0.626959f, 0.626959f, 0.6f);
+ renderTeapot
+ (2.0f, 2.0f, 0.1f, 0.18725f, 0.1745f,
+ 0.396f, 0.74151f, 0.69102f, 0.297254f, 0.30829f, 0.306678f, 0.1f);
+ renderTeapot
+ (6.0f, 17.0f, 0.329412f, 0.223529f, 0.027451f,
+ 0.780392f, 0.568627f, 0.113725f, 0.992157f, 0.941176f, 0.807843f,
+ 0.21794872f);
+ renderTeapot
+ (6.0f, 14.0f, 0.2125f, 0.1275f, 0.054f,
+ 0.714f, 0.4284f, 0.18144f, 0.393548f, 0.271906f, 0.166721f, 0.2f);
+ renderTeapot
+ (6.0f, 11.0f, 0.25f, 0.25f, 0.25f,
+ 0.4f, 0.4f, 0.4f, 0.774597f, 0.774597f, 0.774597f, 0.6f);
+ renderTeapot
+ (6.0f, 8.0f, 0.19125f, 0.0735f, 0.0225f,
+ 0.7038f, 0.27048f, 0.0828f, 0.256777f, 0.137622f, 0.086014f, 0.1f);
+ renderTeapot
+ (6.0f, 5.0f, 0.24725f, 0.1995f, 0.0745f,
+ 0.75164f, 0.60648f, 0.22648f, 0.628281f, 0.555802f, 0.366065f, 0.4f);
+ renderTeapot
+ (6.0f, 2.0f, 0.19225f, 0.19225f, 0.19225f,
+ 0.50754f, 0.50754f, 0.50754f, 0.508273f, 0.508273f, 0.508273f, 0.4f);
+ renderTeapot
+ (10.0f, 17.0f, 0.0f, 0.0f, 0.0f, 0.01f, 0.01f, 0.01f,
+ 0.50f, 0.50f, 0.50f, .25f);
+ renderTeapot
+ (10.0f, 14.0f, 0.0f, 0.1f, 0.06f, 0.0f, 0.50980392f, 0.50980392f,
+ 0.50196078f, 0.50196078f, 0.50196078f, .25f);
+ renderTeapot
+ (10.0f, 11.0f, 0.0f, 0.0f, 0.0f,
+ 0.1f, 0.35f, 0.1f, 0.45f, 0.55f, 0.45f, .25f);
+ renderTeapot
+ (10.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f,
+ 0.7f, 0.6f, 0.6f, .25f);
+ renderTeapot
+ (10.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.55f, 0.55f, 0.55f,
+ 0.70f, 0.70f, 0.70f, .25f);
+ renderTeapot
+ (10.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.0f,
+ 0.60f, 0.60f, 0.50f, .25f);
+ renderTeapot
+ (14.0f, 17.0f, 0.02f, 0.02f, 0.02f, 0.01f, 0.01f, 0.01f,
+ 0.4f, 0.4f, 0.4f, .078125f);
+ renderTeapot
+ (14.0f, 14.0f, 0.0f, 0.05f, 0.05f, 0.4f, 0.5f, 0.5f,
+ 0.04f, 0.7f, 0.7f, .078125f);
+ renderTeapot
+ (14.0f, 11.0f, 0.0f, 0.05f, 0.0f, 0.4f, 0.5f, 0.4f,
+ 0.04f, 0.7f, 0.04f, .078125f);
+ renderTeapot
+ (14.0f, 8.0f, 0.05f, 0.0f, 0.0f, 0.5f, 0.4f, 0.4f,
+ 0.7f, 0.04f, 0.04f, .078125f);
+ renderTeapot
+ (14.0f, 5.0f, 0.05f, 0.05f, 0.05f, 0.5f, 0.5f, 0.5f,
+ 0.7f, 0.7f, 0.7f, .078125f);
+ renderTeapot
+ (14.0f, 2.0f, 0.05f, 0.05f, 0.0f, 0.5f, 0.5f, 0.4f,
+ 0.7f, 0.7f, 0.04f, .078125f);
+ gl.glFlush();
+
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ /*
+ * Move object into position. Use 3rd through 12th
+ * parameters to specify the material property. Draw a teapot.
+ */
+ private void renderTeapot
+ (float x,
+ float y,
+ float ambr,
+ float ambg,
+ float ambb,
+ float difr,
+ float difg,
+ float difb,
+ float specr,
+ float specg,
+ float specb,
+ float shine)
+ {
+ float mat[] = new float[4];
+
+ gl.glPushMatrix();
+ gl.glTranslatef(x, y, 0.0f);
+ mat[0] = ambr; mat[1] = ambg; mat[2] = ambb; mat[3] = 1.0f;
+ gl.glMaterialfv(GL_FRONT, GL_AMBIENT, mat);
+ mat[0] = difr; mat[1] = difg; mat[2] = difb;
+ gl.glMaterialfv(GL_FRONT, GL_DIFFUSE, mat);
+ mat[0] = specr; mat[1] = specg; mat[2] = specb;
+ gl.glMaterialfv(GL_FRONT, GL_SPECULAR, mat);
+ gl.glMaterialf(GL_FRONT, GL_SHININESS, shine * 128.0f);
+ gl.glCallList(teapotList);
+ gl.glPopMatrix();
+ }
+
+ }
+}
diff --git a/demos/MiscDemos/teapots_plugin13.html b/demos/MiscDemos/teapots_plugin13.html
new file mode 100644
index 0000000..19ee75d
--- /dev/null
+++ b/demos/MiscDemos/teapots_plugin13.html
@@ -0,0 +1,48 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
+ <title>Teapots by Silicon Graphics; ported to Java by Ron Cemer</title>
+</head>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Teapots applet
+<br>Originially written by Silicon Graphics
+<br>Ported to Java by Ron Cemer
+<br>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "teapots.class" WIDTH = 400 HEIGHT = 400 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "teapots.class" WIDTH = 400 HEIGHT = 400></XMP>
+<PARAM NAME = CODE VALUE = "teapots.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "teapots.class" WIDTH = 400 HEIGHT = 400>
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</body>
+</html>
diff --git a/demos/MiscDemos/tess.h b/demos/MiscDemos/tess.h
new file mode 100644
index 0000000..998c67b
--- /dev/null
+++ b/demos/MiscDemos/tess.h
@@ -0,0 +1,40 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class tess */
+
+#ifndef _Included_tess
+#define _Included_tess
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* Inaccessible static: LOCK */
+#undef tess_assert
+#define tess_assert 0L
+/* Inaccessible static: isInc */
+/* Inaccessible static: incRate */
+#undef tess_TOP_ALIGNMENT
+#define tess_TOP_ALIGNMENT 0.0f
+#undef tess_CENTER_ALIGNMENT
+#define tess_CENTER_ALIGNMENT 0.5f
+#undef tess_BOTTOM_ALIGNMENT
+#define tess_BOTTOM_ALIGNMENT 1.0f
+#undef tess_LEFT_ALIGNMENT
+#define tess_LEFT_ALIGNMENT 0.0f
+#undef tess_RIGHT_ALIGNMENT
+#define tess_RIGHT_ALIGNMENT 1.0f
+#undef tess_serialVersionUID
+#define tess_serialVersionUID -7644114512714619750LL
+#undef tess_serialVersionUID
+#define tess_serialVersionUID 4613797578919906343LL
+/* Inaccessible static: nameCounter */
+#undef tess_serialVersionUID
+#define tess_serialVersionUID -2728009084054400034LL
+#undef tess_serialVersionUID
+#define tess_serialVersionUID -5836846270535785031LL
+/* Inaccessible static: rect */
+/* Inaccessible static: tri */
+/* Inaccessible static: star */
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/demos/MiscDemos/tess.html b/demos/MiscDemos/tess.html
new file mode 100644
index 0000000..e4496f7
--- /dev/null
+++ b/demos/MiscDemos/tess.html
@@ -0,0 +1,15 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Right-Mouse Button for a Menu !
+<br>
+<hr>
+<applet code="tess.class" width=500 height=300>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/tess.java b/demos/MiscDemos/tess.java
new file mode 100644
index 0000000..2cf3a7a
--- /dev/null
+++ b/demos/MiscDemos/tess.java
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 1993-1997, Silicon Graphics, Inc.
+ * ALL RIGHTS RESERVED
+ * Permission to use, copy, modify, and distribute this software for
+ * any purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation, and that
+ * the name of Silicon Graphics, Inc. not be used in adverti(float)Math.sing
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.
+ *
+ * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
+ * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
+ * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
+ * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
+ * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
+ * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
+ * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
+ * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
+ * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * US Government Users Restricted Rights
+ * Use, duplication, or disclosure by the Government is subject to
+ * restrictions set forth in FAR 52.227f.19(c)(2) or subparagraph
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
+ * clause at DFARS 252.227f-7013 and/or in similar or successor
+ * clauses in the FAR or the DOD or NASA FAR Supplement.
+ * Unpublished-- rights reserved under the copyright laws of the
+ * United States. Contractor/manufacturer is Silicon Graphics,
+ * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
+ *
+ * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
+ */
+
+/*
+ * tess.c
+ * This program demonstrates polygon tessellation.
+ * Two tesselated objects are drawn. The first is a
+ * rectangle with a triangular hole. The second is a
+ * smooth shaded, self-intersecting star.
+ *
+ * Note the exterior rectangle is drawn with its vertices
+ * in counter-clockwise order, but its interior clockwise.
+ * Note the combineCallback is needed for the self-intersecting
+ * star. Also note that removing the TessProperty for the
+ * star will make the interior unshaded (WINDING_ODD).
+ */
+
+import gl4java.utils.glut.*;
+import gl4java.utils.glut.fonts.*;
+
+import gl4java.awt.*;
+import java.applet.*;
+import java.awt.*;
+import java.awt.Dimension;
+import java.awt.event.*;
+import java.lang.*;
+import java.util.*;
+import gl4java.*;
+
+public class tess extends Applet {
+
+ MyCanvas canvas = null;
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new MyCanvas (d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("tessdemo");
+
+ tess applet = new tess();
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ public static double rect[/*4*/][/*3*/] =
+ {{50.0, 50.0, 0.0},
+ {200.0, 50.0, 0.0},
+ {200.0, 200.0f, 0.0},
+ {50.0, 200.0, 0.0}};
+ public static double tri[/*3*/][/*3*/] =
+ {{75.0, 75.0, 0.0},
+ {125.0, 175.0, 0.0},
+ {175.0, 75.0, 0.0}};
+
+ public static double star[/*5*/][/*6*/] =
+ {{250.0, 50.0, 0.0, 1.0, 0.0, 1.0},
+ {325.0, 200.0, 0.0, 1.0, 1.0, 0.0},
+ {400.0, 50.0, 0.0, 0.0, 1.0, 1.0},
+ {250.0, 150.0, 0.0, 1.0, 0.0, 0.0},
+ {400.0, 150.0, 0.0, 0.0, 1.0, 0.0}};
+
+ protected class MyCanvas extends GLCanvas
+ {
+ protected GLUTFunc glut = null;
+
+ int startList=-1;
+ boolean exit = false;
+
+ public MyCanvas(int w, int h) {
+ super(w,h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ public void init() {
+ int i;
+ glut = new GLUTFuncLightImplWithFonts(gl, glu);
+
+ int tobj;
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
+ startList = gl.glGenLists(2);
+
+ tobj = glu.gluNewTess();
+ glu.gluTessCallback ( tobj, GLU_TESS_VERTEX, gl,
+ "glVertex3dv", "([D)V",
+ 3, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_BEGIN, this,
+ "beginCallback", "(I)V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_END, this,
+ "endCallback", "()V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_ERROR, this,
+ "errorCallback", "(I)V",
+ 0, 0, 0, 0, 0);
+
+ /* rectangle with triangular hole inside */
+ gl.glNewList(startList, GL_COMPILE);
+ gl.glShadeModel(GL_FLAT);
+ glu.gluTessBeginPolygon(tobj, (double[])null);
+ glu.gluTessBeginContour(tobj);
+ glu.gluTessVertex(tobj, rect[0], rect[0]);
+ glu.gluTessVertex(tobj, rect[1], rect[1]);
+ glu.gluTessVertex(tobj, rect[2], rect[2]);
+ glu.gluTessVertex(tobj, rect[3], rect[3]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessBeginContour(tobj);
+ glu.gluTessVertex(tobj, tri[0], tri[0]);
+ glu.gluTessVertex(tobj, tri[1], tri[1]);
+ glu.gluTessVertex(tobj, tri[2], tri[2]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessEndPolygon(tobj);
+ gl.glEndList();
+
+ glu.gluTessCallback ( tobj, GLU_TESS_VERTEX, this,
+ "vertexCallback", "([D)V",
+ 6, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_BEGIN, this,
+ "beginCallback", "(I)V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_END, this,
+ "endCallback", "()V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_ERROR, this,
+ "errorCallback", "(I)V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_COMBINE, this,
+ "combineCallback", "([D[D[F[D)V",
+ 3, 4*6, 4, 6, 0);
+
+ /* smooth shaded, self-intersecting star */
+ gl.glNewList(startList + 1, GL_COMPILE);
+ gl.glShadeModel(GL_SMOOTH);
+ glu.gluTessProperty(tobj, GLU_TESS_WINDING_RULE,
+ GLU_TESS_WINDING_POSITIVE);
+ glu.gluTessBeginPolygon(tobj, (double[])null);
+ glu.gluTessBeginContour(tobj);
+ glu.gluTessVertex(tobj, star[0], star[0]);
+ glu.gluTessVertex(tobj, star[1], star[1]);
+ glu.gluTessVertex(tobj, star[2], star[2]);
+ glu.gluTessVertex(tobj, star[3], star[3]);
+ glu.gluTessVertex(tobj, star[4], star[4]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessEndPolygon(tobj);
+ gl.glEndList();
+
+ glu.gluDeleteTess(tobj);
+
+ reshape(getSize().width, getSize().height);
+
+ glj.gljCheckGL();
+ }
+
+ public void display()
+ {
+
+ if(exit) return;
+
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+ gl.glColor3f(1.0f, 1.0f, 1.0f);
+ gl.glCallList(startList);
+ gl.glCallList(startList + 1);
+
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void beginCallback(int which)
+ {
+ gl.glBegin(which);
+ }
+
+ public void errorCallback(int errorCode)
+ {
+ String str;
+
+ gl.glColor3f( 0.9f, 0.9f, 0.9f );
+ gl.glRasterPos2i( 5, 5 );
+
+ str = glu.gluErrorString( errorCode );
+
+ glut.glutBitmapString(glut.GLUT_BITMAP_9_BY_15, str);
+ exit = true;
+ }
+
+ public void endCallback()
+ {
+ gl.glEnd();
+ }
+
+ public void vertexCallback(double[/*6*/] vertex)
+ {
+ double[] col = new double[3];
+ System.arraycopy(vertex, 3, col, 0, 3);
+
+ gl.glColor3dv(col);
+ gl.glVertex3dv(vertex);
+ }
+
+ /* combineCallback is used to create a new vertex when edges
+ * intersect. coordinate location is trivial to calculate,
+ * but weight[4] may be used to average color, normal, or texture
+ * coordinate data. In this program, color is weighted.
+ */
+ public void combineCallback(double coords[/*3*/],
+ double vertex_data[/*4x6*/],
+ float weight[/*4*/], double[/*6*/] dataOut )
+ {
+ int i;
+
+ dataOut[0] = coords[0];
+ dataOut[1] = coords[1];
+ dataOut[2] = coords[2];
+ for (i = 3; i < 6; i++)
+ dataOut[i] = weight[0] * vertex_data[0*6+i]
+ + weight[1] * vertex_data[1*6+i]
+ + weight[2] * vertex_data[2*6+i]
+ + weight[3] * vertex_data[3*6+i];
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glViewport( 0, 0, w, h );
+
+ gl.glMatrixMode( GL_PROJECTION );
+ gl.glLoadIdentity();
+ glu.gluOrtho2D(0.0f, (double) w, 0.0f, (double) h);
+ }
+
+ }
+}
diff --git a/demos/MiscDemos/tess_plugin13.html b/demos/MiscDemos/tess_plugin13.html
new file mode 100644
index 0000000..d9b4bc1
--- /dev/null
+++ b/demos/MiscDemos/tess_plugin13.html
@@ -0,0 +1,47 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Right-Mouse Button for a Menu !
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "tess.class" WIDTH = 500 HEIGHT = 300 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "tess.class" WIDTH = 500 HEIGHT = 300></XMP>
+<PARAM NAME = CODE VALUE = "tess.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "tess.class" WIDTH = 500 HEIGHT = 300>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/tessdemo.html b/demos/MiscDemos/tessdemo.html
new file mode 100644
index 0000000..7e07e0b
--- /dev/null
+++ b/demos/MiscDemos/tessdemo.html
@@ -0,0 +1,15 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Right-Mouse Button for a Menu !
+<br>
+<hr>
+<applet code="tessdemo.class" width=500 height=300>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/tessdemo.java b/demos/MiscDemos/tessdemo.java
new file mode 100755
index 0000000..899b27a
--- /dev/null
+++ b/demos/MiscDemos/tessdemo.java
@@ -0,0 +1,667 @@
+/* $Id$ */
+
+/*
+ * A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
+ * This demo isn't built by the Makefile because it needs GLUT. After you've
+ * installed GLUT you can try this demo.
+ * Here's the command for IRIX, for example:
+ cc -g -ansi -prototypes -fullwarn -float -I../include -DSHM tess_demo.c -L../lib -lglut -lMesaGLU -lMesaGL -lm -lX11 -lXext -lXmu -lfpe -lXext -o tess_demo
+ */
+
+/*
+ * Updated for GLU 1.3f tessellation by Gareth Hughes <[email protected]>
+ */
+
+/*
+ * $Log$
+ * Revision 1.1 2000/11/18 06:53:19 sven
+ * Initial revision
+ *
+ * Revision 1.3f.2.1f 1999/11/16 11:09:09 gareth
+ * Added combine callback. Converted vertices from ints to floats.
+ *
+ * Revision 1.3f 1999/11/04 04:00:42 gareth
+ * Updated demo for new GLU 1.3f tessellation. Added optimized rendering
+ * by saving the output of the tessellation into display lists.
+ *
+ * Revision 1.2f 1999/09/19 20:09:00 tanner
+ *
+ * lots of autoconf updates
+ *
+ * Revision 1.1f.1.1f 1999/08/19 00:55:40 jtg
+ * Imported sources
+ *
+ * Revision 3.5f 1999/03/28 18:24:37 brianp
+ * minor clean-up
+ *
+ * Revision 3.4f 1999/02/14 03:37:07 brianp
+ * fixed callback problem
+ *
+ * Revision 3.3f 1998/07/26 01:25:26 brianp
+ * removed include of gl.h and glu.h
+ *
+ * Revision 3.2f 1998/06/29 02:37:30 brianp
+ * minor changes for Windows (Ted Jump)
+ *
+ * Revision 3.1f 1998/06/09 01:53:49 brianp
+ * main() should return an int
+ *
+ * Revision 3.0f 1998/02/14 18:42:29 brianp
+ * initial rev
+ *
+ */
+
+
+import gl4java.utils.glut.*;
+import gl4java.utils.glut.fonts.*;
+import gl4java.utils.textures.*;
+
+import gl4java.awt.*;
+import java.applet.*;
+import java.awt.*;
+import java.awt.Dimension;
+import java.awt.event.*;
+import java.lang.*;
+import java.util.*;
+import gl4java.*;
+
+public class tessdemo extends Applet {
+
+ MyCanvas canvas = null;
+ boolean isAnApplet = true;
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new MyCanvas (d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("tessdemo");
+
+ tessdemo applet = new tessdemo();
+ applet.isAnApplet = false;
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+
+ System.out.println(applet.canvas.usage());
+ }
+
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ static final int MAX_POINTS = 256;
+ static final int MAX_CONTOURS = 32;
+ static final int MAX_TRIANGLES = 256;
+ static final String MENU_DONE = "Done";
+ static final String MENU_TESS = "Tesselate";
+ static final String MENU_CLR = "Clear";
+ static final String MENU_SNAPSHOT = "Snapshot";
+ static final int MODE_DONE =0;
+ static final int MODE_CLR =1;
+ static final int MODE_DEFINE =2;
+ static final int MODE_TESSELATE =3;
+ static final int MODE_TESSELATED =4;
+
+ protected class Contour
+ {
+ float p[][];
+ int point_cnt;
+
+ public Contour()
+ {
+ p = new float[MAX_POINTS][2];
+ point_cnt = 0;
+ }
+ }
+
+ protected class Triangle
+ {
+ int no;
+ float p[][];
+ float color[][];
+
+ public Triangle()
+ {
+ no = 0;
+ p = new float[3][2];
+ color = new float[3][3];
+ }
+ }
+
+ protected class MyCanvas extends GLCanvas
+ implements MouseListener, ActionListener
+ {
+ protected GLUTFunc glut = null;
+
+
+ private PopupMenu menu = null;
+ private boolean menu_showing = false;
+
+ int contour_cnt;
+ int triangle_cnt;
+
+ int mode;
+
+ int list_start;
+
+ float edge_color[];
+
+ Contour contours[/*MAX_CONTOURS*/];
+
+ Triangle triangles[/*MAX_TRIANGLES*/];
+
+ TGATextureGrabber textgrab = null;
+
+ boolean doSnapshot=false;
+
+ public MyCanvas(int w, int h) {
+ super(w,h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ public void init() {
+ int i;
+ glut = new GLUTFuncLightImplWithFonts(gl, glu);
+ textgrab = new TGATextureGrabber(gl);
+ contours = new Contour[MAX_CONTOURS];
+ for(i=0; i<MAX_CONTOURS; i++)
+ contours[i] = new Contour();
+ triangles = new Triangle[MAX_TRIANGLES];
+ for(i=0; i<MAX_TRIANGLES; i++)
+ triangles[i] = new Triangle();
+ edge_color = new float[3];
+
+ /* clear background to gray */
+ gl.glClearColor( 0.4f, 0.4f, 0.4f, 0.0f );
+ gl.glShadeModel( GL_FLAT );
+ gl.glPolygonMode( GL_FRONT, GL_FILL );
+
+ contour_cnt = 0;
+ mode = MODE_DEFINE;
+
+ reshape(getSize().width, getSize().height);
+
+ glj.gljCheckGL();
+
+ menu = new PopupMenu("Options");
+ menu.add(MENU_DONE);
+ menu.add(MENU_TESS);
+ menu.add(MENU_CLR);
+ if(!isAnApplet)
+ menu.add(MENU_SNAPSHOT);
+ menu.addActionListener(this);
+ add(menu);
+
+ addMouseListener(this);
+ }
+
+
+ public void error_callback( int err )
+ {
+ String str;
+
+ gl.glColor3f( 0.9f, 0.9f, 0.9f );
+ gl.glRasterPos2i( 5, 5 );
+
+ str = glu.gluErrorString( err );
+
+ glut.glutBitmapString(glut.GLUT_BITMAP_9_BY_15, str);
+ }
+
+ public void begin_callback( int mode )
+ {
+ /* Allow multiple triangles to be output inside the begin/end pair. */
+ triangle_cnt = 0;
+ triangles[triangle_cnt].no = 0;
+ }
+
+ public void edge_callback( boolean flag )
+ {
+ /* Persist the edge flag across triangles. */
+ if ( flag == GL_TRUE )
+ {
+ edge_color[0] = 1.0f;
+ edge_color[1] = 1.0f;
+ edge_color[2] = 0.5f;
+ }
+ else
+ {
+ edge_color[0] = 1.0f;
+ edge_color[1] = 0.0f;
+ edge_color[2] = 0.0f;
+ }
+ }
+
+ public void end_callback()
+ {
+ int i;
+
+ gl.glBegin( GL_LINES );
+
+ /* Output the three edges of each triangle as lines colored
+ according to their edge flag. */
+ for ( i = 0 ; i < triangle_cnt ; i++ )
+ {
+ gl.glColor3f( triangles[i].color[0][0],
+ triangles[i].color[0][1],
+ triangles[i].color[0][2] );
+
+ gl.glVertex2f( triangles[i].p[0][0], triangles[i].p[0][1] );
+ gl.glVertex2f( triangles[i].p[1][0], triangles[i].p[1][1] );
+
+ gl.glColor3f( triangles[i].color[1][0],
+ triangles[i].color[1][1],
+ triangles[i].color[1][2] );
+
+ gl.glVertex2f( triangles[i].p[1][0], triangles[i].p[1][1] );
+ gl.glVertex2f( triangles[i].p[2][0], triangles[i].p[2][1] );
+
+ gl.glColor3f( triangles[i].color[2][0],
+ triangles[i].color[2][1],
+ triangles[i].color[2][2] );
+
+ gl.glVertex2f( triangles[i].p[2][0], triangles[i].p[2][1] );
+ gl.glVertex2f( triangles[i].p[0][0], triangles[i].p[0][1] );
+ }
+
+ gl.glEnd();
+ }
+
+ public void vertex_callback( float[/*2*/] data )
+ {
+ int no;
+
+ no = triangles[triangle_cnt].no;
+
+ triangles[triangle_cnt].p[no][0] = data[0];
+ triangles[triangle_cnt].p[no][1] = data[1];
+
+ triangles[triangle_cnt].color[no][0] = edge_color[0];
+ triangles[triangle_cnt].color[no][1] = edge_color[1];
+ triangles[triangle_cnt].color[no][2] = edge_color[2];
+
+ /* After every three vertices, initialize the next triangle. */
+ if ( ++(triangles[triangle_cnt].no) == 3 )
+ {
+ triangle_cnt++;
+ triangles[triangle_cnt].no = 0;
+ }
+ }
+
+ public void combine_callback( double coords[/*3*/],
+ double vertex_data[/*4xn(=0)*/],
+ float weight[/*4*/], float[/*m(=2)*/] data )
+ {
+ data[0] = (float) coords[0];
+ data[1] = (float) coords[1];
+ }
+
+ public void tesse( )
+ {
+ int tobj;
+ double data[] = new double[3];
+ int i, j, point_cnt;
+
+ list_start = gl.glGenLists( 2 );
+
+ tobj = glu.gluNewTess();
+
+ if ( tobj != 0 )
+ {
+ glu.gluTessCallback ( tobj, GLU_TESS_BEGIN, gl,
+ "glBegin", "(I)V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_VERTEX, gl,
+ "glVertex2fv", "([F)V",
+ 2, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_END, gl,
+ "glEnd", "()V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_ERROR, this,
+ "error_callback", "(I)V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_COMBINE, this,
+ "combine_callback", "([D[D[F[F)V",
+ 2, 0, 0, 2, 0);
+
+ gl.glNewList( list_start, GL_COMPILE );
+ glu.gluBeginPolygon( tobj );
+
+ for ( j = 0 ; j <= contour_cnt ; j++ )
+ {
+ point_cnt = contours[j].point_cnt;
+ glu.gluNextContour( tobj, GLU_UNKNOWN );
+
+ for ( i = 0 ; i < point_cnt ; i++ )
+ {
+ data[0] = (double)( contours[j].p[i][0] );
+ data[1] = (double)( contours[j].p[i][1] );
+ data[2] = 0.0;
+ glu.gluTessVertex( tobj, data, contours[j].p[i] );
+ }
+ }
+
+ glu.gluEndPolygon( tobj );
+ gl.glEndList();
+
+ glu.gluTessCallback ( tobj, GLU_TESS_BEGIN, this,
+ "begin_callback", "(I)V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_VERTEX, this,
+ "vertex_callback", "([F)V",
+ 2, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_END, this,
+ "end_callback", "()V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_EDGE_FLAG, this,
+ "edge_callback", "(Z)V",
+ 0, 0, 0, 0, 0);
+
+ gl.glNewList( list_start + 1, GL_COMPILE );
+ glu.gluBeginPolygon( tobj );
+
+ for ( j = 0 ; j <= contour_cnt ; j++ )
+ {
+ point_cnt = contours[j].point_cnt;
+ glu.gluNextContour( tobj, GLU_UNKNOWN );
+
+ for ( i = 0 ; i < point_cnt ; i++ )
+ {
+ data[0] = (double)( contours[j].p[i][0] );
+ data[1] = (double)( contours[j].p[i][1] );
+ data[2] = 0.0f;
+ glu.gluTessVertex( tobj, data, contours[j].p[i] );
+ }
+ }
+
+ glu.gluEndPolygon( tobj );
+ gl.glEndList();
+
+ glu.gluDeleteTess( tobj );
+ }
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ if(mode != MODE_DEFINE)
+ return;
+
+ int x1 = evt.getX();
+ int y1 = evt.getY();
+ x1 -= x1%10;
+ y1 -= y1%10;
+
+ float[] P = new float[2];
+ int point_cnt;
+
+ /* translate GLUT into GL coordinates */
+
+ P[0] = x1;
+ P[1] = getSize().height -y1;
+
+ point_cnt = contours[contour_cnt].point_cnt;
+
+ contours[contour_cnt].p[point_cnt][0] = P[0];
+ contours[contour_cnt].p[point_cnt][1] = P[1];
+
+ contours[contour_cnt].point_cnt++;
+ repaint();
+ }
+
+ public void donePlaceing()
+ {
+ int point_cnt;
+
+ point_cnt = contours[contour_cnt].point_cnt;
+
+ if ( point_cnt > 2 )
+ {
+ /*
+ gl.glBegin( GL_LINES );
+
+ gl.glVertex2fv( contours[contour_cnt].p[0] );
+ gl.glVertex2fv( contours[contour_cnt].p[point_cnt-1] );
+
+ gl.glEnd();
+ */
+ contours[contour_cnt].p[point_cnt][0] = -1;
+
+ contour_cnt++;
+ contours[contour_cnt].point_cnt = 0;
+ }
+ }
+
+ public void display()
+ {
+
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ int i,j;
+ int point_cnt;
+
+ gl.glClear( GL_COLOR_BUFFER_BIT );
+
+ switch ( mode )
+ {
+ case MODE_DONE:
+ mode=MODE_DEFINE;
+ donePlaceing();
+ repaint();
+ break;
+
+ case MODE_CLR:
+ mode=MODE_DEFINE;
+ clear();
+ repaint();
+ break;
+
+ case MODE_DEFINE:
+ /* draw grid */
+ gl.glColor3f( 0.6f, 0.5f, 0.5f );
+
+ gl.glBegin( GL_LINES );
+
+ int width = getSize().width;
+ int height = getSize().height;
+ for ( i = 0 ; i < width ; i += 10 )
+ {
+ for ( j = 0 ; j < height ; j += 10 )
+ {
+ gl.glVertex2i( 0, j );
+ gl.glVertex2i( width, j );
+ gl.glVertex2i( i, height );
+ gl.glVertex2i( i, 0 );
+ }
+ }
+
+ gl.glEnd( );
+
+ gl.glColor3f( 1.0f, 1.0f, 0.0f );
+
+ for ( i = 0 ; i <= contour_cnt ; i++ )
+ {
+ point_cnt = contours[i].point_cnt;
+
+ gl.glBegin( GL_LINES );
+
+ switch ( point_cnt )
+ {
+ case 0:
+ break;
+ case 1:
+ gl.glVertex2fv( contours[i].p[0] );
+ gl.glVertex2fv( contours[i].p[0] );
+ break;
+ case 2:
+ gl.glVertex2fv( contours[i].p[0] );
+ gl.glVertex2fv( contours[i].p[1] );
+ break;
+ default:
+ --point_cnt;
+ for ( j = 0 ; j < point_cnt ; j++ )
+ {
+ gl.glVertex2fv( contours[i].p[j] );
+ gl.glVertex2fv( contours[i].p[j+1] );
+ }
+ if ( contours[i].p[j+1][0] == -1 )
+ {
+ gl.glVertex2fv( contours[i].p[0] );
+ gl.glVertex2fv( contours[i].p[j] );
+ }
+ break;
+ }
+
+ gl.glEnd();
+ }
+
+ // gl.glFinish();
+ break;
+
+ case MODE_TESSELATE:
+ mode=MODE_TESSELATED;
+ tesse();
+ glj.gljCheckGL();
+ repaint();
+ break;
+
+ case MODE_TESSELATED:
+ /* draw triangles */
+ gl.glColor3f( 0.7f, 0.7f, 0.0f );
+ gl.glCallList( list_start );
+
+ gl.glLineWidth( 2.0f );
+ gl.glCallList( list_start + 1 );
+ gl.glLineWidth( 1.0f );
+
+ // gl.glFlush();
+ glj.gljCheckGL();
+ break;
+ }
+
+ gl.glColor3f( 1.0f, 1.0f, 0.0f );
+
+ if(!isAnApplet && doSnapshot)
+ {
+ doSnapshot=false;
+ textgrab.grabPixels(GL_BACK,
+ 0, 0, cvsGetWidth(), cvsGetHeight());
+ textgrab.write2File("tessdemo.tga");
+ }
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void clear( )
+ {
+ contour_cnt = 0;
+ contours[0].point_cnt = 0;
+ triangle_cnt = 0;
+
+ gl.glDeleteLists( list_start, 2 );
+ list_start = 0;
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glViewport( 0, 0, w, h );
+
+ gl.glMatrixMode( GL_PROJECTION );
+ gl.glLoadIdentity();
+ gl.glOrtho( 0.0, (double)w, 0.0, (double)h, -1.0, 1.0 );
+
+ gl.glMatrixMode( GL_MODELVIEW );
+ gl.glLoadIdentity();
+ }
+
+
+ public String usage( )
+ {
+ return "Use left mouse button to place vertices.\n" +
+ "Select done from the pop-up menu,\n"+
+ "if you are done with placing vertices.\n"+
+ "Select tesselate from the pop-up menu.\n";
+ }
+
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ if (!menu_showing)
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ menu_showing = true;
+ menu.show(this,evt.getX(),evt.getY());
+ }
+ }
+ else
+ {
+ menu_showing = false;
+ }
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ // Method required for the implementation of ActionListener
+ public void actionPerformed(ActionEvent evt)
+ {
+ String c = evt.getActionCommand();
+ if (c.equals(MENU_TESS))
+ {
+ mode=MODE_TESSELATE;
+ }
+ else if (c.equals(MENU_CLR))
+ {
+ mode=MODE_CLR;
+ }
+ else if (c.equals(MENU_DONE))
+ {
+ mode=MODE_DONE;
+ }
+ else if (c.equals(MENU_SNAPSHOT))
+ {
+ doSnapshot=true;
+ }
+ if (menu_showing)
+ {
+ menu_showing = false;
+ }
+ repaint();
+ }
+ }
+}
diff --git a/demos/MiscDemos/tessdemo_plugin13.html b/demos/MiscDemos/tessdemo_plugin13.html
new file mode 100644
index 0000000..27e69b2
--- /dev/null
+++ b/demos/MiscDemos/tessdemo_plugin13.html
@@ -0,0 +1,47 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Right-Mouse Button for a Menu !
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 300 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "tessdemo.class" WIDTH = 500 HEIGHT = 300 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "tessdemo.class" WIDTH = 500 HEIGHT = 300></XMP>
+<PARAM NAME = CODE VALUE = "tessdemo.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "tessdemo.class" WIDTH = 500 HEIGHT = 300>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/tesswind.html b/demos/MiscDemos/tesswind.html
new file mode 100644
index 0000000..cafaf27
--- /dev/null
+++ b/demos/MiscDemos/tesswind.html
@@ -0,0 +1,15 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Right-Mouse Button for a Menu !
+<br>
+<hr>
+<applet code="tesswind.class" width=500 height=500>
+<param name=frames value="55">
+</applet>
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/tesswind.java b/demos/MiscDemos/tesswind.java
new file mode 100755
index 0000000..b25ca42
--- /dev/null
+++ b/demos/MiscDemos/tesswind.java
@@ -0,0 +1,464 @@
+/*
+ * Copyright (c) 1993-1997, Silicon Graphics, Inc.
+ * ALL RIGHTS RESERVED
+ * Permission to use, copy, modify, and distribute this software for
+ * any purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation, and that
+ * the name of Silicon Graphics, Inc. not be used in adverti(float)Math.sing
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.
+ *
+ * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
+ * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
+ * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
+ * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
+ * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
+ * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
+ * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
+ * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
+ * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * US Government Users Restricted Rights
+ * Use, duplication, or disclosure by the Government is subject to
+ * restrictions set forth in FAR 52.227f.19(c)(2) or subparagraph
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
+ * clause at DFARS 252.227f-7013 and/or in similar or successor
+ * clauses in the FAR or the DOD or NASA FAR Supplement.
+ * Unpublished-- rights reserved under the copyright laws of the
+ * United States. Contractor/manufacturer is Silicon Graphics,
+ * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
+ *
+ * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
+ */
+
+/*
+ * tesswind.c
+ * This program demonstrates the winding rule polygon
+ * tessellation property. Four tessellated objects are drawn,
+ * each with very different contours. When the w key is pressed,
+ * the objects are drawn with a different winding rule.
+ */
+import gl4java.utils.glut.*;
+import gl4java.utils.glut.fonts.*;
+import gl4java.utils.textures.*;
+
+import gl4java.awt.*;
+import java.applet.*;
+import java.awt.*;
+import java.awt.Dimension;
+import java.awt.event.*;
+import java.lang.*;
+import java.util.*;
+import gl4java.*;
+
+public class tesswind extends Applet {
+
+ MyCanvas canvas = null;
+ boolean isAnApplet = true;
+
+ public void init()
+ {
+ Dimension d = getSize();
+ setLayout(new BorderLayout());
+ canvas = new MyCanvas (d.width, d.height);
+ add("Center", canvas);
+ }
+
+ public static void main( String args[] )
+ {
+ Frame mainFrame = new Frame("tessdemo");
+
+ tesswind applet = new tesswind();
+ applet.isAnApplet = false;
+
+ applet.setSize(400, 400);
+ applet.init();
+ applet.start();
+
+ mainFrame.add(applet);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+
+ public void start()
+ {
+ }
+
+
+ public void stop()
+ {
+ }
+
+ static final String MENU_1 = "Odd Winding";
+ static final String MENU_2 = "Nonzero Winding";
+ static final String MENU_3 = "Positive Winding";
+ static final String MENU_4 = "Negative Winding";
+ static final String MENU_5 = "ABS >= 2 Winding";
+ static final String MENU_SNAPSHOT = "Snapshot";
+
+ public static double rects[/*12*/][/*3*/] =
+ { { 50.0, 50.0, 0.0},
+ { 300.0, 50.0, 0.0},
+ { 300.0, 300.0, 0.0},
+ { 50.0, 300.0, 0.0},
+ { 100.0, 100.0, 0.0},
+ { 250.0, 100.0, 0.0},
+ { 250.0, 250.0, 0.0},
+ { 100.0, 250.0, 0.0},
+ { 150.0, 150.0, 0.0},
+ { 200.0, 150.0, 0.0},
+ { 200.0, 200.0, 0.0},
+ { 150.0, 200.0, 0.0} };
+
+ public static double spiral[/*16*/][/*3*/] =
+ { { 400.0, 250.0, 0.0},
+ { 400.0, 50.0, 0.0},
+ { 50.0, 50.0, 0.0},
+ { 50.0, 400.0, 0.0},
+ { 350.0, 400.0, 0.0},
+ { 350.0, 100.0, 0.0},
+ { 100.0, 100.0, 0.0},
+ { 100.0, 350.0, 0.0},
+ { 300.0, 350.0, 0.0},
+ { 300.0, 150.0, 0.0},
+ { 150.0, 150.0, 0.0},
+ { 150.0, 300.0, 0.0},
+ { 250.0, 300.0, 0.0},
+ { 250.0, 200.0, 0.0},
+ { 200.0, 200.0, 0.0},
+ { 200.0, 250.0, 0.0} };
+
+ public static double quad1[/*4*/][/*3*/] =
+ { {50.0, 150.0, 0.0},
+ {350.0, 150.0, 0.0},
+ {350.0, 200.0, 0.0},
+ {50.0, 200.0, 0.0} };
+
+ public static double quad2[/*4*/][/*3*/] =
+ { {100.0, 100.0, 0.0},
+ {300.0, 100.0, 0.0},
+ {300.0, 350.0, 0.0},
+ {100.0, 350.0, 0.0} };
+
+ public static double tri[/*3*/][/*3*/] =
+ { {200.0, 50.0, 0.0},
+ {250.0, 300.0, 0.0},
+ {150.0, 300.0, 0.0} };
+
+ protected class MyCanvas extends GLCanvas
+ implements MouseListener, ActionListener
+ {
+ protected GLUTFunc glut = null;
+
+ boolean exit = false;
+ boolean mkNewLists = false;
+
+ int startList=-1;
+
+ private PopupMenu menu = null;
+ private boolean menu_showing = false;
+
+ TGATextureGrabber textgrab = null;
+
+ boolean doSnapshot=false;
+
+ public MyCanvas(int w, int h) {
+ super(w,h);
+ GLContext.gljNativeDebug = false;
+ GLContext.gljClassDebug = false;
+ }
+
+ double currentWinding = GLU_TESS_WINDING_ODD;
+ int currentShape = 0;
+ int tobj;
+ int list;
+
+ public void init() {
+ int i;
+ glut = new GLUTFuncLightImplWithFonts(gl, glu);
+
+ textgrab = new TGATextureGrabber(gl);
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glShadeModel(GL_FLAT);
+
+ tobj = glu.gluNewTess();
+
+ glu.gluTessCallback ( tobj, GLU_TESS_VERTEX, gl,
+ "glVertex3dv", "([D)V",
+ 3, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_BEGIN, this,
+ "beginCallback", "(I)V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_END, this,
+ "endCallback", "()V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_ERROR, this,
+ "errorCallback", "(I)V",
+ 0, 0, 0, 0, 0);
+ glu.gluTessCallback ( tobj, GLU_TESS_COMBINE, this,
+ "combineCallback", "([D[D[F[D)V",
+ 3, 0, 0, 3, 0);
+
+
+ list = gl.glGenLists(4);
+ makeNewLists();
+
+ reshape(getSize().width, getSize().height);
+
+ glj.gljCheckGL();
+
+ menu = new PopupMenu("Options");
+ menu.add(MENU_1);
+ menu.add(MENU_2);
+ menu.add(MENU_3);
+ menu.add(MENU_4);
+ menu.add(MENU_5);
+ if(!isAnApplet)
+ menu.add(MENU_SNAPSHOT);
+ menu.addActionListener(this);
+ add(menu);
+ addMouseListener(this);
+ }
+
+
+ /* Make four display lists,
+ * each with a different tessellated object.
+ */
+ void makeNewLists ()
+ {
+ int i;
+ glu.gluTessProperty(tobj, GLU_TESS_WINDING_RULE,
+ currentWinding);
+
+ gl.glNewList(list, GL_COMPILE);
+ glu.gluTessBeginPolygon(tobj, (double[])null);
+ glu.gluTessBeginContour(tobj);
+ for (i = 0; i < 4; i++)
+ glu.gluTessVertex(tobj, rects[i], rects[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessBeginContour(tobj);
+ for (i = 4; i < 8; i++)
+ glu.gluTessVertex(tobj, rects[i], rects[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessBeginContour(tobj);
+ for (i = 8; i < 12; i++)
+ glu.gluTessVertex(tobj, rects[i], rects[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessEndPolygon(tobj);
+ gl.glEndList();
+
+ gl.glNewList(list+1, GL_COMPILE);
+ glu.gluTessBeginPolygon(tobj, (double[])null);
+ glu.gluTessBeginContour(tobj);
+ for (i = 0; i < 4; i++)
+ glu.gluTessVertex(tobj, rects[i], rects[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessBeginContour(tobj);
+ for (i = 7; i >= 4; i--)
+ glu.gluTessVertex(tobj, rects[i], rects[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessBeginContour(tobj);
+ for (i = 11; i >= 8; i--)
+ glu.gluTessVertex(tobj, rects[i], rects[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessEndPolygon(tobj);
+ gl.glEndList();
+
+ gl.glNewList(list+2, GL_COMPILE);
+ glu.gluTessBeginPolygon(tobj, (double[])null);
+ glu.gluTessBeginContour(tobj);
+ for (i = 0; i < 16; i++)
+ glu.gluTessVertex(tobj, spiral[i], spiral[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessEndPolygon(tobj);
+ gl.glEndList();
+
+ gl.glNewList(list+3, GL_COMPILE);
+ glu.gluTessBeginPolygon(tobj, (double[])null);
+ glu.gluTessBeginContour(tobj);
+ for (i = 0; i < 4; i++)
+ glu.gluTessVertex(tobj, quad1[i], quad1[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessBeginContour(tobj);
+ for (i = 0; i < 4; i++)
+ glu.gluTessVertex(tobj, quad2[i], quad2[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessBeginContour(tobj);
+ for (i = 0; i < 3; i++)
+ glu.gluTessVertex(tobj, tri[i], tri[i]);
+ glu.gluTessEndContour(tobj);
+ glu.gluTessEndPolygon(tobj);
+ gl.glEndList();
+ }
+
+ public void display()
+ {
+
+ if(exit) return;
+
+ /* Standard GL4Java Init */
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
+ if(mkNewLists)
+ {
+ makeNewLists();
+ mkNewLists = false;
+ }
+
+ gl.glClear(GL_COLOR_BUFFER_BIT);
+ gl.glColor3f(1.0f, 1.0f, 1.0f);
+ gl.glPushMatrix();
+ gl.glCallList(list);
+ gl.glTranslatef(0.0f, 500.0f, 0.0f);
+ gl.glCallList(list+1);
+ gl.glTranslatef(500.0f, -500.0f, 0.0f);
+ gl.glCallList(list+2);
+ gl.glTranslatef(0.0f, 500.0f, 0.0f);
+ gl.glCallList(list+3);
+ gl.glPopMatrix();
+
+ if(!isAnApplet && doSnapshot)
+ {
+ doSnapshot=false;
+ textgrab.grabPixels(GL_BACK,
+ 0, 0, cvsGetWidth(), cvsGetHeight());
+ textgrab.write2File("tesswind.tga");
+ }
+
+ /* For your animation dutys ;-) */
+ glj.gljSwap();
+ glj.gljCheckGL();
+ glj.gljFree();
+ }
+
+ public void beginCallback(int which)
+ {
+ gl.glBegin(which);
+ }
+
+ public void errorCallback(int errorCode)
+ {
+ String str;
+
+ gl.glColor3f( 0.9f, 0.9f, 0.9f );
+ gl.glRasterPos2i( 5, 5 );
+
+ str = glu.gluErrorString( errorCode );
+
+ glut.glutBitmapString(glut.GLUT_BITMAP_9_BY_15, str);
+ exit = true;
+ }
+
+ public void endCallback()
+ {
+ gl.glEnd();
+ }
+
+ /* combineCallback is used to create a new vertex when edges
+ * intersect. coordinate location is trivial to calculate,
+ * but weight[4] may be used to average color, normal, or texture
+ * coordinate data.
+ */
+ /* ARGSUSED */
+ public void combineCallback(double coords[/*3*/], double data[/*4xn*/],
+ float weight[/*4*/], double[/*3*/] dataOut )
+ {
+ dataOut[0] = coords[0];
+ dataOut[1] = coords[1];
+ dataOut[2] = coords[2];
+ }
+
+ public void reshape(int w, int h)
+ {
+ gl.glViewport( 0, 0, w, h );
+
+ gl.glMatrixMode( GL_PROJECTION );
+ gl.glLoadIdentity();
+ if (w <= h)
+ glu.gluOrtho2D(0.0f, 1000.0f, 0.0f, 1000.0f * (double)h/(double)w);
+ else
+ glu.gluOrtho2D(0.0f, 1000.0f * (double)w/(double)h, 0.0f, 1000.0f);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glLoadIdentity();
+ }
+
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(MouseEvent evt)
+ {
+ if (!menu_showing)
+ {
+ if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0)
+ {
+ menu_showing = true;
+ menu.show(this,evt.getX(),evt.getY());
+ }
+ }
+ else
+ {
+ menu_showing = false;
+ }
+ }
+
+ public void mouseClicked(MouseEvent evt)
+ {
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ }
+
+ // Method required for the implementation of ActionListener
+ public void actionPerformed(ActionEvent evt)
+ {
+ String c = evt.getActionCommand();
+ if (c.equals(MENU_1))
+ {
+ currentWinding = GLU_TESS_WINDING_ODD;
+ }
+ else if (c.equals(MENU_2))
+ {
+ currentWinding = GLU_TESS_WINDING_NONZERO;
+ }
+ else if (c.equals(MENU_3))
+ {
+ currentWinding = GLU_TESS_WINDING_POSITIVE;
+ }
+ else if (c.equals(MENU_4))
+ {
+ currentWinding = GLU_TESS_WINDING_NEGATIVE;
+ }
+ else if (c.equals(MENU_5))
+ {
+ currentWinding = GLU_TESS_WINDING_ABS_GEQ_TWO;
+ }
+ else if (c.equals(MENU_SNAPSHOT))
+ {
+ doSnapshot=true;
+ }
+ if (menu_showing)
+ {
+ menu_showing = false;
+ }
+ mkNewLists = true;
+ repaint();
+ }
+ }
+}
diff --git a/demos/MiscDemos/tesswind_plugin13.html b/demos/MiscDemos/tesswind_plugin13.html
new file mode 100644
index 0000000..0786232
--- /dev/null
+++ b/demos/MiscDemos/tesswind_plugin13.html
@@ -0,0 +1,47 @@
+<HTML>
+<HEAD>
+<TITLE>G&ouml;thel Hard- und Software Entwicklungen</TITLE>
+</HEAD>
+<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff">
+Press the Right-Mouse Button for a Menu !
+<br>
+<hr>
+<!--"CONVERTED_APPLET"-->
+<!-- CONVERTER VERSION 1.3 -->
+<SCRIPT LANGUAGE="JavaScript"><!--
+ var _info = navigator.userAgent; var _ns = false;
+ var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
+//--></SCRIPT>
+<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
+ var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
+//--></SCRIPT></COMMENT>
+
+<SCRIPT LANGUAGE="JavaScript"><!--
+ if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 500 HEIGHT = 500 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"><NOEMBED><XMP>');
+ else if (_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.3" CODE = "tesswind.class" WIDTH = 500 HEIGHT = 500 frames = "55" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED><XMP>');
+//--></SCRIPT>
+<APPLET CODE = "tesswind.class" WIDTH = 500 HEIGHT = 500></XMP>
+<PARAM NAME = CODE VALUE = "tesswind.class" >
+
+<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
+<PARAM NAME="scriptable" VALUE="false">
+<PARAM NAME = frames VALUE ="55">
+
+</APPLET>
+
+</NOEMBED></EMBED></OBJECT>
+
+
+<!--
+<APPLET CODE = "tesswind.class" WIDTH = 500 HEIGHT = 500>
+<PARAM NAME = frames VALUE ="55">
+
+
+</APPLET>
+-->
+<!--"END_CONVERTED_APPLET"-->
+
+<hr>
+</BODY>
+</HTML>
+
diff --git a/demos/MiscDemos/tex/DAISYX.png b/demos/MiscDemos/tex/DAISYX.png
new file mode 100644
index 0000000..4892a0b
--- /dev/null
+++ b/demos/MiscDemos/tex/DAISYX.png
Binary files differ
diff --git a/demos/MiscDemos/tex/a.tga b/demos/MiscDemos/tex/a.tga
new file mode 100644
index 0000000..2bbd4d5
--- /dev/null
+++ b/demos/MiscDemos/tex/a.tga
Binary files differ
diff --git a/demos/MiscDemos/tex/gleeson_head.jpg b/demos/MiscDemos/tex/gleeson_head.jpg
new file mode 100644
index 0000000..354cd2f
--- /dev/null
+++ b/demos/MiscDemos/tex/gleeson_head.jpg
Binary files differ
diff --git a/demos/MiscDemos/tex/gnu-head-sm.png b/demos/MiscDemos/tex/gnu-head-sm.png
new file mode 100755
index 0000000..fc91ff9
--- /dev/null
+++ b/demos/MiscDemos/tex/gnu-head-sm.png
Binary files differ
diff --git a/demos/MiscDemos/tex/jaulogo-300x80.png b/demos/MiscDemos/tex/jaulogo-300x80.png
new file mode 100755
index 0000000..4ed48f3
--- /dev/null
+++ b/demos/MiscDemos/tex/jaulogo-300x80.png
Binary files differ