aboutsummaryrefslogtreecommitdiffstats
path: root/demos/SwingDemos/CrossColorJPanel.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2000-11-18 06:43:49 +0000
committerSven Gothel <[email protected]>2000-11-18 06:43:49 +0000
commit880653d31a8f1ff8384fdbc75b84934bceecfdb8 (patch)
treebdafb71416f176d2a4b73bf716c9dc3f13685a8b /demos/SwingDemos/CrossColorJPanel.java
Initial revision
Diffstat (limited to 'demos/SwingDemos/CrossColorJPanel.java')
-rw-r--r--demos/SwingDemos/CrossColorJPanel.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/demos/SwingDemos/CrossColorJPanel.java b/demos/SwingDemos/CrossColorJPanel.java
new file mode 100644
index 0000000..44a6492
--- /dev/null
+++ b/demos/SwingDemos/CrossColorJPanel.java
@@ -0,0 +1,55 @@
+import java.awt.*;
+import javax.swing.*;
+import gl4java.*;
+import gl4java.swing.*;
+
+public class CrossColorJPanel extends GLJPanel
+{
+ public CrossColorJPanel( )
+ {
+ super();
+ }
+
+
+ public void init() {
+ reshape(getSize().width, getSize().height);
+ }
+
+ public void display()
+ {
+ System.out.println("i");
+ int i;
+
+ 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();
+ }
+
+ 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);
+ }
+}