summaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-09-25 07:26:00 +0000
committerKenneth Russel <[email protected]>2005-09-25 07:26:00 +0000
commit02510865a2ff5468f11df23afcba370789fc6372 (patch)
tree0ed5ff426c87969a18e9314265e16d9547e3d1f7 /src/demos
parent5f73e61aea5b72ba75d3cccac848bfb2a2a799d5 (diff)
Changed GLU to be a single class rather than a separate interface and
implementing class. Broke dependence from GLContext and GLAutoDrawable down to GLU package; removed getGLU()/setGLU() routines. A GLU object may now be instantiated via "new GLU()" at any point in the program. When routines on it are called which require an OpenGL context, the GLU implementation fetches the current GLContext and the GL object from within it to do its work via the new public API GLU.getCurrentGL(). This avoids needing to pass down a GL object everywhere or to tie the GLU object to a particular GL object. Restructured GLUT implementation similarly so GL and GLU objects do not need to be passed to it as arguments any more. Restructured all demos to conform to new APIs. Fixed bugs in GlueGen around new functionality of being able to emit only an implementing class with no associated interface. Deleted obsolete GLU-related .cfg files. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JSR-231@135 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos')
-rw-r--r--src/demos/cg/runtime_ogl/cgGL_vertex_example.java2
-rw-r--r--src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java2
-rwxr-xr-xsrc/demos/context/DualContext.java7
-rwxr-xr-xsrc/demos/hdr/HDR.java23
-rw-r--r--src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java30
-rw-r--r--src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java13
-rwxr-xr-xsrc/demos/multisample/Multisample.java3
-rw-r--r--src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java2
-rw-r--r--src/demos/proceduralTexturePhysics/Water.java7
-rw-r--r--src/demos/tess/Tess.java3
-rw-r--r--src/demos/vertexArrayRange/VertexArrayRange.java3
-rw-r--r--src/demos/vertexBufferObject/VertexBufferObject.java3
-rw-r--r--src/demos/vertexProgRefract/VertexProgRefract.java31
-rw-r--r--src/demos/vertexProgWarp/VertexProgWarp.java11
14 files changed, 62 insertions, 78 deletions
diff --git a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
index 0856aed..e8ca280 100644
--- a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
+++ b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
@@ -56,6 +56,7 @@ public class cgGL_vertex_example implements GLEventListener
private final int TextureRes = 512;
+ private GLU glu = new GLU();
private static CGcontext Context = null;
private static CGprogram Program = null;
private static CGparameter KdParam = null;
@@ -225,7 +226,6 @@ public class cgGL_vertex_example implements GLEventListener
CheckCgError();
}
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
InitializeCube(CubeVertices);
diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
index 05ee830..51fe8d5 100644
--- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
+++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
@@ -57,6 +57,7 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
// in as well as handles to the vertex and fragment program used in this
// demo.
+ private GLU glu = new GLU();
CGcontext context;
CGprogram vertexProgram, fragmentProgram;
@@ -131,7 +132,6 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
{
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
// The usual OpenGL stuff to clear the screen and set up viewing.
gl.glClearColor(.25f, .25f, .25f, 1.0f);
diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java
index 01ea2ba..0f9fea9 100755
--- a/src/demos/context/DualContext.java
+++ b/src/demos/context/DualContext.java
@@ -57,6 +57,7 @@ public class DualContext extends Canvas {
private GLDrawable drawable;
private GLContext context1;
private GLContext context2;
+ private GLU glu;
private GLUT glut;
private int repaintNum;
@@ -65,6 +66,7 @@ public class DualContext extends Canvas {
drawable = GLDrawableFactory.getFactory().getGLDrawable(this, capabilities, null);
context1 = drawable.createContext(null);
context2 = drawable.createContext(null);
+ glu = new GLU();
glut = new GLUT();
}
@@ -87,7 +89,6 @@ public class DualContext extends Canvas {
int res = context1.makeCurrent();
if (res != GLContext.CONTEXT_NOT_CURRENT) {
clearAndDraw(context1.getGL(),
- context1.getGLU(),
1, 0, 0,
0, 0, mid, height, str);
context1.release();
@@ -96,7 +97,6 @@ public class DualContext extends Canvas {
res = context2.makeCurrent();
if (res != GLContext.CONTEXT_NOT_CURRENT) {
clearAndDraw(context2.getGL(),
- context2.getGLU(),
0, 0, 1,
mid, 0, width - mid, height, str);
context2.release();
@@ -106,7 +106,6 @@ public class DualContext extends Canvas {
}
private void clearAndDraw(GL gl,
- GLU glu,
float br,
float bg,
float bb,
@@ -125,7 +124,7 @@ public class DualContext extends Canvas {
gl.glLoadIdentity();
glu.gluOrtho2D(x, x + width, y, y + height);
gl.glTranslatef(x + (width - length) / 2, y + height / 2, 0);
- glut.glutStrokeString(gl, GLUT.STROKE_ROMAN, str);
+ glut.glutStrokeString(GLUT.STROKE_ROMAN, str);
}
public static void main(String[] args) {
diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java
index 758472c..ea2cfc5 100755
--- a/src/demos/hdr/HDR.java
+++ b/src/demos/hdr/HDR.java
@@ -236,13 +236,13 @@ public class HDR extends Demo {
private float zFar = 10.0f;
private boolean wire = false;
private boolean toggleWire = false;
+ private GLU glu = new GLU();
public void init(GLAutoDrawable drawable) {
initComplete = false;
// printThreadName("init for Listener");
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
checkExtension(gl, "GL_VERSION_1_3"); // For multitexture
checkExtension(gl, "GL_ARB_pbuffer");
@@ -373,7 +373,6 @@ public class HDR extends Demo {
time.update();
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
// OK, ready to go
if (b[' ']) {
@@ -570,11 +569,10 @@ public class HDR extends Demo {
// drawable.setGL(new DebugGL(drawable.getGL()));
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glEnable(GL.GL_DEPTH_TEST);
// FIXME: what about the ExaminerViewer?
- setPerspectiveProjection(gl, glu, pbuffer_w, pbuffer_h);
+ setPerspectiveProjection(gl, pbuffer_w, pbuffer_h);
GLPbuffer pbuffer = (GLPbuffer) drawable;
int fpmode = pbuffer.getFloatingPointMode();
@@ -615,9 +613,8 @@ public class HDR extends Demo {
// printThreadName("display for PbufferListener");
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
- renderScene(gl, glu);
+ renderScene(gl);
// Copy results back to texture
pipeline.copyToTexture(gl, pbuffer_tex, pbuffer_w, pbuffer_h);
@@ -632,7 +629,7 @@ public class HDR extends Demo {
//
// render scene to float pbuffer
- private void renderScene(GL gl, GLU glu) {
+ private void renderScene(GL gl) {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
if (doViewAll) {
@@ -720,16 +717,16 @@ public class HDR extends Demo {
switch(modelno) {
case 0:
- glut.glutSolidTorus(gl, 0.25, 0.5, 40, 40);
+ glut.glutSolidTorus( 0.25, 0.5, 40, 40);
break;
case 1:
- glut.glutSolidSphere(glu, 0.75f, 40, 40);
+ glut.glutSolidSphere(0.75f, 40, 40);
break;
case 2:
- glut.glutSolidTetrahedron(gl);
+ glut.glutSolidTetrahedron();
break;
case 3:
- glut.glutSolidCube(gl, 1.0f);
+ glut.glutSolidCube(1.0f);
break;
case 4:
// Something about the teapot's geometry causes bad artifacts
@@ -872,7 +869,7 @@ public class HDR extends Demo {
gl.glViewport(x, y, w, h);
}
- private void setPerspectiveProjection(GL gl, GLU glu, int w, int h) {
+ private void setPerspectiveProjection(GL gl, int w, int h) {
// FIXME: what about ExaminerViewer?
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
@@ -973,7 +970,7 @@ public class HDR extends Demo {
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glScalef(10.0f, 10.0f, 10.0f);
- glut.glutSolidCube(gl, 1.0f);
+ glut.glutSolidCube(1.0f);
gl.glPopMatrix();
gl.glDisable(GL.GL_TEXTURE_CUBE_MAP);
diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
index a6415fa..a1d6721 100644
--- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
+++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
@@ -101,6 +101,7 @@ public class HWShadowmapsSimple extends Demo {
private GLPbuffer pbuffer;
+ private GLU glu;
private GLUT glut;
private float[] light_ambient = { 0, 0, 0, 0 };
@@ -177,7 +178,7 @@ public class HWShadowmapsSimple extends Demo {
// drawable.setGL(new DebugGL(drawable.getGL()));
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
+ glu = new GLU();
glut = new GLUT();
try {
@@ -196,14 +197,14 @@ public class HWShadowmapsSimple extends Demo {
decal = genTexture(gl);
gl.glBindTexture(GL.GL_TEXTURE_2D, decal);
BufferedImage img = readPNGImage("demos/data/images/decal_image.png");
- makeRGBTexture(gl, glu, img, GL.GL_TEXTURE_2D, true);
+ makeRGBTexture(gl, img, GL.GL_TEXTURE_2D, true);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
light_image = genTexture(gl);
gl.glBindTexture(GL.GL_TEXTURE_2D, light_image);
img = readPNGImage("demos/data/images/nvlogo_spot.png");
- makeRGBTexture(gl, glu, img, GL.GL_TEXTURE_2D, true);
+ makeRGBTexture(gl, img, GL.GL_TEXTURE_2D, true);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE);
@@ -226,13 +227,13 @@ public class HWShadowmapsSimple extends Demo {
wirecube = gl.glGenLists(1);
gl.glNewList(wirecube, GL.GL_COMPILE);
- glut.glutWireCube(gl, 2);
+ glut.glutWireCube(2);
gl.glEndList();
geometry = gl.glGenLists(1);
gl.glNewList(geometry, GL.GL_COMPILE);
gl.glPushMatrix();
- glut.glutSolidTeapot(gl, 0.8f);
+ glut.glutSolidTeapot(0.8f);
gl.glPopMatrix();
gl.glEndList();
@@ -332,7 +333,6 @@ public class HWShadowmapsSimple extends Demo {
}
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
@@ -349,9 +349,9 @@ public class HWShadowmapsSimple extends Demo {
}
switch (displayMode) {
- case RENDER_SCENE_FROM_CAMERA_VIEW: render_scene_from_camera_view(gl, glu, drawable, params); break;
- case RENDER_SCENE_FROM_CAMERA_VIEW_SHADOWED: render_scene_from_camera_view_shadowed(gl, glu, drawable, params); break;
- case RENDER_SCENE_FROM_LIGHT_VIEW: render_scene_from_light_view(gl, glu, drawable, viewportX, viewportY); break;
+ case RENDER_SCENE_FROM_CAMERA_VIEW: render_scene_from_camera_view(gl, drawable, params); break;
+ case RENDER_SCENE_FROM_CAMERA_VIEW_SHADOWED: render_scene_from_camera_view_shadowed(gl, drawable, params); break;
+ case RENDER_SCENE_FROM_LIGHT_VIEW: render_scene_from_light_view(gl, drawable, viewportX, viewportY); break;
default: throw new RuntimeException("Illegal display mode " + displayMode);
}
}
@@ -405,7 +405,6 @@ public class HWShadowmapsSimple extends Demo {
// drawable.setGL(new DebugGL(drawable.getGL()));
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glEnable(GL.GL_DEPTH_TEST);
@@ -426,7 +425,6 @@ public class HWShadowmapsSimple extends Demo {
public void display(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
@@ -434,7 +432,7 @@ public class HWShadowmapsSimple extends Demo {
((Tweak) tweaks.get(POLYGON_OFFSET_BIAS)).val);
gl.glEnable(GL.GL_POLYGON_OFFSET_FILL);
- render_scene_from_light_view(gl, glu, drawable, 0, 0);
+ render_scene_from_light_view(gl, drawable, 0, 0);
gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
@@ -478,7 +476,7 @@ public class HWShadowmapsSimple extends Demo {
}
}
- private void makeRGBTexture(GL gl, GLU glu, BufferedImage img, int target, boolean mipmapped) {
+ private void makeRGBTexture(GL gl, BufferedImage img, int target, boolean mipmapped) {
ByteBuffer dest = null;
switch (img.getType()) {
case BufferedImage.TYPE_3BYTE_BGR:
@@ -627,7 +625,7 @@ public class HWShadowmapsSimple extends Demo {
gl.glPopMatrix();
}
- private void render_scene_from_camera_view(GL gl, GLU glu, GLAutoDrawable drawable, CameraParameters params) {
+ private void render_scene_from_camera_view(GL gl, GLAutoDrawable drawable, CameraParameters params) {
// place light
gl.glPushMatrix();
gl.glLoadIdentity();
@@ -674,7 +672,7 @@ public class HWShadowmapsSimple extends Demo {
render_light_frustum(gl);
}
- private void render_scene_from_camera_view_shadowed(GL gl, GLU glu, GLAutoDrawable drawable, CameraParameters params) {
+ private void render_scene_from_camera_view_shadowed(GL gl, GLAutoDrawable drawable, CameraParameters params) {
// place light
gl.glPushMatrix();
gl.glLoadIdentity();
@@ -753,7 +751,7 @@ public class HWShadowmapsSimple extends Demo {
gl.glViewport(viewportX, viewportY, size, size);
}
- private void render_scene_from_light_view(GL gl, GLU glu, GLAutoDrawable drawable, int viewportX, int viewportY) {
+ private void render_scene_from_light_view(GL gl, GLAutoDrawable drawable, int viewportX, int viewportY) {
// place light
gl.glPushMatrix();
gl.glLoadIdentity();
diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
index fe1b9d5..e35bdf0 100644
--- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
+++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
@@ -147,6 +147,7 @@ public class InfiniteShadowVolumes extends Demo {
private static final int CLIP_VIEW = 2;
private int curr_view = CAMERA_VIEW;
+ private GLU glu = new GLU();
private GLUT glut = new GLUT();
private GLAutoDrawable drawable;
@@ -177,7 +178,6 @@ public class InfiniteShadowVolumes extends Demo {
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glClearStencil(128);
//glEnable(GL.GL_DEPTH_CLAMP_NV);
@@ -301,7 +301,6 @@ public class InfiniteShadowVolumes extends Demo {
public void display(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
@@ -532,7 +531,7 @@ public class InfiniteShadowVolumes extends Demo {
gl.glDisable(GL.GL_CLIP_PLANE5);
}
- drawLight(gl, glu);
+ drawLight(gl);
gl.glPopMatrix();
@@ -549,7 +548,7 @@ public class InfiniteShadowVolumes extends Demo {
}
gl.glColor3f(.75f,.75f,0);
gl.glLineWidth(3);
- glut.glutWireCube(gl, 2);
+ glut.glutWireCube(2);
gl.glLineWidth(1);
gl.glPopMatrix();
}
@@ -1161,13 +1160,13 @@ public class InfiniteShadowVolumes extends Demo {
// Draw an icon to show where the local light is
// or in what direction the infinite light is pointing.
- private void drawLight(GL gl, GLU glu) {
+ private void drawLight(GL gl) {
gl.glColor3f(1,1,0);
gl.glPushMatrix();
gl.glMultMatrixf(getData(lightManipXform), 0);
gl.glScalef(light_object_scale, light_object_scale, light_object_scale);
if (b['L']) {
- glut.glutSolidSphere(glu, .01f, 20, 10);
+ glut.glutSolidSphere(.01f, 20, 10);
} else {
Vec3f ldir = new Vec3f(light_position.get(0),
light_position.get(1),
@@ -1180,7 +1179,7 @@ public class InfiniteShadowVolumes extends Demo {
gl.glRotatef(180, 1, 0, 0);
gl.glTranslatef(0,0,-0.02f);
gl.glMultMatrixf(getData(m), 0);
- glut.glutSolidCube(gl, 2);
+ glut.glutSolidCube(2);
}
gl.glPopMatrix();
}
diff --git a/src/demos/multisample/Multisample.java b/src/demos/multisample/Multisample.java
index ba8f67d..ff7d7ca 100755
--- a/src/demos/multisample/Multisample.java
+++ b/src/demos/multisample/Multisample.java
@@ -42,7 +42,6 @@ package demos.multisample;
import java.awt.*;
import java.awt.event.*;
import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
import com.sun.opengl.utils.*;
public class Multisample {
@@ -127,7 +126,6 @@ public class Multisample {
class Listener implements GLEventListener {
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glClearColor(0, 0, 0, 0);
// gl.glEnable(GL.GL_DEPTH_TEST);
@@ -142,7 +140,6 @@ public class Multisample {
public void display(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
index 2076368..7599778 100644
--- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
+++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
@@ -38,7 +38,6 @@ import java.awt.event.*;
import javax.swing.*;
import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
import com.sun.opengl.utils.*;
import demos.common.*;
import demos.util.*;
@@ -210,7 +209,6 @@ public class ProceduralTexturePhysics extends Demo {
}
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java
index d0585fc..404d012 100644
--- a/src/demos/proceduralTexturePhysics/Water.java
+++ b/src/demos/proceduralTexturePhysics/Water.java
@@ -63,6 +63,8 @@ public class Water {
// used to render the water geometry (with the parent drawable's GL
// object).
+ private GLU glu = new GLU();
+
// Rendering modes
public static final int CA_FULLSCREEN_REFLECT = 0;
public static final int CA_FULLSCREEN_FORCE = 1;
@@ -424,9 +426,8 @@ public class Water {
class Listener implements GLEventListener {
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
- initOpenGL(gl, glu);
+ initOpenGL(gl);
}
public void display(GLAutoDrawable drawable) {
@@ -488,7 +489,7 @@ public class Water {
initialMapDimensions[1] = initialMap.getHeight();
}
- private void initOpenGL(GL gl, GLU glu) {
+ private void initOpenGL(GL gl) {
loadTextures(gl, tmpSpinFilename, tmpDropletFilename, tmpCubeMapFilenamePattern);
tmpSpinFilename = null;
tmpDropletFilename = null;
diff --git a/src/demos/tess/Tess.java b/src/demos/tess/Tess.java
index 8706c0d..d4c9729 100644
--- a/src/demos/tess/Tess.java
+++ b/src/demos/tess/Tess.java
@@ -99,14 +99,13 @@ public class Tess {
public static class TessRenderer implements GLEventListener {
private GL gl;
- private GLU glu;
+ private GLU glu = new GLU();
private int startList;
public void init(GLAutoDrawable drawable) {
drawable.setGL(new DebugGL(drawable.getGL()));
gl = drawable.getGL();
- glu = drawable.getGLU();
double[][] rect = new double[][]{{50.0, 50.0, 0.0},
{200.0, 50.0, 0.0},
diff --git a/src/demos/vertexArrayRange/VertexArrayRange.java b/src/demos/vertexArrayRange/VertexArrayRange.java
index e355cdc..60d2ba8 100644
--- a/src/demos/vertexArrayRange/VertexArrayRange.java
+++ b/src/demos/vertexArrayRange/VertexArrayRange.java
@@ -141,6 +141,7 @@ public class VertexArrayRange extends Demo {
// Internals only below this point
//
+ private GLU glu = new GLU();
private boolean[] b = new boolean[256];
private static final int SIZEOF_FLOAT = 4;
private static final int STRIP_SIZE = 48;
@@ -273,7 +274,6 @@ public class VertexArrayRange extends Demo {
// drawable.setGL(new DebugGL(drawable.getGL()));
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
// Try and disable synch-to-retrace for fastest framerate
gl.setSwapInterval(0);
@@ -452,7 +452,6 @@ public class VertexArrayRange extends Demo {
public void display(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
// Check to see whether to animate
if (getFlag(' ')) {
diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java
index f8f9a8d..ef485bd 100644
--- a/src/demos/vertexBufferObject/VertexBufferObject.java
+++ b/src/demos/vertexBufferObject/VertexBufferObject.java
@@ -130,6 +130,7 @@ public class VertexBufferObject extends Demo {
// Internals only below this point
//
+ private GLU glu = new GLU();
private boolean initComplete;
private boolean[] b = new boolean[256];
private static final int SIZEOF_FLOAT = 4;
@@ -276,7 +277,6 @@ public class VertexBufferObject extends Demo {
// drawable.setGL(new DebugGL(drawable.getGL()));
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
// Try and disable synch-to-retrace for fastest framerate
gl.setSwapInterval(0);
@@ -451,7 +451,6 @@ public class VertexBufferObject extends Demo {
}
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
// Check to see whether to animate
if (getFlag(' ')) {
diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java
index f8e70f2..fb691bf 100644
--- a/src/demos/vertexProgRefract/VertexProgRefract.java
+++ b/src/demos/vertexProgRefract/VertexProgRefract.java
@@ -104,6 +104,7 @@ public class VertexProgRefract extends Demo {
private int bunnydl;
private int obj;
+ private GLU glu = new GLU();
private GLUT glut = new GLUT();
private GLAutoDrawable drawable;
@@ -225,7 +226,6 @@ public class VertexProgRefract extends Demo {
public void init(GLAutoDrawable drawable) {
initComplete = false;
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
float cc = 1.0f;
gl.glClearColor(cc, cc, cc, 1);
gl.glColor3f(1,1,1);
@@ -278,7 +278,7 @@ public class VertexProgRefract extends Demo {
gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
try {
- loadPNGCubemap(gl, glu, "demos/data/cubemaps/uffizi", true);
+ loadPNGCubemap(gl, "demos/data/cubemaps/uffizi", true);
} catch (IOException e) {
shutdownDemo();
throw new RuntimeException(e);
@@ -342,7 +342,6 @@ public class VertexProgRefract extends Demo {
time.update();
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT);
if (doViewAll) {
@@ -366,7 +365,7 @@ public class VertexProgRefract extends Demo {
// draw background
gl.glDisable(GL.GL_DEPTH_TEST);
- drawSkyBox(gl, glu);
+ drawSkyBox(gl);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glPushMatrix();
@@ -409,13 +408,13 @@ public class VertexProgRefract extends Demo {
if (getFlag('s')) {
// single pass
setRefraction(gl, refract);
- drawObj(gl, glu, obj);
+ drawObj(gl, obj);
} else {
// red pass
gl.glColorMask(true, false, false, false);
setRefraction(gl, refract);
- drawObj(gl, glu, obj);
+ drawObj(gl, obj);
gl.glDepthMask(false);
gl.glDepthFunc(GL.GL_EQUAL);
@@ -423,12 +422,12 @@ public class VertexProgRefract extends Demo {
// green pass
gl.glColorMask(false, true, false, false);
setRefraction(gl, refract + wavelengthDelta);
- drawObj(gl, glu, obj);
+ drawObj(gl, obj);
// blue pass
gl.glColorMask(false, false, true, false);
setRefraction(gl, refract + (wavelengthDelta * 2));
- drawObj(gl, glu, obj);
+ drawObj(gl, obj);
gl.glDepthMask(true);
gl.glDepthFunc(GL.GL_LESS);
@@ -517,7 +516,7 @@ public class VertexProgRefract extends Demo {
GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z };
- private void loadPNGCubemap(GL gl, GLU glu, String baseName, boolean mipmapped) throws IOException {
+ private void loadPNGCubemap(GL gl, String baseName, boolean mipmapped) throws IOException {
for (int i = 0; i < suffixes.length; i++) {
String resourceName = baseName + "_" + suffixes[i] + ".png";
// Note: use of BufferedInputStream works around 4764639/4892246
@@ -525,11 +524,11 @@ public class VertexProgRefract extends Demo {
if (img == null) {
throw new RuntimeException("Error reading PNG image " + resourceName);
}
- makeRGBTexture(gl, glu, img, targets[i], mipmapped);
+ makeRGBTexture(gl, img, targets[i], mipmapped);
}
}
- private void makeRGBTexture(GL gl, GLU glu, BufferedImage img, int target, boolean mipmapped) {
+ private void makeRGBTexture(GL gl, BufferedImage img, int target, boolean mipmapped) {
switch (img.getType()) {
case BufferedImage.TYPE_3BYTE_BGR:
case BufferedImage.TYPE_CUSTOM: {
@@ -640,7 +639,7 @@ public class VertexProgRefract extends Demo {
}
}
- private void drawSkyBox(GL gl, GLU glu) {
+ private void drawSkyBox(GL gl) {
// Compensates for ExaminerViewer's modification of modelview matrix
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
@@ -674,7 +673,7 @@ public class VertexProgRefract extends Demo {
gl.glScalef(1.0f, -1.0f, 1.0f);
viewer.updateInverseRotation(gl);
- glut.glutSolidSphere(glu, 5.0, 40, 20);
+ glut.glutSolidSphere(5.0, 40, 20);
gl.glDisable(GL.GL_LIGHTING);
@@ -686,18 +685,18 @@ public class VertexProgRefract extends Demo {
gl.glDisable(GL.GL_TEXTURE_GEN_R);
}
- private void drawObj(GL gl, GLU glu, int obj) {
+ private void drawObj(GL gl, int obj) {
switch(obj) {
case 0:
gl.glCallList(bunnydl);
break;
case 1:
- glut.glutSolidSphere(glu, 0.5, 64, 64);
+ glut.glutSolidSphere(0.5, 64, 64);
break;
case 2:
- glut.glutSolidTorus(gl, 0.25, 0.5, 64, 64);
+ glut.glutSolidTorus(0.25, 0.5, 64, 64);
break;
case 3:
diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java
index d8ac581..cd39a01 100644
--- a/src/demos/vertexProgWarp/VertexProgWarp.java
+++ b/src/demos/vertexProgWarp/VertexProgWarp.java
@@ -139,12 +139,12 @@ public class VertexProgWarp extends Demo {
private float freq = 8.0f;
private float d = 4.0f;
+ private GLU glu = new GLU();
private ExaminerViewer viewer;
public void init(GLAutoDrawable drawable) {
initComplete = false;
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
float cc = 0.0f;
gl.glClearColor(cc, cc, cc, 1);
@@ -162,7 +162,7 @@ public class VertexProgWarp extends Demo {
for(int i=0; i<NUM_OBJS; i++) {
gl.glNewList(i+1, GL.GL_COMPILE);
- drawObject(gl, glu, i);
+ drawObject(gl, i);
gl.glEndList();
}
@@ -246,7 +246,6 @@ public class VertexProgWarp extends Demo {
time.update();
GL gl = drawable.getGL();
- GLU glu = drawable.getGLU();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
@@ -431,7 +430,7 @@ public class VertexProgWarp extends Demo {
titleSetter.setTitle("SpaceWarp - " + programNames[program]);
}
- private void drawObject(GL gl, GLU glu, int which) {
+ private void drawObject(GL gl, int which) {
switch(which) {
case 0:
drawSphere(gl, 0.5f, 100, 100);
@@ -455,7 +454,7 @@ public class VertexProgWarp extends Demo {
break;
case 4:
- drawCylinder(gl, glu);
+ drawCylinder(gl);
break;
}
}
@@ -605,7 +604,7 @@ public class VertexProgWarp extends Demo {
}
}
- private void drawCylinder(GL gl, GLU glu) {
+ private void drawCylinder(GL gl) {
GLUquadric quad;
quad = glu.gluNewQuadric();