diff options
Diffstat (limited to 'demos')
67 files changed, 489 insertions, 247 deletions
diff --git a/demos/GLLandScape/GLLandScape1.java b/demos/GLLandScape/GLLandScape1.java index 209f6db..25ed9cf 100644 --- a/demos/GLLandScape/GLLandScape1.java +++ b/demos/GLLandScape/GLLandScape1.java @@ -577,6 +577,7 @@ class GLLandScape1 extends GLAnimCanvas gl.glEnable(GL_TEXTURE_2D); texture_mapping = TRUE; glj.gljCheckGL(); + glj.gljFree(); repaint(); } } @@ -595,6 +596,7 @@ class GLLandScape1 extends GLAnimCanvas gl.glDisable(GL_TEXTURE_2D); texture_mapping = FALSE; glj.gljCheckGL(); + glj.gljFree(); repaint(); } } @@ -623,6 +625,7 @@ class GLLandScape1 extends GLAnimCanvas gl.glEnable(GL_FOG); land_fogging = TRUE; glj.gljCheckGL(); + glj.gljFree(); repaint(); } } @@ -641,6 +644,7 @@ class GLLandScape1 extends GLAnimCanvas gl.glDisable(GL_FOG); land_fogging = FALSE; glj.gljCheckGL(); + glj.gljFree(); repaint(); } } @@ -669,6 +673,7 @@ class GLLandScape1 extends GLAnimCanvas gl.glShadeModel(GL_FLAT); flat_shading = TRUE; glj.gljCheckGL(); + glj.gljFree(); repaint(); } } @@ -687,6 +692,7 @@ class GLLandScape1 extends GLAnimCanvas gl.glShadeModel(GL_SMOOTH); flat_shading = FALSE; glj.gljCheckGL(); + glj.gljFree(); repaint(); } } @@ -706,6 +712,7 @@ class GLLandScape1 extends GLAnimCanvas gl.glDeleteLists(theLand, 1); genLand(); check_height(); + glj.gljFree(); repaint(); setSuspended(false); } diff --git a/demos/GLLandScape/GLLandScape1w1.java b/demos/GLLandScape/GLLandScape1w1.java index 9f6f1a3..cef739a 100644 --- a/demos/GLLandScape/GLLandScape1w1.java +++ b/demos/GLLandScape/GLLandScape1w1.java @@ -187,7 +187,7 @@ class GLLandScape1w1 extends GLAnimCanvas Dimension dim = getSize(); reshape(dim.width,dim.height); - myMove(FORWARD,mySpeed,true,false); + myMove(FORWARD,mySpeed,true); check_height(); repaint(); /* and start our working thread ... */ @@ -216,7 +216,7 @@ class GLLandScape1w1 extends GLAnimCanvas if(flat_shading == FALSE) gl.glShadeModel(GL_SMOOTH); - myMove(FORWARD,mySpeed,true,false); + myMove(FORWARD,mySpeed,true); check_height(); @@ -247,7 +247,6 @@ class GLLandScape1w1 extends GLAnimCanvas planes[i].theta = ((float)(random.nextInt() % 257))*0.1111f; planes[i].tick(); - if (isSuspended()) repaint(); System.out.println("plane added"); return; } @@ -261,7 +260,6 @@ class GLLandScape1w1 extends GLAnimCanvas if (planes[i].speed != 0.0f) { planes[i].speed = 0.0f; - if (isSuspended()) repaint(); System.out.println("plane removed"); return; } @@ -432,7 +430,7 @@ class GLLandScape1w1 extends GLAnimCanvas /* Function that moves the eye / turns the angle of sight. */ /* Updates scene if update. */ - void myMove(int dir, float amount, boolean update, boolean fetchGLContext) + void myMove(int dir, float amount, boolean update) { float diff = (float)Math.sqrt(lookx * lookx + lookz * lookz); /* @@ -448,7 +446,6 @@ class GLLandScape1w1 extends GLAnimCanvas alpha+=(float)((3.0*Math.PI)/2.0); float _alpha = (float) (alpha*180f/Math.PI ); */ - boolean do_repaint = false; lookx /= diff; lookz /= diff; //myDir=dir; @@ -464,7 +461,6 @@ class GLLandScape1w1 extends GLAnimCanvas // lookx^2 + lookz^2 != 1 for some reason. Fix. lookx /= diff; lookz /= diff; - do_repaint = true; break; case STRAFELEFT: posx += lookz * amount; @@ -472,15 +468,12 @@ class GLLandScape1w1 extends GLAnimCanvas break; case UP: posy += amount; - do_repaint = true; break; case LOOKUP: looky += amount; - do_repaint = true; break; case LOOKSET: looky = amount; - do_repaint = true; break; } int x = (int)(posx / (comp * 1.0f)); @@ -495,21 +488,10 @@ class GLLandScape1w1 extends GLAnimCanvas posz = MAP * comp; if (update) { - if(fetchGLContext && glj.gljMakeCurrent() == false) - { - System.out.println("problem in use() method"); - return; - } gl.glMatrixMode(GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt(posx,posy,posz, posx+lookx, posy+looky, posz+lookz, 0.0f,1.0f,0.0f); - - if(fetchGLContext) - glj.gljFree(); - - if( do_repaint ) - repaint(); } } @@ -603,7 +585,6 @@ class GLLandScape1w1 extends GLAnimCanvas public void reshape(int w, int h) { - glj.gljResize(w,h); gl.glViewport(0,0,w,h); gl.glMatrixMode(GL_PROJECTION); gl.glLoadIdentity(); @@ -644,7 +625,7 @@ class GLLandScape1w1 extends GLAnimCanvas gl.glEnable(GL_TEXTURE_2D); texture_mapping = TRUE; glj.gljCheckGL(); - repaint(); + glj.gljFree(); } } } @@ -662,7 +643,7 @@ class GLLandScape1w1 extends GLAnimCanvas gl.glDisable(GL_TEXTURE_2D); texture_mapping = FALSE; glj.gljCheckGL(); - repaint(); + glj.gljFree(); } } } @@ -690,7 +671,7 @@ class GLLandScape1w1 extends GLAnimCanvas gl.glEnable(GL_FOG); land_fogging = TRUE; glj.gljCheckGL(); - repaint(); + glj.gljFree(); } } } @@ -708,7 +689,7 @@ class GLLandScape1w1 extends GLAnimCanvas gl.glDisable(GL_FOG); land_fogging = FALSE; glj.gljCheckGL(); - repaint(); + glj.gljFree(); } } } @@ -736,7 +717,7 @@ class GLLandScape1w1 extends GLAnimCanvas gl.glShadeModel(GL_FLAT); flat_shading = TRUE; glj.gljCheckGL(); - repaint(); + glj.gljFree(); } } } @@ -754,7 +735,7 @@ class GLLandScape1w1 extends GLAnimCanvas gl.glShadeModel(GL_SMOOTH); flat_shading = FALSE; glj.gljCheckGL(); - repaint(); + glj.gljFree(); } } } @@ -773,9 +754,26 @@ class GLLandScape1w1 extends GLAnimCanvas gl.glDeleteLists(theLand, 1); genLand(); check_height(); - repaint(); setSuspended(false); + glj.gljFree(); } + public String getGLString(int id) + { + String result = "null"; + if(glj!=null) + { + if(glj.gljMakeCurrent() == false) + { + System.out.println("problem in use() method"); + return result; + } + result = gl.glGetString(id); + glj.gljCheckGL(); + glj.gljFree(); + } + + return result; + } } diff --git a/demos/GLLandScape/GLLandScape1w1Applet.java b/demos/GLLandScape/GLLandScape1w1Applet.java index 90da5f3..ea55f7f 100755 --- a/demos/GLLandScape/GLLandScape1w1Applet.java +++ b/demos/GLLandScape/GLLandScape1w1Applet.java @@ -1,13 +1,14 @@ import gl4java.GLContext; +import gl4java.GLFunc; import java.awt.*; import java.applet.*; import java.awt.event.*; public class GLLandScape1w1Applet extends Applet - implements MouseListener, KeyListener, ActionListener + implements MouseListener, KeyListener, ActionListener, ItemListener { - GLLandScape1w1 landScape = null; + public GLLandScape1w1 landScape = null; Button bAddPlane = null; Button bRemPlane = null; @@ -19,10 +20,16 @@ public class GLLandScape1w1Applet extends Applet Button bFps; TextField tFps; + Checkbox bUseRepaint = null; + Checkbox bUseFpsSleep = null; + boolean gameOn = true; SpeedTimer tMySpeed = null; + GLThread gt1 = null; + GLThread gt2 = null; + public void init() { init(0,0); @@ -51,13 +58,21 @@ public class GLLandScape1w1Applet extends Applet add("East", glFeatures); Panel pFps = new Panel(); - pFps.setLayout(new GridLayout(1,3)); + pFps.setLayout(new GridLayout(1,5)); pFps.add(bInfo =new Button("info")); pFps.add(bFps =new Button("get fps")); pFps.add(tFps =new TextField()); bInfo.addMouseListener(this); bFps.addMouseListener(this); tFps.addActionListener(this); + + bUseRepaint = new Checkbox("repaint", true); + bUseRepaint.addItemListener(this); + pFps.add(bUseRepaint); + bUseFpsSleep = new Checkbox("fps-sleep", true); + bUseFpsSleep.addItemListener(this); + pFps.add(bUseFpsSleep); + add("South", pFps); if(w==0 && h==0) @@ -79,9 +94,16 @@ public class GLLandScape1w1Applet extends Applet add("Center", landScape); } + public void startTestThreads() + { + gt1 = new GLThread(landScape, GLFunc.GL_VENDOR, "gt1"); + gt2 = new GLThread(landScape, GLFunc.GL_VERSION, "gt2"); + gt1.start(); + gt2.start(); + } + public void destroy() { - landScape.stop(); landScape.cvsDispose(); landScape.removeMouseListener(this); landScape.removeKeyListener(this); @@ -114,6 +136,7 @@ public class GLLandScape1w1Applet extends Applet gljLib + ", " + glLib + ", " + gluLib); GLContext.gljNativeDebug = false; + GLContext.gljThreadDebug = false; GLContext.gljClassDebug = false; GLLandScape1w1Applet window = @@ -141,12 +164,39 @@ public class GLLandScape1w1Applet extends Applet Dimension ps = window.getPreferredSize(); f.setBounds(-100,-100,99,99); f.setVisible(true); - f.setVisible(false); + //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); + + // ThreadTest + // window.startTestThreads(); + } + + public void itemStateChanged( ItemEvent evt ) + { + ItemSelectable comp = evt.getItemSelectable(); + + if( comp.equals(bUseRepaint) ) + { + if(landScape!=null) + { + landScape.setUseRepaint(bUseRepaint.getState()); + System.out.println("LandScape uses repaint: "+ + bUseRepaint.getState()); + } + } + else if( comp.equals(bUseFpsSleep ) ) + { + if(landScape!=null) + { + landScape.setUseFpsSleep(bUseFpsSleep.getState()); + System.out.println("LandScape uses fps-sleep: "+ + bUseFpsSleep.getState()); + } + } } // Methods required for the implementation of MouseListener @@ -215,12 +265,12 @@ public class GLLandScape1w1Applet extends Applet { if ( key==KeyEvent.VK_LEFT ) { - landScape.myMove(landScape.TURNLEFT, 0.1f, true, true); + landScape.myMove(landScape.TURNLEFT, 0.1f, false); tMySpeed.start(); } else if ( key==KeyEvent.VK_RIGHT ) { - landScape.myMove(landScape.TURNLEFT, -0.1f, true, true); + landScape.myMove(landScape.TURNLEFT, -0.1f, false); tMySpeed.start(); } else if ( key==KeyEvent.VK_UP ) @@ -241,24 +291,24 @@ public class GLLandScape1w1Applet extends Applet float v = tMySpeed.getSpeed(); if ( e.isShiftDown() ) - tMySpeed.setSpeed(v/2.0f); + tMySpeed.setSpeed(v-2.0f); else tMySpeed.setSpeed(v-1.0f); tMySpeed.start(); } else if ( key==KeyEvent.VK_PAGE_UP ) { - landScape.myMove(landScape.LOOKUP, 0.1f, true,true); + landScape.myMove(landScape.LOOKUP, 0.1f, false); tMySpeed.start(); } else if ( key==KeyEvent.VK_PAGE_DOWN ) { - landScape.myMove(landScape.LOOKUP, -0.1f, true,true); + landScape.myMove(landScape.LOOKUP, -0.1f, false); tMySpeed.start(); } else if ( key==KeyEvent.VK_END ) { - landScape.myMove(landScape.LOOKSET, 0f, true,true); + landScape.myMove(landScape.LOOKSET, 0f, false); tMySpeed.start(); } } @@ -306,7 +356,7 @@ public class GLLandScape1w1Applet extends Applet class SpeedTimer implements Runnable { protected Thread me = null; - protected boolean to=false, started=false; + protected boolean to=false; protected int _t; protected float speed = 0.0f; @@ -315,53 +365,130 @@ public class GLLandScape1w1Applet extends Applet public SpeedTimer(GLLandScape1w1 ls, int t) { _ls=ls; _t=t; } - public void start() + public synchronized void start() { - if(me!=null) stop(); - to=false; - started=true; + if(me!=null && to) return; + + stop(); me = new Thread(this); me.start(); } - public void stop() { + public synchronized void stop() { if(me!=null) { - me.stop(); me=null; - started=false; - to=false; + + notifyAll(); + + while(to) { + try { + wait(); + } catch (Exception e) {} + } } } public void run() { if(me!=null) { - try {me.sleep(_t,0);} catch (InterruptedException e){} - to=true; - while(speed>1.0f) + synchronized (this) { + to=true; + notifyAll(); + } + while(me!=null && (-0.2f>=speed || speed>=0.2f) ) { + try {me.sleep(_t,0);} catch (InterruptedException e){} speed/=2.0f; _ls.setMySpeed(speed); - try {me.sleep(_t,0);} catch (InterruptedException e){} + // System.out.println("timer: lower speed: "+speed); } speed = 0.0f; _ls.setMySpeed(0f); + + synchronized (this) { + to=false; + notifyAll(); + } } } public boolean isActive() { return to; } - public boolean isStarted() { return started; } public float getSpeed() { return speed; } public void setSpeed(float v) { speed=v; _ls.setMySpeed(speed); + //System.out.println("timer: set speed: "+speed); } } + class GLThread implements Runnable { + protected Thread me = null; + protected boolean to=false; + protected int _id; + protected String _name; + + protected GLLandScape1w1 _ls; + + public GLThread(GLLandScape1w1 ls, int id, String name) + { _ls=ls; _id=id; _name=name;} + + public synchronized void start() + { + if(me!=null && to) return; + + stop(); + + me = new Thread(this, _name); + me.start(); + } + + public synchronized void stop() { + if(me!=null) + { + me=null; + + notifyAll(); + + while(to) { + try { + wait(); + } catch (Exception e) {} + } + } + } + + public void run() { + if(me!=null) + { + synchronized (this) { + to=true; + notifyAll(); + } + while(me!=null) + { + if(_ls.cvsIsInit()) + { + if(GLContext.gljThreadDebug) + _ls.getGLString(_id); + else + System.out.println("gt: "+_ls.getGLString(_id)); + } + } + + synchronized (this) { + to=false; + notifyAll(); + } + } + } + + public boolean isActive() { return to; } + } + class InfoWin extends Frame implements ActionListener { diff --git a/demos/HodglimsNeHe/Lesson1.java b/demos/HodglimsNeHe/Lesson1.java index fb05de2..b1e883b 100644 --- a/demos/HodglimsNeHe/Lesson1.java +++ b/demos/HodglimsNeHe/Lesson1.java @@ -197,6 +197,7 @@ public class Lesson1 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/Lesson11.java b/demos/HodglimsNeHe/Lesson11.java index ad566ee..265a2d2 100644 --- a/demos/HodglimsNeHe/Lesson11.java +++ b/demos/HodglimsNeHe/Lesson11.java @@ -318,6 +318,7 @@ public class Lesson11 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/Lesson12.java b/demos/HodglimsNeHe/Lesson12.java index 86a9f02..5de7084 100644 --- a/demos/HodglimsNeHe/Lesson12.java +++ b/demos/HodglimsNeHe/Lesson12.java @@ -346,6 +346,7 @@ public class Lesson12 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/Lesson16.java b/demos/HodglimsNeHe/Lesson16.java index 82fa7b7..0d7d125 100644 --- a/demos/HodglimsNeHe/Lesson16.java +++ b/demos/HodglimsNeHe/Lesson16.java @@ -373,6 +373,7 @@ public class Lesson16 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
@@ -393,6 +394,10 @@ public class Lesson16 extends Applet */
public void keyPressed(KeyEvent e)
{
+ //Ensure GL is initialised correctly
+ if (glj.gljMakeCurrent(true) == false)
+ return;
+
switch(e.getKeyCode())
{
//Switch ON/OFF light when L is pressed
@@ -487,6 +492,8 @@ public class Lesson16 extends Applet break;
}
}
+ glj.gljFree();
+
}
diff --git a/demos/HodglimsNeHe/Lesson18.java b/demos/HodglimsNeHe/Lesson18.java index b63a627..98bc1cc 100644 --- a/demos/HodglimsNeHe/Lesson18.java +++ b/demos/HodglimsNeHe/Lesson18.java @@ -107,7 +107,7 @@ public class Lesson18 extends Applet int part2; // End Of Disc
int p1=0; // Increase 1
int p2=1; // Increase 2
- int quadratic; // Storage For Our Quadratic Objects
+ long quadratic; // Storage For Our Quadratic Objects
int object=0; // Which Object To Draw
public renderCanvas(int w, int h) {
@@ -278,7 +278,11 @@ public class Lesson18 extends Applet }
public void display() {
- //Clear The Screen And The Depth Buffer
+ //Ensure GL is initialised correctly
+ if (glj.gljMakeCurrent(true) == false)
+ return;
+
+//Clear The Screen And The Depth Buffer
gl.glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
//Reset The View
gl.glLoadIdentity();
@@ -332,12 +336,17 @@ public class Lesson18 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
public void keyTyped(KeyEvent e) {
//We are not handling any keyboard events yet
}
public void keyPressed(KeyEvent e) {
+ //Ensure GL is initialised correctly
+ if (glj.gljMakeCurrent(true) == false)
+ return;
+
switch(e.getKeyCode()) {
//Switch ON/OFF light when L is pressed
case KeyEvent.VK_L:
@@ -398,6 +407,8 @@ public class Lesson18 extends Applet }
break;
}
+ glj.gljFree();
+
}
public void keyReleased(KeyEvent e) {
switch(e.getKeyCode()) {
diff --git a/demos/HodglimsNeHe/Lesson2.java b/demos/HodglimsNeHe/Lesson2.java index 8f6eb2c..12fa7bd 100644 --- a/demos/HodglimsNeHe/Lesson2.java +++ b/demos/HodglimsNeHe/Lesson2.java @@ -216,6 +216,7 @@ public class Lesson2 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/Lesson3.java b/demos/HodglimsNeHe/Lesson3.java index b5e3377..d4ac6ea 100644 --- a/demos/HodglimsNeHe/Lesson3.java +++ b/demos/HodglimsNeHe/Lesson3.java @@ -220,6 +220,7 @@ public class Lesson3 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/Lesson4.java b/demos/HodglimsNeHe/Lesson4.java index ada7dd5..270b08b 100644 --- a/demos/HodglimsNeHe/Lesson4.java +++ b/demos/HodglimsNeHe/Lesson4.java @@ -240,6 +240,7 @@ public class Lesson4 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/Lesson5.java b/demos/HodglimsNeHe/Lesson5.java index 026ecb3..25b565d 100644 --- a/demos/HodglimsNeHe/Lesson5.java +++ b/demos/HodglimsNeHe/Lesson5.java @@ -291,6 +291,7 @@ public class Lesson5 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/Lesson6.java b/demos/HodglimsNeHe/Lesson6.java index ae85d76..129a44b 100644 --- a/demos/HodglimsNeHe/Lesson6.java +++ b/demos/HodglimsNeHe/Lesson6.java @@ -293,6 +293,7 @@ public class Lesson6 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/Lesson7.java b/demos/HodglimsNeHe/Lesson7.java index d6f65f4..a19a016 100644 --- a/demos/HodglimsNeHe/Lesson7.java +++ b/demos/HodglimsNeHe/Lesson7.java @@ -351,6 +351,7 @@ public class Lesson7 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
// Methods required for the implementation of MouseListener
@@ -396,6 +397,10 @@ public class Lesson7 extends Applet */
public void keyPressed(KeyEvent e)
{
+ //Ensure GL is initialised correctly
+ if (glj.gljMakeCurrent(true) == false)
+ return;
+
switch(e.getKeyCode())
{
//Switch ON/OFF light when L is pressed
@@ -473,6 +478,8 @@ public class Lesson7 extends Applet break;
}
}
+ glj.gljFree();
+
}
diff --git a/demos/HodglimsNeHe/Lesson8.java b/demos/HodglimsNeHe/Lesson8.java index f8735d5..f0dc1cc 100644 --- a/demos/HodglimsNeHe/Lesson8.java +++ b/demos/HodglimsNeHe/Lesson8.java @@ -360,6 +360,7 @@ public class Lesson8 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
@@ -380,6 +381,10 @@ public class Lesson8 extends Applet */
public void keyPressed(KeyEvent e)
{
+ //Ensure GL is initialised correctly
+ if (glj.gljMakeCurrent(true) == false)
+ return;
+
switch(e.getKeyCode())
{
//Switch ON/OFF light when L is pressed
@@ -481,6 +486,8 @@ public class Lesson8 extends Applet break;
}
}
+ glj.gljFree();
+
}
diff --git a/demos/HodglimsNeHe/Lesson9.java b/demos/HodglimsNeHe/Lesson9.java index 4c4a92d..0a43cb8 100644 --- a/demos/HodglimsNeHe/Lesson9.java +++ b/demos/HodglimsNeHe/Lesson9.java @@ -313,6 +313,7 @@ public class Lesson9 extends Applet //Swap buffers
glj.gljSwap();
+ glj.gljFree();
}
diff --git a/demos/HodglimsNeHe/index.html b/demos/HodglimsNeHe/index.html index 88ac1fb..d1993ea 100644 --- a/demos/HodglimsNeHe/index.html +++ b/demos/HodglimsNeHe/index.html @@ -11,7 +11,7 @@ <a href="http://nehe.gamedev.net/opengl.asp">NeHe OpenGL Tutorial Demos</a> originally ported by <a href="http://dev.knowledgeassociates.com/Hodglim/nehe/nehe.shtml">Hodglim</a> -for <B> GL4Java >= 2.4.0.0: </B> <br> +for <B> GL4Java >= 2.5.2.0: </B> <br> <br> This demos have added <I>requestFocus()</I> statements, especially for the events: <I>mouseEntered</I> and <I>mouseClicked</I> !<br> diff --git a/demos/HodglimsNeHe/index_plugin13.html b/demos/HodglimsNeHe/index_plugin13.html index 754940c..802b8ee 100644 --- a/demos/HodglimsNeHe/index_plugin13.html +++ b/demos/HodglimsNeHe/index_plugin13.html @@ -11,7 +11,7 @@ <a href="http://nehe.gamedev.net/opengl.asp">NeHe OpenGL Tutorial Demos</a> originally ported by <a href="http://dev.knowledgeassociates.com/Hodglim/nehe/nehe.shtml">Hodglim</a> -for <B> GL4Java >= 2.4.0.0: </B> <br> +for <B> GL4Java >= 2.5.2.0: </B> <br> <br> This demos have added <I>requestFocus()</I> statements, especially for the events: <I>mouseEntered</I> and <I>mouseClicked</I> !<br> diff --git a/demos/MiscDemos/DrawColoredPrimitives.java b/demos/MiscDemos/DrawColoredPrimitives.java index 0e6725b..e65d322 100755 --- a/demos/MiscDemos/DrawColoredPrimitives.java +++ b/demos/MiscDemos/DrawColoredPrimitives.java @@ -60,7 +60,7 @@ public class DrawColoredPrimitives extends SimpleGLAnimApplet1 Dimension ps = applet.getPreferredSize();
f.setBounds(-100,-100,99,99);
f.setVisible(true);
- f.setVisible(false);
+ //f.setVisible(false);
Insets i = f.getInsets();
f.setBounds(0,0,
ps.width+i.left+i.right,
diff --git a/demos/MiscDemos/DrawColoredPrimitives2.java b/demos/MiscDemos/DrawColoredPrimitives2.java index fad8668..e67f46b 100644 --- a/demos/MiscDemos/DrawColoredPrimitives2.java +++ b/demos/MiscDemos/DrawColoredPrimitives2.java @@ -54,7 +54,7 @@ public class DrawColoredPrimitives2 extends SimpleGLAnimApplet1 Dimension ps = applet.getPreferredSize();
f.setBounds(-100,-100,99,99);
f.setVisible(true);
- f.setVisible(false);
+ //f.setVisible(false);
Insets i = f.getInsets();
f.setBounds(0,0,
ps.width+i.left+i.right,
diff --git a/demos/MiscDemos/GLImageWorld1.java b/demos/MiscDemos/GLImageWorld1.java index 6ac78f5..cfef4f8 100755 --- a/demos/MiscDemos/GLImageWorld1.java +++ b/demos/MiscDemos/GLImageWorld1.java @@ -64,7 +64,10 @@ public class GLImageWorld1 extends GLCanvas if(fetchGL) { if( glj.gljMakeCurrent() == false ) + { System.out.println("problem in use() method"); + return; + } } TranlateObj(0f,0f,-10f); @@ -346,12 +349,6 @@ public class GLImageWorld1 extends GLCanvas float axisY, float axisZ) { - if( glj.gljMakeCurrent() == false ) - { - System.out.println("problem in use() method"); - return; - } - gl.glMatrixMode (GL_MODELVIEW); gl.glLoadIdentity (); @@ -359,18 +356,10 @@ public class GLImageWorld1 extends GLCanvas 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 (); @@ -378,8 +367,6 @@ public class GLImageWorld1 extends GLCanvas gl.glLoadMatrixf(mPosObjTrans); gl.glTranslatef(x,y,z); gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjTrans); - - repaint(); } // entfernt rotationen aus aktueller matrix @@ -433,6 +420,12 @@ public class GLImageWorld1 extends GLCanvas Point dif=new Point(mousePoint.x-oldMousePoint.x, mousePoint.y-oldMousePoint.y); + if( glj.gljMakeCurrent() == false ) + { + System.out.println("problem in use() method"); + return; + } + if(e.isShiftDown()==true) TranlateObj((float)dif.x/6.0f,(float)dif.y/-6.0f,0f); else if(e.isAltDown()==true) @@ -445,6 +438,9 @@ public class GLImageWorld1 extends GLCanvas RotateObj(dif.x,0f,1f,0f); RotateObj(dif.y,1f,0f,0f); } + + glj.gljFree(); + repaint(); } } public void mouseMoved(MouseEvent e) diff --git a/demos/MiscDemos/TriangleRotate.java b/demos/MiscDemos/TriangleRotate.java index c2d93f7..695575b 100755 --- a/demos/MiscDemos/TriangleRotate.java +++ b/demos/MiscDemos/TriangleRotate.java @@ -56,7 +56,7 @@ public class TriangleRotate extends SimpleGLAnimApplet1 Dimension ps = applet.getPreferredSize();
f.setBounds(-100,-100,99,99);
f.setVisible(true);
- f.setVisible(false);
+ //f.setVisible(false);
Insets i = f.getInsets();
f.setBounds(0,0,
ps.width+i.left+i.right,
diff --git a/demos/MiscDemos/accanti.java b/demos/MiscDemos/accanti.java index 3191452..f15287a 100644 --- a/demos/MiscDemos/accanti.java +++ b/demos/MiscDemos/accanti.java @@ -82,7 +82,7 @@ public class accanti extends Applet Dimension ps = applet.getPreferredSize(); f.setBounds(-100,-100,99,99); f.setVisible(true); - f.setVisible(false); + //f.setVisible(false); Insets i = f.getInsets(); f.setBounds(0,0, ps.width+i.left+i.right, diff --git a/demos/MiscDemos/alpha3D.java b/demos/MiscDemos/alpha3D.java index a982375..3d59134 100644 --- a/demos/MiscDemos/alpha3D.java +++ b/demos/MiscDemos/alpha3D.java @@ -67,7 +67,7 @@ public class alpha3D extends SimpleGLAnimApplet1 Dimension ps = applet.getPreferredSize(); f.setBounds(-100,-100,99,99); f.setVisible(true); - f.setVisible(false); + //f.setVisible(false); Insets i = f.getInsets(); f.setBounds(0,0, ps.width+i.left+i.right, diff --git a/demos/MiscDemos/gears.java b/demos/MiscDemos/gears.java index b61d711..44f709e 100644 --- a/demos/MiscDemos/gears.java +++ b/demos/MiscDemos/gears.java @@ -40,6 +40,7 @@ public class gears extends SimpleGLAnimApplet1 public static void main( String args[] )
{
int i = 0;
+ String gljLib = null;
String glLib = null;
String gluLib = null;
boolean perftest=false;
@@ -49,6 +50,11 @@ public class gears extends SimpleGLAnimApplet1 if(args[i].equals("-perftest"))
{
perftest=true;
+ } else if(args[i].equals("-gljLib"))
+ {
+ i++;
+ if(args.length>i)
+ gljLib=args[i];
} else if(args[i].equals("-glLib"))
{
i++;
@@ -67,16 +73,32 @@ public class gears extends SimpleGLAnimApplet1 if(!perftest)
{
- GLContext.gljNativeDebug = true;
- GLContext.gljClassDebug = true;
+ GLContext.gljNativeDebug = false;
+ GLContext.gljThreadDebug = false;
+ GLContext.gljClassDebug = false;
}
- System.out.println("loading libs(gl, glu): "+
- glLib+", "+gluLib+": "+
- GLContext.loadNativeLibraries(null, glLib, gluLib));
+ if(perftest)
+ GLContext.gljClassDebug=true;
+ GLContext.loadNativeLibraries(gljLib, glLib, gluLib);
+ if(perftest)
+ GLContext.gljClassDebug=false;
Frame mainFrame = new Frame("gears");
+ mainFrame.addWindowListener( new WindowAdapter()
+ {
+ public void windowClosed(WindowEvent e)
+ {
+ System.exit(0);
+ }
+ public void windowClosing(WindowEvent e)
+ {
+ windowClosed(e);
+ }
+ }
+ );
+
gears applet = new gears();
applet.setSize(300, 300);
@@ -90,6 +112,9 @@ public class gears extends SimpleGLAnimApplet1 applet.canvas.getUseFpsSleep());
System.out.println("useRepaint: "+
applet.canvas.getUseRepaint());
+
+ System.out.println("useFpsSleep: "+
+ applet.canvas.getUseFpsSleep());
}
applet.start();
@@ -104,7 +129,7 @@ public class gears extends SimpleGLAnimApplet1 /* Local GLAnimCanvas extension class */
- private class gearsCanvas extends GLAnimCanvas implements MouseListener, MouseMotionListener
+ public class gearsCanvas extends GLAnimCanvas implements MouseListener, MouseMotionListener
{
private static final float M_PI = 3.14159265f;
diff --git a/demos/MiscDemos/glutFontBitmapTest2Applet.java b/demos/MiscDemos/glutFontBitmapTest2Applet.java index 0985385..3059bb0 100644 --- a/demos/MiscDemos/glutFontBitmapTest2Applet.java +++ b/demos/MiscDemos/glutFontBitmapTest2Applet.java @@ -209,12 +209,6 @@ public class glutFontBitmapTest2Applet extends Applet float axisY,
float axisZ)
{
- if( glj.gljMakeCurrent() == false )
- {
- System.out.println("problem in use() method");
- return;
- }
-
gl.glMatrixMode (GL_MODELVIEW);
gl.glLoadIdentity ();
@@ -222,18 +216,10 @@ public class glutFontBitmapTest2Applet extends Applet 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 ();
@@ -241,8 +227,6 @@ public class glutFontBitmapTest2Applet extends Applet gl.glLoadMatrixf(mPosObjTrans);
gl.glTranslatef(x,y,z);
gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjTrans);
-
- repaint();
}
// entfernt rotationen aus aktueller matrix
@@ -296,6 +280,12 @@ public class glutFontBitmapTest2Applet extends Applet Point dif=new Point(mousePoint.x-oldMousePoint.x,
mousePoint.y-oldMousePoint.y);
+ if( glj.gljMakeCurrent() == false )
+ {
+ System.out.println("problem in use() method");
+ return;
+ }
+
if(e.isShiftDown()==true)
TranlateObj((float)dif.x/6.0f,(float)dif.y/-6.0f,0f);
else if(e.isAltDown()==true)
@@ -308,6 +298,11 @@ public class glutFontBitmapTest2Applet extends Applet RotateObj(dif.x,0f,1f,0f);
RotateObj(dif.y,1f,0f,0f);
}
+
+ glj.gljFree();
+
+ repaint();
+
}
}
public void mouseMoved(MouseEvent e)
diff --git a/demos/MiscDemos/index.html b/demos/MiscDemos/index.html index 0c01565..b9fb0a0 100644 --- a/demos/MiscDemos/index.html +++ b/demos/MiscDemos/index.html @@ -7,7 +7,7 @@ <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> +<p>Here are the demos-II for <B> GL4Java >= 2.5.2.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> @@ -57,19 +57,19 @@ : GLUT Font Bitmap 2 (GLUT DEMO) <br> <br> -<br> <a href="tess.html">Tessellator Demo 1</a> +<p> <a href="tess.html">Tessellator Demo 1</a> : test/shows 2 tesselated geometries -<br> <a href="tesswind.html">Tessellator Demo 2</a> +<p> <a href="tesswind.html">Tessellator Demo 2</a> : test/shows tesselated geometries with different winding rules -<br> <a href="tessdemo.html">Tessellator Demo 3</a> +<p> <a href="tessdemo.html">Tessellator Demo 3</a> : test/shows self created tesselated geometries <br> <br> -<br> <a href="SharedGLTest2.html">Shared GL-Context</a> +<p> <a href="SharedGLTest2.html">Shared GL-Context</a> : test/shows the usage of a shared GLContext for Display-Lists <br> <br> -<br> <a href="select.html">Selection Demo 1</a> +<p> <a href="select.html">Selection Demo 1</a> : test/shows selection <br> <br> diff --git a/demos/MiscDemos/index_plugin13.html b/demos/MiscDemos/index_plugin13.html index 082aab8..47de881 100644 --- a/demos/MiscDemos/index_plugin13.html +++ b/demos/MiscDemos/index_plugin13.html @@ -7,7 +7,7 @@ <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> +<p>Here are the demos-II for <B> GL4Java >= 2.5.2.0: & Java2 Plug-In 1.3</B> <hr> <br> <a href="../../Installer/java.policy">The Java2 (sdk, jre, plugin 1.3) policy file example to give GL4Java the necessary permissions (Click here) !</a> @@ -59,19 +59,19 @@ : GLUT Font Bitmap 2 (GLUT DEMO) <br> <br> -<br> <a href="tess_plugin13.html">Tessellator Demo 1</a> +<p> <a href="tess_plugin13.html">Tessellator Demo 1</a> : test/shows 2 tesselated geometries -<br> <a href="tesswind_plugin13.html">Tessellator Demo 2</a> +<p> <a href="tesswind_plugin13.html">Tessellator Demo 2</a> : test/shows tesselated geometries with different winding rules -<br> <a href="tessdemo_plugin13.html">Tessellator Demo 3</a> +<p> <a href="tessdemo_plugin13.html">Tessellator Demo 3</a> : test/shows self created tesselated geometries <br> <br> -<br> <a href="SharedGLTest2_plugin13.html">Shared GL-Context</a> +<p> <a href="SharedGLTest2_plugin13.html">Shared GL-Context</a> : test/shows the usage of a shared GLContext for Display-Lists <br> <br> -<br> <a href="select_plugin13.html">Selection Demo 1</a> +<p> <a href="select_plugin13.html">Selection Demo 1</a> : test/shows selection <br> <br> diff --git a/demos/MiscDemos/morph3d.java b/demos/MiscDemos/morph3d.java index 7c8a8fe..6669163 100755 --- a/demos/MiscDemos/morph3d.java +++ b/demos/MiscDemos/morph3d.java @@ -171,16 +171,29 @@ public class morph3d extends SimpleGLAnimApplet1 public void init() { - super.init(); - Dimension d = getSize(); - canvas = new morph3dCanvas(d.width, d.height); - add("Center", canvas); + 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"); + mainFrame.addWindowListener( new WindowAdapter() + { + public void windowClosed(WindowEvent e) + { + System.exit(0); + } + public void windowClosing(WindowEvent e) + { + windowClosed(e); + } + } + ); + GLContext.gljNativeDebug = true; GLContext.gljClassDebug = true; diff --git a/demos/MiscDemos/nurbs.java b/demos/MiscDemos/nurbs.java index 52ecd99..fe9ab6c 100644 --- a/demos/MiscDemos/nurbs.java +++ b/demos/MiscDemos/nurbs.java @@ -102,7 +102,7 @@ public class nurbs extends SimpleGLAnimApplet1 };
- int theNurb;
+ long theNurb;
public gldemo(int w, int h)
{
diff --git a/demos/MiscDemos/pngTextureTestApplet.java b/demos/MiscDemos/pngTextureTestApplet.java index 99ea0bb..18c05d2 100755 --- a/demos/MiscDemos/pngTextureTestApplet.java +++ b/demos/MiscDemos/pngTextureTestApplet.java @@ -59,7 +59,7 @@ public class pngTextureTestApplet extends Applet Dimension ps = applet.getPreferredSize(); f.setBounds(-100,-100,99,99); f.setVisible(true); - f.setVisible(false); + //f.setVisible(false); Insets i = f.getInsets(); f.setBounds(0,0, ps.width+i.left+i.right, @@ -305,47 +305,6 @@ public class pngTextureTestApplet extends Applet 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() { @@ -397,6 +356,12 @@ public class pngTextureTestApplet extends Applet Point dif=new Point(mousePoint.x-oldMousePoint.x, mousePoint.y-oldMousePoint.y); + if( glj.gljMakeCurrent() == false ) + { + System.out.println("problem in use() method"); + return; + } + if(e.isShiftDown()==true) TranlateObj((float)dif.x/6.0f,(float)dif.y/-6.0f,0f); else if(e.isAltDown()==true) @@ -409,12 +374,42 @@ public class pngTextureTestApplet extends Applet RotateObj(dif.x,0f,1f,0f); RotateObj(dif.y,1f,0f,0f); } + + glj.gljFree(); + repaint(); + } } public void mouseMoved(MouseEvent e) { } + void RotateObj(float degree, + float axisX, + float axisY, + float axisZ) + { + gl.glMatrixMode (GL_MODELVIEW); + gl.glLoadIdentity (); + + // kamera setzen + gl.glRotatef(degree,axisX,axisY,axisZ); + gl.glMultMatrixf(mPosObjRot); + gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjRot); + } + + void TranlateObj(float x,float y,float z) + { + gl.glMatrixMode (GL_MODELVIEW); + gl.glLoadIdentity (); + + // kamera setzen + gl.glLoadMatrixf(mPosObjTrans); + gl.glTranslatef(x,y,z); + gl.glGetFloatv(GL_MODELVIEW_MATRIX,mPosObjTrans); + + } + } } diff --git a/demos/MiscDemos/select.java b/demos/MiscDemos/select.java index a1020c3..3605e97 100644 --- a/demos/MiscDemos/select.java +++ b/demos/MiscDemos/select.java @@ -95,7 +95,7 @@ public class select extends Applet Dimension ps = applet.getPreferredSize(); f.setBounds(-100,-100,99,99); f.setVisible(true); - f.setVisible(false); + //f.setVisible(false); Insets i = f.getInsets(); f.setBounds(0,0, ps.width+i.left+i.right, diff --git a/demos/MiscDemos/spectex.java b/demos/MiscDemos/spectex.java index 55d4aae..fe0b323 100644 --- a/demos/MiscDemos/spectex.java +++ b/demos/MiscDemos/spectex.java @@ -59,7 +59,7 @@ public class spectex extends SimpleGLAnimApplet1 final float M_PI_2 = 1.57079632f;
int view = 0; /* 0 = front, 1 = top, 2 = bottom */
- int Quadric;
+ long Quadric;
int Sphere;
float LightPos[/*4*/] = {10.0f, 10.0f, 10.0f, 1.0f};
float Delta = 1.0f;
diff --git a/demos/MiscDemos/stencil.java b/demos/MiscDemos/stencil.java index a2d163f..b5f7fe7 100644 --- a/demos/MiscDemos/stencil.java +++ b/demos/MiscDemos/stencil.java @@ -261,7 +261,7 @@ public class stencil extends Applet gl.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
gl.glCallList(BLUEMAT);
- int qobj = glu.gluNewQuadric();
+ long qobj = glu.gluNewQuadric();
glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
glu.gluQuadricNormals(qobj,GLU_SMOOTH);
glu.gluQuadricTexture(qobj,false);
diff --git a/demos/MiscDemos/tess.java b/demos/MiscDemos/tess.java index 2cf3a7a..72943aa 100644 --- a/demos/MiscDemos/tess.java +++ b/demos/MiscDemos/tess.java @@ -132,7 +132,7 @@ public class tess extends Applet { int i; glut = new GLUTFuncLightImplWithFonts(gl, glu); - int tobj; + long tobj; gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/demos/MiscDemos/tessdemo.java b/demos/MiscDemos/tessdemo.java index 899b27a..91d9754 100755 --- a/demos/MiscDemos/tessdemo.java +++ b/demos/MiscDemos/tessdemo.java @@ -14,8 +14,15 @@ /* * $Log$ - * Revision 1.1 2000/11/18 06:53:19 sven - * Initial revision + * Revision 1.2 2001/02/13 05:32:09 sven + * JAWT Support JDK >=1.3 + * + * Revision 1.1.1.2 2000/11/18 10:41:27 sven + * still working for the initial check in + * + * Revision 1.1.1.1 2000/11/18 06:53:19 sven + * Initial import into CVS. + * Version 2.5.0.0 beta 1 * * Revision 1.3f.2.1f 1999/11/16 11:09:09 gareth * Added combine callback. Converted vertices from ints to floats. @@ -316,7 +323,7 @@ public class tessdemo extends Applet { public void tesse( ) { - int tobj; + long tobj; double data[] = new double[3]; int i, j, point_cnt; diff --git a/demos/MiscDemos/tesswind.java b/demos/MiscDemos/tesswind.java index b25ca42..d37e79c 100755 --- a/demos/MiscDemos/tesswind.java +++ b/demos/MiscDemos/tesswind.java @@ -175,7 +175,7 @@ public class tesswind extends Applet { double currentWinding = GLU_TESS_WINDING_ODD; int currentShape = 0; - int tobj; + long tobj; int list; public void init() { diff --git a/demos/RectRenderSpeed/GL4JCanvas.java b/demos/RectRenderSpeed/GL4JCanvas.java index 7366ee0..409de36 100644 --- a/demos/RectRenderSpeed/GL4JCanvas.java +++ b/demos/RectRenderSpeed/GL4JCanvas.java @@ -320,9 +320,9 @@ public void gl_display () { if (glj.gljMakeCurrent () == false) { - System.out.println ("GL4JCanvas`gl_display- gljMakeCurrent" + System.out.println ("GL4JCanvas`gl_display- makeCurrent" +" is false"); - loc_err = true; + return; } } diff --git a/demos/RonsDemos/dinoshade.java b/demos/RonsDemos/dinoshade.java index 344fd00..570ea12 100755 --- a/demos/RonsDemos/dinoshade.java +++ b/demos/RonsDemos/dinoshade.java @@ -611,7 +611,7 @@ public class dinoshade extends SimpleGLAnimApplet1 {
/* Draw a yellow ball at the light source. */
gl.glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
- int qobj = glu.gluNewQuadric();
+ long qobj = glu.gluNewQuadric();
glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
glu.gluQuadricNormals(qobj,GLU_SMOOTH);
glu.gluQuadricTexture(qobj,false);
diff --git a/demos/RonsDemos/fog.java b/demos/RonsDemos/fog.java index 7f99c94..3865f62 100644 --- a/demos/RonsDemos/fog.java +++ b/demos/RonsDemos/fog.java @@ -215,7 +215,7 @@ public class fog extends Applet gl.glPushMatrix();
gl.glTranslatef(x, y, z);
- int qobj = glu.gluNewQuadric();
+ long qobj = glu.gluNewQuadric();
glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
glu.gluQuadricNormals(qobj,GLU_SMOOTH);
glu.gluQuadricTexture(qobj,false);
diff --git a/demos/RonsDemos/material.java b/demos/RonsDemos/material.java index 2558c84..b78a1ec 100644 --- a/demos/RonsDemos/material.java +++ b/demos/RonsDemos/material.java @@ -188,7 +188,7 @@ public class material extends Applet float low_shininess[] = { 5.0f };
float high_shininess[] = { 100.0f };
float mat_emission[] = {0.3f, 0.2f, 0.2f, 0.0f};
- int qobj;
+ long qobj;
gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
diff --git a/demos/RonsDemos/molehill.java b/demos/RonsDemos/molehill.java index 8dbe12e..42eea66 100644 --- a/demos/RonsDemos/molehill.java +++ b/demos/RonsDemos/molehill.java @@ -87,7 +87,7 @@ public class molehill extends Applet float pts2[] = new float[4*4*3];
float pts3[] = new float[4*4*3];
float pts4[] = new float[4*4*3];
- int nurb;
+ long nurb;
int u, v;
public molehillCanvas(int w, int h)
diff --git a/demos/RonsDemos/moth.java b/demos/RonsDemos/moth.java index c12a4a9..dfc42ac 100644 --- a/demos/RonsDemos/moth.java +++ b/demos/RonsDemos/moth.java @@ -423,7 +423,7 @@ public class moth extends SimpleGLAnimApplet1 gl.glTranslatef(0.0f, 1.6f, -5.0f);
/* draw lamp */
- int qobj = glu.gluNewQuadric();
+ long qobj = glu.gluNewQuadric();
glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
glu.gluQuadricNormals(qobj,GLU_SMOOTH);
glu.gluQuadricTexture(qobj,false);
diff --git a/demos/RonsDemos/particle.java b/demos/RonsDemos/particle.java index 2369b00..7f1d552 100644 --- a/demos/RonsDemos/particle.java +++ b/demos/RonsDemos/particle.java @@ -253,7 +253,7 @@ public class particle extends SimpleGLAnimApplet1 sphere_list = gl.glGenLists(1);
gl.glNewList(sphere_list,GL_COMPILE);
gl.glColor3ub((byte)0, (byte)255, (byte)128);
- int qobj = glu.gluNewQuadric();
+ long qobj = glu.gluNewQuadric();
glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
glu.gluQuadricNormals(qobj,GLU_SMOOTH);
glu.gluQuadricTexture(qobj,false);
diff --git a/demos/RonsDemos/polyoff.java b/demos/RonsDemos/polyoff.java index a79a398..255aa0a 100644 --- a/demos/RonsDemos/polyoff.java +++ b/demos/RonsDemos/polyoff.java @@ -147,7 +147,7 @@ public class polyoff extends Applet list = gl.glGenLists(1);
gl.glNewList (list, GL_COMPILE);
- int qobj = glu.gluNewQuadric();
+ long qobj = glu.gluNewQuadric();
glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
glu.gluQuadricNormals(qobj,GLU_SMOOTH);
glu.gluQuadricTexture(qobj,false);
diff --git a/demos/RonsDemos/quadric.java b/demos/RonsDemos/quadric.java index 932f428..0c39b13 100644 --- a/demos/RonsDemos/quadric.java +++ b/demos/RonsDemos/quadric.java @@ -125,7 +125,7 @@ public class quadric extends Applet System.out.println("init(): " + this);
reshape(getSize().width, getSize().height);
- int qobj;
+ long qobj;
float mat_ambient[] = { 0.5f, 0.5f, 0.5f, 1.0f };
float mat_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
float mat_shininess[] = { 50.0f };
diff --git a/demos/RonsDemos/reflect.java b/demos/RonsDemos/reflect.java index e857881..6858c26 100644 --- a/demos/RonsDemos/reflect.java +++ b/demos/RonsDemos/reflect.java @@ -283,7 +283,7 @@ public class reflect extends SimpleGLAnimApplet1 private void make_objects()
{
- int q;
+ long q;
float cyan[] = { 0.0f, 1.0f, 1.0f, 1.0f };
float green[] = { 0.2f, 1.0f, 0.2f, 1.0f };
diff --git a/demos/RonsDemos/renormal.java b/demos/RonsDemos/renormal.java index 783bf15..1a0ecdf 100644 --- a/demos/RonsDemos/renormal.java +++ b/demos/RonsDemos/renormal.java @@ -93,7 +93,7 @@ public class renormal extends SimpleGLAnimApplet1 gl.glPushMatrix();
gl.glScalef(scale, scale, scale);
- int qobj = glu.gluNewQuadric();
+ long qobj = glu.gluNewQuadric();
glu.gluQuadricOrientation(qobj,GLU_OUTSIDE);
glu.gluQuadricNormals(qobj,GLU_SMOOTH);
glu.gluQuadricTexture(qobj,false);
diff --git a/demos/RonsDemos/rings.java b/demos/RonsDemos/rings.java index 8a08bb5..c03ca7d 100644 --- a/demos/RonsDemos/rings.java +++ b/demos/RonsDemos/rings.java @@ -352,7 +352,7 @@ public class rings extends SimpleGLAnimApplet1 int slices,
int stacks)
{
- int qobj = glu.gluNewQuadric();
+ long qobj = glu.gluNewQuadric();
glu.gluQuadricDrawStyle(qobj,GLU_FILL);
glu.gluQuadricNormals(qobj,GLU_SMOOTH);
diff --git a/demos/RonsDemos/shadowvol.java b/demos/RonsDemos/shadowvol.java index f40f20b..f25d6dc 100644 --- a/demos/RonsDemos/shadowvol.java +++ b/demos/RonsDemos/shadowvol.java @@ -111,7 +111,7 @@ public class shadowvol extends Applet reshape(getSize().width, getSize().height);
byte tex[];
- int sphere, cone, base;
+ long sphere, cone, base;
float sphere_mat[] = {1.0f, 0.5f, 0.0f, 1.0f};
float cone_mat[] = {0.0f, 0.5f, 1.0f, 1.0f};
diff --git a/demos/RonsDemos/softshadow.java b/demos/RonsDemos/softshadow.java index 0d9e8ef..c49a434 100644 --- a/demos/RonsDemos/softshadow.java +++ b/demos/RonsDemos/softshadow.java @@ -149,7 +149,7 @@ public class softshadow extends Applet /* make display lists for sphere and cone; for efficiency */
- int sphere, cone, base;
+ long sphere, cone, base;
gl.glNewList(SPHERE, GL_COMPILE);
sphere = glu.gluNewQuadric();
diff --git a/demos/RonsDemos/steam.java b/demos/RonsDemos/steam.java index 3f19f7e..e89afde 100644 --- a/demos/RonsDemos/steam.java +++ b/demos/RonsDemos/steam.java @@ -95,7 +95,7 @@ public class steam extends SimpleGLAnimApplet1 private int list_flywheel_filled = 4;
private int list_flywheel_texture = 8;
/* Variable used in the creaton of glu objects */
- int obj; // (GLU quadric object)
+ long obj; // (GLU quadric object)
private PopupMenu menu = null;
private boolean menu_showing = false;
@@ -587,7 +587,7 @@ public class steam extends SimpleGLAnimApplet1 /* Draws a cylinder using glu function, drawing flat discs
at each end, to give the appearence of it being solid. */
private void myCylinder
- (int object, float outerRadius, float innerRadius, float length)
+ (long object, float outerRadius, float innerRadius, float length)
{
gl.glPushMatrix();
glu.gluCylinder(object, outerRadius, outerRadius, length, 20, 1);
diff --git a/demos/RonsDemos/surface.java b/demos/RonsDemos/surface.java index 2d959b8..a33f48b 100644 --- a/demos/RonsDemos/surface.java +++ b/demos/RonsDemos/surface.java @@ -102,7 +102,7 @@ public class surface extends Applet {
float ctlpoints[] = new float [4*4*3];
boolean showPoints = false;
- int theNurb;
+ long theNurb;
public surfaceCanvas(int w, int h)
{
diff --git a/demos/RonsDemos/text3d.java b/demos/RonsDemos/text3d.java index ed40bee..9d288d5 100644 --- a/demos/RonsDemos/text3d.java +++ b/demos/RonsDemos/text3d.java @@ -371,6 +371,7 @@ public class text3d extends SimpleGLAnimApplet1 doubleBuffer = true;
stereoView = false;
accumSize = 8;
+ setUseRepaint(false);
}
public void init()
diff --git a/demos/SwingDemos/CrossColorJPanel.java b/demos/SwingDemos/CrossColorJPanel.java index 44a6492..97ed71f 100644 --- a/demos/SwingDemos/CrossColorJPanel.java +++ b/demos/SwingDemos/CrossColorJPanel.java @@ -17,7 +17,6 @@ public class CrossColorJPanel extends GLJPanel public void display() { - System.out.println("i"); int i; gl.glPushMatrix(); diff --git a/demos/SwingDemos/TessJPanel.java b/demos/SwingDemos/TessJPanel.java index f070823..60005ab 100644 --- a/demos/SwingDemos/TessJPanel.java +++ b/demos/SwingDemos/TessJPanel.java @@ -93,7 +93,7 @@ public class TessJPanel extends GLJPanel int i; glut = new GLUTFuncLightImplWithFonts(gl, glu); - int tobj; + long tobj; gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/demos/demoCvs.java b/demos/demoCvs.java index 79b5c73..7eaec65 100644 --- a/demos/demoCvs.java +++ b/demos/demoCvs.java @@ -40,7 +40,6 @@ class demoCvs extends GLCanvas /* Standard GL4Java Init */ if( glj.gljMakeCurrent() == false ) { - System.out.println("problem in use() method"); return; } diff --git a/demos/demoCvsAnim.java b/demos/demoCvsAnim.java index 3dcc689..560c088 100644 --- a/demos/demoCvsAnim.java +++ b/demos/demoCvsAnim.java @@ -40,7 +40,6 @@ class demoCvsAnim extends GLAnimCanvas /* Standard GL4Java Init */ if( glj.gljMakeCurrent() == false ) { - System.out.println("problem in use() method"); return; } diff --git a/demos/glDemosCvs.java b/demos/glDemosCvs.java index 6902b95..d280f35 100644 --- a/demos/glDemosCvs.java +++ b/demos/glDemosCvs.java @@ -17,6 +17,10 @@ public class glDemosCvs extends Applet * */ + Panel pWave ; + Panel pOlympic ; + Panel pLogo ; + Panel pStar ; Button ButtonFps; TextField TextFpsOlymp; TextField TextFpsLogo; @@ -87,22 +91,22 @@ public class glDemosCvs extends Applet add("Center", pAllCvs); // 1. Wave - Panel pWave = new Panel(); + pWave = new Panel(); pWave.setLayout(new GridLayout(1,2)); pAllCvs.add(pWave); // 2. Olympic - Panel pOlympic = new Panel(); + pOlympic = new Panel(); pOlympic.setLayout(new GridLayout(1,2)); pAllCvs.add(pOlympic); // 3. Logo - Panel pLogo = new Panel(); + pLogo = new Panel(); pLogo.setLayout(new GridLayout(1,2)); pAllCvs.add(pLogo); // 3. Star - Panel pStar = new Panel(); + pStar = new Panel(); pStar.setLayout(new GridLayout(1,2)); pAllCvs.add(pStar); @@ -261,13 +265,9 @@ public class glDemosCvs extends Applet } public void destroy() { - cvsOlympic.stop(); cvsOlympic.cvsDispose(); - cvsWave.stop(); cvsWave.cvsDispose(); - cvsLogo.stop(); cvsLogo.cvsDispose(); - cvsStar.stop(); cvsStar.cvsDispose(); } @@ -332,8 +332,55 @@ public class glDemosCvs extends Applet { Component comp = evt.getComponent(); - if( comp.equals(ButtonFps) ) + if ((evt.getModifiers() & evt.BUTTON3_MASK) != 0) { + System.out.println("button3: "+comp); + if(comp instanceof GLAnimCanvas) + { + GLAnimCanvas glcvs = (GLAnimCanvas)comp; + glcvs.cvsDispose(); + + Container c = glcvs.getParent(); + c.remove(glcvs); + + glcvs.setVisible(true); + + if(c instanceof Frame) + { + Frame of = (Frame)c; + of.dispose(); + of=null; + + Panel p = null; + + if(glcvs.equals(cvsStar)) + p = pStar; + else if(glcvs.equals(cvsLogo)) + p = pLogo; + else if(glcvs.equals(cvsOlympic)) + p = pOlympic; + else if(glcvs.equals(cvsWave)) + p = pWave; + p.add(glcvs); + p.doLayout(); + } else if(c instanceof Panel) + { + Frame f = new Frame("EXTRA"); + f.add(glcvs); + f.pack(); + f.setVisible(true); + } + glcvs.start(); + + System.out.println("GLContextNumber: "+ + GLContext.getNativeGLContextNumber()); + } + } else if ((evt.getModifiers() & evt.BUTTON1_MASK) != 0) + { + if( comp.equals(ButtonFps) ) + { + System.out.println("GLContextNumber: "+ + GLContext.getNativeGLContextNumber()); double fps = 0; int a1; @@ -369,70 +416,73 @@ public class glDemosCvs extends Applet fps=(double)a1/100.0; TextFpsStar.setText(String.valueOf(fps)); } - } - else if( comp.equals(buttonInfo) ) - { - Frame fInfo = null; - if(cvsWave!=null && cvsWave.getGLContext()!=null) - fInfo = cvsWave.getGLContext().gljShowVersions(); - else if(cvsOlympic!=null && cvsOlympic.getGLContext()!=null) - fInfo = cvsOlympic.getGLContext().gljShowVersions(); - else if(cvsLogo!=null && cvsLogo.getGLContext()!=null) - fInfo = cvsLogo.getGLContext().gljShowVersions(); - else if(cvsStar!=null && cvsStar.getGLContext()!=null) - fInfo = cvsStar.getGLContext().gljShowVersions(); - } - else if( comp.equals(cvsWave) ) - { + } + else if( comp.equals(buttonInfo) ) + { + System.out.println("GLContextNumber: "+ + GLContext.getNativeGLContextNumber()); + Frame fInfo = null; + if(cvsWave!=null && cvsWave.getGLContext()!=null) + fInfo = cvsWave.getGLContext().gljShowVersions(); + else if(cvsOlympic!=null && cvsOlympic.getGLContext()!=null) + fInfo = cvsOlympic.getGLContext().gljShowVersions(); + else if(cvsLogo!=null && cvsLogo.getGLContext()!=null) + fInfo = cvsLogo.getGLContext().gljShowVersions(); + else if(cvsStar!=null && cvsStar.getGLContext()!=null) + fInfo = cvsStar.getGLContext().gljShowVersions(); + } + else if( comp.equals(cvsWave) ) + { cvsWave.setSuspended(!cvsWave.isSuspended(), evt.getClickCount()>1 // -> ReInit ); - } - else if( comp.equals(cvsOlympic) ) - { + } + else if( comp.equals(cvsOlympic) ) + { cvsOlympic.setSuspended(!cvsOlympic.isSuspended(), evt.getClickCount()>1 // -> ReInit ); - } - else if( comp.equals(cvsLogo) ) - { + } + else if( comp.equals(cvsLogo) ) + { cvsLogo.setSuspended(!cvsLogo.isSuspended(), evt.getClickCount()>1 // -> ReInit ); - } - else if( comp.equals(cvsStar) ) - { + } + else if( comp.equals(cvsStar) ) + { cvsStar.setSuspended(!cvsStar.isSuspended(), evt.getClickCount()>1 // -> ReInit ); - } - if( comp.equals(bReStartL) ) - { + } + if( comp.equals(bReStartL) ) + { if(cvsLogo!=null) { cvsLogo.setSuspended(false, true); } - } - if( comp.equals(bReStartO) ) - { + } + if( comp.equals(bReStartO) ) + { if(cvsOlympic!=null) { cvsOlympic.setSuspended(false, true); } - } - if( comp.equals(bReStartW) ) - { + } + if( comp.equals(bReStartW) ) + { if(cvsWave!=null) { cvsWave.setSuspended(false, true); } - } - if( comp.equals(bReStartS) ) - { + } + if( comp.equals(bReStartS) ) + { if(cvsStar!=null) { cvsStar.setSuspended(false, true); } + } } } diff --git a/demos/glLogoCvs.java b/demos/glLogoCvs.java index e287406..ffeac8d 100644 --- a/demos/glLogoCvs.java +++ b/demos/glLogoCvs.java @@ -106,7 +106,6 @@ class glLogoCvs extends GLAnimCanvas /* Standard GL4Java Init */ if( glj.gljMakeCurrent() == false ) { - System.out.println("problem in use() method"); return; } diff --git a/demos/glStencilTest.java b/demos/glStencilTest.java index 79a2e4b..92ce6e8 100755 --- a/demos/glStencilTest.java +++ b/demos/glStencilTest.java @@ -29,7 +29,6 @@ public class glStencilTest { Dimension d=new Dimension(w,h);
if (!cvsIsInit()) return;
if( glj.gljMakeCurrent() == false ) {
- System.out.println("problem in use() method");
return;
}
setSize(d);
@@ -42,7 +41,6 @@ public class glStencilTest { int i;
if( glj.gljMakeCurrent() == false ) {
- System.out.println("problem in use() method");
return;
}
diff --git a/demos/index.html b/demos/index.html index 1ac862b..8de04df 100755 --- a/demos/index.html +++ b/demos/index.html @@ -8,7 +8,7 @@ </head> <BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#e6e6ff"> <p>Here are the demos-I for <B> -<A HREF="http://www.jausoft.com/gl4java/">GL4Java</A> >= 2.4.0.0: </B> <br> +<A HREF="http://www.jausoft.com/gl4java/">GL4Java</A> >= 2.5.2.0: </B> <br> <br> <LI><P ALIGN=LEFT><I><A HREF="glDemosCvs.html">glDemosCvs</A> : Many OpenGL Canvas running together</I> diff --git a/demos/olympicCvs.java b/demos/olympicCvs.java index 189e52d..3b46bf8 100644 --- a/demos/olympicCvs.java +++ b/demos/olympicCvs.java @@ -171,7 +171,6 @@ class olympicCvs extends GLAnimCanvas /* Standard GL4Java Init */ if( glj.gljMakeCurrent() == false ) { - System.out.println("problem in use() method"); return; } diff --git a/demos/starCvs.java b/demos/starCvs.java index b7c942c..2e9dc8f 100644 --- a/demos/starCvs.java +++ b/demos/starCvs.java @@ -128,7 +128,6 @@ class starCvs extends GLAnimCanvas /* Standard gl4java Init */
if( glj.gljMakeCurrent() == false )
{
- System.out.println("problem in use() method");
return;
}
diff --git a/demos/test1Cvs.java b/demos/test1Cvs.java index 85e03bb..f225cf5 100644 --- a/demos/test1Cvs.java +++ b/demos/test1Cvs.java @@ -46,7 +46,6 @@ class test1Cvs extends GLCanvas /* Standard GL4Java Init */ if( glj.gljMakeCurrent() == false ) { - System.out.println("problem in use() method"); return; } diff --git a/demos/testTextPPM1.java b/demos/testTextPPM1.java index e7d876c..0d1780f 100755 --- a/demos/testTextPPM1.java +++ b/demos/testTextPPM1.java @@ -361,7 +361,7 @@ public void display() public void puntVista() { - if (cvsIsInit()==false || glj.gljMakeCurrent() == false) + if (cvsIsInit()==false ) { System.out.println("-- Tenim algun problema glj.gljUse -3-"); return; @@ -462,8 +462,6 @@ public void mouseDragged(MouseEvent e) sl_alfaUsu.setValue(anclaAlfa+difX); sl_betaUsu.setValue(anclaBeta+difY); - // puntVista(); JAU - // display(); JAU ... -> sDisplay() or repaint ... repaint(); } //--------------------------------------------------------------- diff --git a/demos/waveCvs.java b/demos/waveCvs.java index bd7afbe..fab29c6 100644 --- a/demos/waveCvs.java +++ b/demos/waveCvs.java @@ -201,7 +201,6 @@ class waveCvs extends GLAnimCanvas /* Standard gl4java Init */
if( glj.gljMakeCurrent() == false )
{
- System.out.println("wave-display: problem in use() method");
return;
}
@@ -476,7 +475,6 @@ class waveCvs extends GLAnimCanvas if( glj.gljMakeCurrent() == false )
{
- System.out.println("CtrlWin: problem in use() method");
return;
} else {
gl.glFinish();
|