From: <eli...@us...> - 2008-01-21 20:38:09
|
Revision: 2939 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2939&view=rev Author: elias_naur Date: 2008-01-21 12:38:04 -0800 (Mon, 21 Jan 2008) Log Message: ----------- Moved org.lwjgl.opengl.glu to org.lwjgl.util.glu Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/OpenGLException.java trunk/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java trunk/LWJGL/src/java/org/lwjgl/test/openal/PositionTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/util/glu/ trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java trunk/LWJGL/src/java/org/lwjgl/util/glu/MipMap.java trunk/LWJGL/src/java/org/lwjgl/util/glu/PartialDisk.java trunk/LWJGL/src/java/org/lwjgl/util/glu/PixelStoreState.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Project.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Quadric.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Registry.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Sphere.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Util.java Removed Paths: ------------- trunk/LWJGL/src/java/org/lwjgl/opengl/glu/ trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java trunk/LWJGL/src/java/org/lwjgl/util/glu/MipMap.java trunk/LWJGL/src/java/org/lwjgl/util/glu/PartialDisk.java trunk/LWJGL/src/java/org/lwjgl/util/glu/PixelStoreState.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Project.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Quadric.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Registry.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Sphere.java trunk/LWJGL/src/java/org/lwjgl/util/glu/Util.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/OpenGLException.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/OpenGLException.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/OpenGLException.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -31,8 +31,6 @@ */ package org.lwjgl.opengl; -import org.lwjgl.opengl.glu.GLU; - /** * <p/> * Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error. @@ -51,7 +49,7 @@ } private static String createErrorMessage(int gl_error_code) { - String error_string = GLU.gluErrorString(gl_error_code); + String error_string = Util.translateGLErrorString(gl_error_code); return error_string + " (" + gl_error_code + ")"; } Modified: trunk/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -41,7 +41,7 @@ import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.glu.GLU; +import org.lwjgl.util.glu.GLU; /** * Modified: trunk/LWJGL/src/java/org/lwjgl/test/openal/PositionTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/openal/PositionTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/openal/PositionTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -42,7 +42,7 @@ import org.lwjgl.openal.AL10; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.glu.GLU; +import org.lwjgl.util.glu.GLU; import org.lwjgl.util.WaveData; /** Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -36,7 +36,7 @@ import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.glu.GLU; +import org.lwjgl.util.glu.GLU; import org.lwjgl.util.vector.Vector2f; /** Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -42,7 +42,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.PixelFormat; -import org.lwjgl.opengl.glu.GLU; +import org.lwjgl.util.glu.GLU; import org.lwjgl.util.vector.Vector2f; /** Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -55,7 +55,7 @@ import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GLContext; -import org.lwjgl.opengl.glu.GLU; +import org.lwjgl.util.glu.GLU; public final class VBOIndexTest { Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -55,7 +55,7 @@ import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GLContext; -import org.lwjgl.opengl.glu.GLU; +import org.lwjgl.util.glu.GLU; public final class VBOTest { Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -39,7 +39,7 @@ import org.lwjgl.LWJGLException; import org.lwjgl.opengl.AWTGLCanvas; import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.glu.GLU; +import org.lwjgl.util.glu.GLU; /** * <p> Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -41,7 +41,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Pbuffer; import org.lwjgl.opengl.PixelFormat; -import org.lwjgl.opengl.glu.GLU; +import org.lwjgl.util.glu.GLU; import org.lwjgl.util.vector.Vector2f; /** Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2008-01-21 20:28:53 UTC (rev 2938) +++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -50,8 +50,8 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GLContext; import org.lwjgl.opengl.PixelFormat; -import org.lwjgl.opengl.glu.GLU; -import org.lwjgl.opengl.glu.Sphere; +import org.lwjgl.util.glu.GLU; +import org.lwjgl.util.glu.Sphere; public final class ShadersTest { Copied: trunk/LWJGL/src/java/org/lwjgl/util/glu (from rev 2936, trunk/LWJGL/src/java/org/lwjgl/opengl/glu) Deleted: trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/glu/Cylinder.java 2008-01-21 18:59:12 UTC (rev 2936) +++ trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2002-2004 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opengl.glu; - -import org.lwjgl.opengl.GL11; - -/** - * Cylinder.java - * - * - * Created 23-dec-2003 - * @author Erik Duijs - */ -public class Cylinder extends Quadric { - - /** - * Constructor for Cylinder. - */ - public Cylinder() { - super(); - } - - /** - * draws a cylinder oriented along the z axis. The base of the - * cylinder is placed at z = 0, and the top at z=height. Like a sphere, a - * cylinder is subdivided around the z axis into slices, and along the z axis - * into stacks. - * - * Note that if topRadius is set to zero, then this routine will generate a - * cone. - * - * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then - * any generated normals point away from the z axis. Otherwise, they point - * toward the z axis. - * - * If texturing is turned on (with glu.quadricTexture), then texture - * coordinates are generated so that t ranges linearly from 0.0 at z = 0 to - * 1.0 at z = height, and s ranges from 0.0 at the +y axis, to 0.25 at the +x - * axis, to 0.5 at the -y axis, to 0.75 at the -x axis, and back to 1.0 at the - * +y axis. - * - * @param baseRadius Specifies the radius of the cylinder at z = 0. - * @param topRadius Specifies the radius of the cylinder at z = height. - * @param height Specifies the height of the cylinder. - * @param slices Specifies the number of subdivisions around the z axis. - * @param stacks Specifies the number of subdivisions along the z axis. - */ - public void draw(float baseRadius, float topRadius, float height, int slices, int stacks) { - - float da, r, dr, dz; - float x, y, z, nz, nsign; - int i, j; - - if (super.orientation == GLU.GLU_INSIDE) { - nsign = -1.0f; - } else { - nsign = 1.0f; - } - - da = 2.0f * GLU.PI / slices; - dr = (topRadius - baseRadius) / stacks; - dz = height / stacks; - nz = (baseRadius - topRadius) / height; - // Z component of normal vectors - - if (super.drawStyle == GLU.GLU_POINT) { - GL11.glBegin(GL11.GL_POINTS); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(x * nsign, y * nsign, nz * nsign); - - z = 0.0f; - r = baseRadius; - for (j = 0; j <= stacks; j++) { - GL11.glVertex3f((x * r), (y * r), z); - z += dz; - r += dr; - } - } - GL11.glEnd(); - } else if (super.drawStyle == GLU.GLU_LINE || super.drawStyle == GLU.GLU_SILHOUETTE) { - // Draw rings - if (super.drawStyle == GLU.GLU_LINE) { - z = 0.0f; - r = baseRadius; - for (j = 0; j <= stacks; j++) { - GL11.glBegin(GL11.GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(x * nsign, y * nsign, nz * nsign); - GL11.glVertex3f((x * r), (y * r), z); - } - GL11.glEnd(); - z += dz; - r += dr; - } - } else { - // draw one ring at each end - if (baseRadius != 0.0) { - GL11.glBegin(GL11.GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(x * nsign, y * nsign, nz * nsign); - GL11.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); - } - GL11.glEnd(); - GL11.glBegin(GL11.GL_LINE_LOOP); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(x * nsign, y * nsign, nz * nsign); - GL11.glVertex3f((x * topRadius), (y * topRadius), height); - } - GL11.glEnd(); - } - } - // draw length lines - GL11.glBegin(GL11.GL_LINES); - for (i = 0; i < slices; i++) { - x = cos((i * da)); - y = sin((i * da)); - normal3f(x * nsign, y * nsign, nz * nsign); - GL11.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); - GL11.glVertex3f((x * topRadius), (y * topRadius), (height)); - } - GL11.glEnd(); - } else if (super.drawStyle == GLU.GLU_FILL) { - float ds = 1.0f / slices; - float dt = 1.0f / stacks; - float t = 0.0f; - z = 0.0f; - r = baseRadius; - for (j = 0; j < stacks; j++) { - float s = 0.0f; - GL11.glBegin(GL11.GL_QUAD_STRIP); - for (i = 0; i <= slices; i++) { - if (i == slices) { - x = sin(0.0f); - y = cos(0.0f); - } else { - x = sin((i * da)); - y = cos((i * da)); - } - if (nsign == 1.0f) { - normal3f((x * nsign), (y * nsign), (nz * nsign)); - TXTR_COORD(s, t); - GL11.glVertex3f((x * r), (y * r), z); - normal3f((x * nsign), (y * nsign), (nz * nsign)); - TXTR_COORD(s, t + dt); - GL11.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); - } else { - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t); - GL11.glVertex3f((x * r), (y * r), z); - normal3f(x * nsign, y * nsign, nz * nsign); - TXTR_COORD(s, t + dt); - GL11.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); - } - s += ds; - } // for slices - GL11.glEnd(); - r += dr; - t += dt; - z += dz; - } // for stacks - } - } -} Copied: trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java (from rev 2938, trunk/LWJGL/src/java/org/lwjgl/opengl/glu/Cylinder.java) =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/glu/Cylinder.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.glu; + +import org.lwjgl.opengl.GL11; + +/** + * Cylinder.java + * + * + * Created 23-dec-2003 + * @author Erik Duijs + */ +public class Cylinder extends Quadric { + + /** + * Constructor for Cylinder. + */ + public Cylinder() { + super(); + } + + /** + * draws a cylinder oriented along the z axis. The base of the + * cylinder is placed at z = 0, and the top at z=height. Like a sphere, a + * cylinder is subdivided around the z axis into slices, and along the z axis + * into stacks. + * + * Note that if topRadius is set to zero, then this routine will generate a + * cone. + * + * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then + * any generated normals point away from the z axis. Otherwise, they point + * toward the z axis. + * + * If texturing is turned on (with glu.quadricTexture), then texture + * coordinates are generated so that t ranges linearly from 0.0 at z = 0 to + * 1.0 at z = height, and s ranges from 0.0 at the +y axis, to 0.25 at the +x + * axis, to 0.5 at the -y axis, to 0.75 at the -x axis, and back to 1.0 at the + * +y axis. + * + * @param baseRadius Specifies the radius of the cylinder at z = 0. + * @param topRadius Specifies the radius of the cylinder at z = height. + * @param height Specifies the height of the cylinder. + * @param slices Specifies the number of subdivisions around the z axis. + * @param stacks Specifies the number of subdivisions along the z axis. + */ + public void draw(float baseRadius, float topRadius, float height, int slices, int stacks) { + + float da, r, dr, dz; + float x, y, z, nz, nsign; + int i, j; + + if (super.orientation == GLU.GLU_INSIDE) { + nsign = -1.0f; + } else { + nsign = 1.0f; + } + + da = 2.0f * GLU.PI / slices; + dr = (topRadius - baseRadius) / stacks; + dz = height / stacks; + nz = (baseRadius - topRadius) / height; + // Z component of normal vectors + + if (super.drawStyle == GLU.GLU_POINT) { + GL11.glBegin(GL11.GL_POINTS); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(x * nsign, y * nsign, nz * nsign); + + z = 0.0f; + r = baseRadius; + for (j = 0; j <= stacks; j++) { + GL11.glVertex3f((x * r), (y * r), z); + z += dz; + r += dr; + } + } + GL11.glEnd(); + } else if (super.drawStyle == GLU.GLU_LINE || super.drawStyle == GLU.GLU_SILHOUETTE) { + // Draw rings + if (super.drawStyle == GLU.GLU_LINE) { + z = 0.0f; + r = baseRadius; + for (j = 0; j <= stacks; j++) { + GL11.glBegin(GL11.GL_LINE_LOOP); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(x * nsign, y * nsign, nz * nsign); + GL11.glVertex3f((x * r), (y * r), z); + } + GL11.glEnd(); + z += dz; + r += dr; + } + } else { + // draw one ring at each end + if (baseRadius != 0.0) { + GL11.glBegin(GL11.GL_LINE_LOOP); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(x * nsign, y * nsign, nz * nsign); + GL11.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); + } + GL11.glEnd(); + GL11.glBegin(GL11.GL_LINE_LOOP); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(x * nsign, y * nsign, nz * nsign); + GL11.glVertex3f((x * topRadius), (y * topRadius), height); + } + GL11.glEnd(); + } + } + // draw length lines + GL11.glBegin(GL11.GL_LINES); + for (i = 0; i < slices; i++) { + x = cos((i * da)); + y = sin((i * da)); + normal3f(x * nsign, y * nsign, nz * nsign); + GL11.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); + GL11.glVertex3f((x * topRadius), (y * topRadius), (height)); + } + GL11.glEnd(); + } else if (super.drawStyle == GLU.GLU_FILL) { + float ds = 1.0f / slices; + float dt = 1.0f / stacks; + float t = 0.0f; + z = 0.0f; + r = baseRadius; + for (j = 0; j < stacks; j++) { + float s = 0.0f; + GL11.glBegin(GL11.GL_QUAD_STRIP); + for (i = 0; i <= slices; i++) { + if (i == slices) { + x = sin(0.0f); + y = cos(0.0f); + } else { + x = sin((i * da)); + y = cos((i * da)); + } + if (nsign == 1.0f) { + normal3f((x * nsign), (y * nsign), (nz * nsign)); + TXTR_COORD(s, t); + GL11.glVertex3f((x * r), (y * r), z); + normal3f((x * nsign), (y * nsign), (nz * nsign)); + TXTR_COORD(s, t + dt); + GL11.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); + } else { + normal3f(x * nsign, y * nsign, nz * nsign); + TXTR_COORD(s, t); + GL11.glVertex3f((x * r), (y * r), z); + normal3f(x * nsign, y * nsign, nz * nsign); + TXTR_COORD(s, t + dt); + GL11.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); + } + s += ds; + } // for slices + GL11.glEnd(); + r += dr; + t += dt; + z += dz; + } // for stacks + } + } +} Deleted: trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/glu/Disk.java 2008-01-21 18:59:12 UTC (rev 2936) +++ trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2002-2004 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opengl.glu; - -import org.lwjgl.opengl.GL11; - -/** - * Disk.java - * - * - * Created 23-dec-2003 - * @author Erik Duijs - */ -public class Disk extends Quadric { - - /** - * Constructor for Disk. - */ - public Disk() { - super(); - } - - /** - * renders a disk on the z = 0 plane. The disk has a radius of - * outerRadius, and contains a concentric circular hole with a radius of - * innerRadius. If innerRadius is 0, then no hole is generated. The disk is - * subdivided around the z axis into slices (like pizza slices), and also - * about the z axis into rings (as specified by slices and loops, - * respectively). - * - * With respect to orientation, the +z side of the disk is considered to be - * "outside" (see glu.quadricOrientation). This means that if the orientation - * is set to GLU.OUTSIDE, then any normals generated point along the +z axis. - * Otherwise, they point along the -z axis. - * - * If texturing is turned on (with glu.quadricTexture), texture coordinates are - * generated linearly such that where r=outerRadius, the value at (r, 0, 0) is - * (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at - * (0, -r, 0) it is (0.5, 0). - */ - public void draw(float innerRadius, float outerRadius, int slices, int loops) - { - float da, dr; - - /* Normal vectors */ - if (super.normals != GLU.GLU_NONE) { - if (super.orientation == GLU.GLU_OUTSIDE) { - GL11.glNormal3f(0.0f, 0.0f, +1.0f); - } - else { - GL11.glNormal3f(0.0f, 0.0f, -1.0f); - } - } - - da = 2.0f * GLU.PI / slices; - dr = (outerRadius - innerRadius) / loops; - - switch (super.drawStyle) { - case GLU.GLU_FILL: - { - /* texture of a gluDisk is a cut out of the texture unit square - * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] - * (linear mapping) - */ - float dtc = 2.0f * outerRadius; - float sa, ca; - float r1 = innerRadius; - int l; - for (l = 0; l < loops; l++) { - float r2 = r1 + dr; - if (super.orientation == GLU.GLU_OUTSIDE) { - int s; - GL11.glBegin(GL11.GL_QUAD_STRIP); - for (s = 0; s <= slices; s++) { - float a; - if (s == slices) - a = 0.0f; - else - a = s * da; - sa = sin(a); - ca = cos(a); - TXTR_COORD(0.5f + sa * r2 / dtc, 0.5f + ca * r2 / dtc); - GL11.glVertex2f(r2 * sa, r2 * ca); - TXTR_COORD(0.5f + sa * r1 / dtc, 0.5f + ca * r1 / dtc); - GL11.glVertex2f(r1 * sa, r1 * ca); - } - GL11.glEnd(); - } - else { - int s; - GL11.glBegin(GL11.GL_QUAD_STRIP); - for (s = slices; s >= 0; s--) { - float a; - if (s == slices) - a = 0.0f; - else - a = s * da; - sa = sin(a); - ca = cos(a); - TXTR_COORD(0.5f - sa * r2 / dtc, 0.5f + ca * r2 / dtc); - GL11.glVertex2f(r2 * sa, r2 * ca); - TXTR_COORD(0.5f - sa * r1 / dtc, 0.5f + ca * r1 / dtc); - GL11.glVertex2f(r1 * sa, r1 * ca); - } - GL11.glEnd(); - } - r1 = r2; - } - break; - } - case GLU.GLU_LINE: - { - int l, s; - /* draw loops */ - for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; - GL11.glBegin(GL11.GL_LINE_LOOP); - for (s = 0; s < slices; s++) { - float a = s * da; - GL11.glVertex2f(r * sin(a), r * cos(a)); - } - GL11.glEnd(); - } - /* draw spokes */ - for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); - GL11.glBegin(GL11.GL_LINE_STRIP); - for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; - GL11.glVertex2f(r * x, r * y); - } - GL11.glEnd(); - } - break; - } - case GLU.GLU_POINT: - { - int s; - GL11.glBegin(GL11.GL_POINTS); - for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); - int l; - for (l = 0; l <= loops; l++) { - float r = innerRadius * l * dr; - GL11.glVertex2f(r * x, r * y); - } - } - GL11.glEnd(); - break; - } - case GLU.GLU_SILHOUETTE: - { - if (innerRadius != 0.0) { - float a; - GL11.glBegin(GL11.GL_LINE_LOOP); - for (a = 0.0f; a < 2.0 * GLU.PI; a += da) { - float x = innerRadius * sin(a); - float y = innerRadius * cos(a); - GL11.glVertex2f(x, y); - } - GL11.glEnd(); - } - { - float a; - GL11.glBegin(GL11.GL_LINE_LOOP); - for (a = 0; a < 2.0f * GLU.PI; a += da) { - float x = outerRadius * sin(a); - float y = outerRadius * cos(a); - GL11.glVertex2f(x, y); - } - GL11.glEnd(); - } - break; - } - default: - return; - } - } - -} Copied: trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java (from rev 2938, trunk/LWJGL/src/java/org/lwjgl/opengl/glu/Disk.java) =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/glu/Disk.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.glu; + +import org.lwjgl.opengl.GL11; + +/** + * Disk.java + * + * + * Created 23-dec-2003 + * @author Erik Duijs + */ +public class Disk extends Quadric { + + /** + * Constructor for Disk. + */ + public Disk() { + super(); + } + + /** + * renders a disk on the z = 0 plane. The disk has a radius of + * outerRadius, and contains a concentric circular hole with a radius of + * innerRadius. If innerRadius is 0, then no hole is generated. The disk is + * subdivided around the z axis into slices (like pizza slices), and also + * about the z axis into rings (as specified by slices and loops, + * respectively). + * + * With respect to orientation, the +z side of the disk is considered to be + * "outside" (see glu.quadricOrientation). This means that if the orientation + * is set to GLU.OUTSIDE, then any normals generated point along the +z axis. + * Otherwise, they point along the -z axis. + * + * If texturing is turned on (with glu.quadricTexture), texture coordinates are + * generated linearly such that where r=outerRadius, the value at (r, 0, 0) is + * (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at + * (0, -r, 0) it is (0.5, 0). + */ + public void draw(float innerRadius, float outerRadius, int slices, int loops) + { + float da, dr; + + /* Normal vectors */ + if (super.normals != GLU.GLU_NONE) { + if (super.orientation == GLU.GLU_OUTSIDE) { + GL11.glNormal3f(0.0f, 0.0f, +1.0f); + } + else { + GL11.glNormal3f(0.0f, 0.0f, -1.0f); + } + } + + da = 2.0f * GLU.PI / slices; + dr = (outerRadius - innerRadius) / loops; + + switch (super.drawStyle) { + case GLU.GLU_FILL: + { + /* texture of a gluDisk is a cut out of the texture unit square + * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] + * (linear mapping) + */ + float dtc = 2.0f * outerRadius; + float sa, ca; + float r1 = innerRadius; + int l; + for (l = 0; l < loops; l++) { + float r2 = r1 + dr; + if (super.orientation == GLU.GLU_OUTSIDE) { + int s; + GL11.glBegin(GL11.GL_QUAD_STRIP); + for (s = 0; s <= slices; s++) { + float a; + if (s == slices) + a = 0.0f; + else + a = s * da; + sa = sin(a); + ca = cos(a); + TXTR_COORD(0.5f + sa * r2 / dtc, 0.5f + ca * r2 / dtc); + GL11.glVertex2f(r2 * sa, r2 * ca); + TXTR_COORD(0.5f + sa * r1 / dtc, 0.5f + ca * r1 / dtc); + GL11.glVertex2f(r1 * sa, r1 * ca); + } + GL11.glEnd(); + } + else { + int s; + GL11.glBegin(GL11.GL_QUAD_STRIP); + for (s = slices; s >= 0; s--) { + float a; + if (s == slices) + a = 0.0f; + else + a = s * da; + sa = sin(a); + ca = cos(a); + TXTR_COORD(0.5f - sa * r2 / dtc, 0.5f + ca * r2 / dtc); + GL11.glVertex2f(r2 * sa, r2 * ca); + TXTR_COORD(0.5f - sa * r1 / dtc, 0.5f + ca * r1 / dtc); + GL11.glVertex2f(r1 * sa, r1 * ca); + } + GL11.glEnd(); + } + r1 = r2; + } + break; + } + case GLU.GLU_LINE: + { + int l, s; + /* draw loops */ + for (l = 0; l <= loops; l++) { + float r = innerRadius + l * dr; + GL11.glBegin(GL11.GL_LINE_LOOP); + for (s = 0; s < slices; s++) { + float a = s * da; + GL11.glVertex2f(r * sin(a), r * cos(a)); + } + GL11.glEnd(); + } + /* draw spokes */ + for (s = 0; s < slices; s++) { + float a = s * da; + float x = sin(a); + float y = cos(a); + GL11.glBegin(GL11.GL_LINE_STRIP); + for (l = 0; l <= loops; l++) { + float r = innerRadius + l * dr; + GL11.glVertex2f(r * x, r * y); + } + GL11.glEnd(); + } + break; + } + case GLU.GLU_POINT: + { + int s; + GL11.glBegin(GL11.GL_POINTS); + for (s = 0; s < slices; s++) { + float a = s * da; + float x = sin(a); + float y = cos(a); + int l; + for (l = 0; l <= loops; l++) { + float r = innerRadius * l * dr; + GL11.glVertex2f(r * x, r * y); + } + } + GL11.glEnd(); + break; + } + case GLU.GLU_SILHOUETTE: + { + if (innerRadius != 0.0) { + float a; + GL11.glBegin(GL11.GL_LINE_LOOP); + for (a = 0.0f; a < 2.0 * GLU.PI; a += da) { + float x = innerRadius * sin(a); + float y = innerRadius * cos(a); + GL11.glVertex2f(x, y); + } + GL11.glEnd(); + } + { + float a; + GL11.glBegin(GL11.GL_LINE_LOOP); + for (a = 0; a < 2.0f * GLU.PI; a += da) { + float x = outerRadius * sin(a); + float y = outerRadius * cos(a); + GL11.glVertex2f(x, y); + } + GL11.glEnd(); + } + break; + } + default: + return; + } + } + +} Deleted: trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/glu/GLU.java 2008-01-21 18:59:12 UTC (rev 2936) +++ trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -1,442 +0,0 @@ -/* - * Copyright (c) 2002-2004 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opengl.glu; - -import java.nio.ByteBuffer; - -import org.lwjgl.opengl.ARBImaging; -import org.lwjgl.opengl.EXTFramebufferObject; -import org.lwjgl.opengl.GL11; - -/** - * GLU.java - * - * - * Created 23-dec-2003 - * @author Erik Duijs - */ -public class GLU { - static final float PI = (float)Math.PI; - - /* Errors: (return value 0 = no error) */ - public static final int GLU_INVALID_ENUM = 100900; - public static final int GLU_INVALID_VALUE = 100901; - public static final int GLU_OUT_OF_MEMORY = 100902; - public static final int GLU_INCOMPATIBLE_GL_VERSION = 100903; - - /* StringName */ - public static final int GLU_VERSION = 100800; - public static final int GLU_EXTENSIONS = 100801; - - /* Boolean */ - public static final boolean GLU_TRUE = true; - public static final boolean GLU_FALSE = false; - - - /**** Quadric constants ****/ - - /* QuadricNormal */ - public static final int GLU_SMOOTH = 100000; - public static final int GLU_FLAT = 100001; - public static final int GLU_NONE = 100002; - - /* QuadricDrawStyle */ - public static final int GLU_POINT = 100010; - public static final int GLU_LINE = 100011; - public static final int GLU_FILL = 100012; - public static final int GLU_SILHOUETTE = 100013; - - /* QuadricOrientation */ - public static final int GLU_OUTSIDE = 100020; - public static final int GLU_INSIDE = 100021; - - /* Callback types: */ - /* ERROR = 100103 */ - - - /**** Tesselation constants ****/ - - public static final double TESS_MAX_COORD = 1.0e150; - - /* TessProperty */ - public static final int GLU_TESS_WINDING_RULE = 100140; - public static final int GLU_TESS_BOUNDARY_ONLY = 100141; - public static final int GLU_TESS_TOLERANCE = 100142; - - /* TessWinding */ - public static final int GLU_TESS_WINDING_ODD = 100130; - public static final int GLU_TESS_WINDING_NONZERO = 100131; - public static final int GLU_TESS_WINDING_POSITIVE = 100132; - public static final int GLU_TESS_WINDING_NEGATIVE = 100133; - public static final int GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; - - /* TessCallback */ - public static final int GLU_TESS_BEGIN = 100100; /* void (CALLBACK*)(GLenum type) */ - public static final int GLU_TESS_VERTEX = 100101; /* void (CALLBACK*)(void *data) */ - public static final int GLU_TESS_END = 100102; /* void (CALLBACK*)(void) */ - public static final int GLU_TESS_ERROR = 100103; /* void (CALLBACK*)(GLenum errno) */ - public static final int GLU_TESS_EDGE_FLAG = 100104; /* void (CALLBACK*)(GLboolean boundaryEdge) */ - public static final int GLU_TESS_COMBINE = 100105; /* void (CALLBACK*)(GLdouble coords[3], - void *data[4], - GLfloat weight[4], - void **dataOut) */ - public static final int GLU_TESS_BEGIN_DATA = 100106; /* void (CALLBACK*)(GLenum type, - void *polygon_data) */ - public static final int GLU_TESS_VERTEX_DATA = 100107; /* void (CALLBACK*)(void *data, - void *polygon_data) */ - public static final int GLU_TESS_END_DATA = 100108; /* void (CALLBACK*)(void *polygon_data) */ - public static final int GLU_TESS_ERROR_DATA = 100109; /* void (CALLBACK*)(GLenum errno, - void *polygon_data) */ - public static final int GLU_TESS_EDGE_FLAG_DATA = 100110; /* void (CALLBACK*)(GLboolean boundaryEdge, - void *polygon_data) */ - public static final int GLU_TESS_COMBINE_DATA = 100111; /* void (CALLBACK*)(GLdouble coords[3], - void *data[4], - GLfloat weight[4], - void **dataOut, - void *polygon_data) */ - - /* TessError */ - public static final int GLU_TESS_ERROR1 = 100151; - public static final int GLU_TESS_ERROR2 = 100152; - public static final int GLU_TESS_ERROR3 = 100153; - public static final int GLU_TESS_ERROR4 = 100154; - public static final int GLU_TESS_ERROR5 = 100155; - public static final int GLU_TESS_ERROR6 = 100156; - public static final int GLU_TESS_ERROR7 = 100157; - public static final int GLU_TESS_ERROR8 = 100158; - - public static final int GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; - public static final int GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; - public static final int GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; - public static final int GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; - public static final int GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; - public static final int GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; - - /**** NURBS constants ****/ - - /* NurbsProperty */ - public static final int GLU_AUTO_LOAD_MATRIX = 100200; - public static final int GLU_CULLING = 100201; - public static final int GLU_SAMPLING_TOLERANCE = 100203; - public static final int GLU_DISPLAY_MODE = 100204; - public static final int GLU_PARAMETRIC_TOLERANCE = 100202; - public static final int GLU_SAMPLING_METHOD = 100205; - public static final int GLU_U_STEP = 100206; - public static final int GLU_V_STEP = 100207; - - /* NurbsSampling */ - public static final int GLU_PATH_LENGTH = 100215; - public static final int GLU_PARAMETRIC_ERROR = 100216; - public static final int GLU_DOMAIN_DISTANCE = 100217; - - - /* NurbsTrim */ - public static final int GLU_MAP1_TRIM_2 = 100210; - public static final int GLU_MAP1_TRIM_3 = 100211; - - /* NurbsDisplay */ - /* FILL = 100012 */ - public static final int GLU_OUTLINE_POLYGON = 100240; - public static final int GLU_OUTLINE_PATCH = 100241; - - /* NurbsCallback */ - /* ERROR = 100103 */ - - /* NurbsErrors */ - public static final int GLU_NURBS_ERROR1 = 100251; - public static final int GLU_NURBS_ERROR2 = 100252; - public static final int GLU_NURBS_ERROR3 = 100253; - public static final int GLU_NURBS_ERROR4 = 100254; - public static final int GLU_NURBS_ERROR5 = 100255; - public static final int GLU_NURBS_ERROR6 = 100256; - public static final int GLU_NURBS_ERROR7 = 100257; - public static final int GLU_NURBS_ERROR8 = 100258; - public static final int GLU_NURBS_ERROR9 = 100259; - public static final int GLU_NURBS_ERROR10 = 100260; - public static final int GLU_NURBS_ERROR11 = 100261; - public static final int GLU_NURBS_ERROR12 = 100262; - public static final int GLU_NURBS_ERROR13 = 100263; - public static final int GLU_NURBS_ERROR14 = 100264; - public static final int GLU_NURBS_ERROR15 = 100265; - public static final int GLU_NURBS_ERROR16 = 100266; - public static final int GLU_NURBS_ERROR17 = 100267; - public static final int GLU_NURBS_ERROR18 = 100268; - public static final int GLU_NURBS_ERROR19 = 100269; - public static final int GLU_NURBS_ERROR20 = 100270; - public static final int GLU_NURBS_ERROR21 = 100271; - public static final int GLU_NURBS_ERROR22 = 100272; - public static final int GLU_NURBS_ERROR23 = 100273; - public static final int GLU_NURBS_ERROR24 = 100274; - public static final int GLU_NURBS_ERROR25 = 100275; - public static final int GLU_NURBS_ERROR26 = 100276; - public static final int GLU_NURBS_ERROR27 = 100277; - public static final int GLU_NURBS_ERROR28 = 100278; - public static final int GLU_NURBS_ERROR29 = 100279; - public static final int GLU_NURBS_ERROR30 = 100280; - public static final int GLU_NURBS_ERROR31 = 100281; - public static final int GLU_NURBS_ERROR32 = 100282; - public static final int GLU_NURBS_ERROR33 = 100283; - public static final int GLU_NURBS_ERROR34 = 100284; - public static final int GLU_NURBS_ERROR35 = 100285; - public static final int GLU_NURBS_ERROR36 = 100286; - public static final int GLU_NURBS_ERROR37 = 100287; - - /* Contours types -- obsolete! */ - public static final int GLU_CW = 100120; - public static final int GLU_CCW = 100121; - public static final int GLU_INTERIOR = 100122; - public static final int GLU_EXTERIOR = 100123; - public static final int GLU_UNKNOWN = 100124; - - /* Names without "TESS_" prefix */ - public static final int GLU_BEGIN = GLU_TESS_BEGIN; - public static final int GLU_VERTEX = GLU_TESS_VERTEX; - public static final int GLU_END = GLU_TESS_END; - public static final int GLU_ERROR = GLU_TESS_ERROR; - public static final int GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; - - /** - * Method gluLookAt - * @param eyex - * @param eyey - * @param eyez - * @param centerx - * @param centery - * @param centerz - * @param upx - * @param upy - * @param upz - */ - public static void gluLookAt( - float eyex, - float eyey, - float eyez, - float centerx, - float centery, - float centerz, - float upx, - float upy, - float upz) { - - Project.gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz); - } - - /** - * Method gluOrtho2D - * @param left - * @param right - * @param bottom - * @param top - */ - public static void gluOrtho2D( - float left, - float right, - float bottom, - float top) { - - GL11.glOrtho(left, right, bottom, top, -1.0, 1.0); - } - - /** - * Method gluPerspective - * @param fovy - * @param aspect - * @param zNear - * @param zFar - */ - public static void gluPerspective( - float fovy, - float aspect, - float zNear, - float zFar) { - - Project.gluPerspective(fovy, aspect, zNear, zFar); - } - - /** - * Method gluProject - * @param objx - * @param objy - * @param objz - * @param modelMatrix - * @param projMatrix - * @param viewport - * @param win_pos - * @return - */ - public static boolean gluProject(float objx, float objy, float objz, - float[][] modelMatrix, - float[][] projMatrix, - int[] viewport, - float[] win_pos) - { - return Project.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, win_pos); - } - - /** - * Method gluUnproject - * @param winx - * @param winy - * @param winz - * @param modelMatrix - * @param projMatrix - * @param viewport - * @param obj_pos - * @return - */ - public static boolean gluUnProject(float winx, float winy, float winz, - float[][] modelMatrix, - float[][] projMatrix, - int[] viewport, - float[] obj_pos) - { - return Project.gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, obj_pos); - } - - /** - * Method gluPickMatrix - * @param x - * @param y - * @param width - * @param height - * @param viewport - */ - public static void gluPickMatrix( - float x, - float y, - float width, - float height, - int[] viewport) { - - Project.gluPickMatrix(x, y, width, height, viewport); - } - - /** - * Method gluGetString. - * @param name - * @return String - */ - public static String gluGetString(int name) { - return Registry.gluGetString(name); - } - - /** - * Method gluCheckExtension. - * @param extName - * @param extString - * @return boolean - */ - public static boolean gluCheckExtension(String extName, String extString) { - return Registry.gluCheckExtension(extName, extString); - } - - /** - * Method gluBuild2DMipmaps - * @param target - * @param components - * @param width - * @param height - * @param format - * @param type - * @param data - * @return int - */ - public static int gluBuild2DMipmaps( - int target, - int components, - int width, - int height, - int format, - int type, - ByteBuffer data) { - - return MipMap.gluBuild2DMipmaps(target, components, width, height, format, type, data); - } - - /** - * Method gluScaleImage. - * @param format - * @param widthIn - * @param heightIn - * @param typeIn - * @param dataIn - * @param widthOut - * @param heightOut - * @param typeOut - * @param dataOut - * @return int - */ - public static int gluScaleImage( - int format, - int widthIn, - int heightIn, - int typeIn, - ByteBuffer dataIn, - int widthOut, - int heightOut, - int typeOut, - ByteBuffer dataOut) { - - return MipMap.gluScaleImage(format, widthIn, heightIn, typeIn, dataIn, widthOut, heightOut, typeOut, dataOut); - } - - public static String gluErrorString(int error_code) { - switch (error_code) { - case GL11.GL_NO_ERROR: - return "No error"; - case GL11.GL_INVALID_ENUM: - return "Invalid enum"; - case GL11.GL_INVALID_VALUE: - return "Invalid value"; - case GL11.GL_INVALID_OPERATION: - return "Invalid operation"; - case GL11.GL_STACK_OVERFLOW: - return "Stack overflow"; - case GL11.GL_STACK_UNDERFLOW: - return "Stack underflow"; - case GL11.GL_OUT_OF_MEMORY: - return "Out of memory"; - case ARBImaging.GL_TABLE_TOO_LARGE: - return "Table too large"; - case EXTFramebufferObject.GL_INVALID_FRAMEBUFFER_OPERATION_EXT: - return "Invalid framebuffer operation"; - case GLU.GLU_INVALID_ENUM: - return "Invalid enum (glu)"; - case GLU.GLU_INVALID_VALUE: - return "Invalid value (glu)"; - case GLU.GLU_OUT_OF_MEMORY: - return "Out of memory (glu)"; - default: - return null; - } - } -} Copied: trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java (from rev 2938, trunk/LWJGL/src/java/org/lwjgl/opengl/glu/GLU.java) =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/glu/GLU.java 2008-01-21 20:38:04 UTC (rev 2939) @@ -0,0 +1,425 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.glu; + +import java.nio.ByteBuffer; + +import org.lwjgl.opengl.ARBImaging; +import org.lwjgl.opengl.EXTFramebufferObject; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.Util; + +/** + * GLU.java + * + * + * Created 23-dec-2003 + * @author Erik Duijs + */ +public class GLU { + static final float PI = (float)Math.PI; + + /* Errors: (return value 0 = no error) */ + public static final int GLU_INVALID_ENUM = 100900; + public static final int GLU_INVALID_VALUE = 100901; + public static final int GLU_OUT_OF_MEMORY = 100902; + public static final int GLU_INCOMPATIBLE_GL_VERSION = 100903; + + /* StringName */ + public static final int GLU_VERSION = 100800; + public static final int GLU_EXTENSIONS = 100801; + + /* Boolean */ + public static final boolean GLU_TRUE = true; + public static final boolean GLU_FALSE = false; + + + /**** Quadric constants ****/ + + /* QuadricNormal */ + public static final int GLU_SMOOTH = 100000; + public static final int GLU_FLAT = 100001; + public static final int GLU_NONE = 100002; + + /* QuadricDrawStyle */ + public static final int GLU_POINT = 100010; + public static final int GLU_LINE = 100011; + public static final int GLU_FILL = 100012; + public static final int GLU_SILHOUETTE = 100013; + + /* QuadricOrientation */ + public static final int GLU_OUTSIDE = 100020; + public static final int GLU_INSIDE = 100021; + + /* Callback types: */ + /* ERROR = 100103 */ + + + /**** Tesselation constants ****/ + + public static final double TESS_MAX_COORD = 1.0e150; + + /* TessProperty */ + public static final int GLU_TESS_WINDING_RULE = 100140; + public static final int GLU_TESS_BOUNDARY_ONLY = 100141; + public static final int GLU_TESS_TOLERANCE = 100142; + + /* TessWinding */ + public static final int GLU_TESS_WINDING_ODD = 100130; + public static final int GLU_TESS_WINDING_NONZERO = 100131; + public static final int GLU_TESS_WINDING_POSITIVE = 100132; + public static final int GLU_TESS_WINDING_NEGATIVE = 100133; + public static final int GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + + /* TessCallback */ + public static final int GLU_TESS_BEGIN = 100100; /* void (CALLBACK*)(GLenum type) */ + public static final int GLU_TESS_VERTEX = 100101; /* void (CALLBACK*)(void *data) */ + public static final int GLU_TESS_END = 100102; /* void (CALLBACK*)(void) */ + public static final int GLU_TESS_ERROR = 100103; /* void (CALLBACK*)(GLenum errno) */ + public static final int GLU_TESS_EDGE_FLAG = 100104; /* void (CALLBACK*)(GLboolean boundaryEdge) */ + public static final int GLU_TESS_COMBINE = 100105; /* void (CALLBACK*)(GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **dataOut) */ + public static final int GLU_TESS_BEGIN_DATA = 100106; /* void (CALLBACK*)(GLenum type, + void *polygon_data) */ + public static final int GLU_TESS_VERTEX_DATA = 100107; /* void (CALLBACK*)(void *data, + void *polygon_data) */ + public static final int GLU_TESS_END_DATA = 100108; /* void (CALLBACK*)(void *polygon_data) */ + public static final int GLU_TESS_ERROR_DATA = 100109; /* void (CALLBACK*)(GLenum errno, + void *polygon_data) */ + public static final int GLU_TESS_EDGE_FLAG_DATA = 100110; /* void (CALLBACK*)(GLboolean boundaryEdge, + void *polygon_data) */ + public static final int GLU_TESS_COMBINE_DATA = 100111; /* void (CALLBACK*)(GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **dataOut, + void *polygon_data) */ + + /* TessError */ + public static final int GLU_TESS_ERROR1 = 100151; + public static final int GLU_TESS_ERROR2 = 100152; + public static final int GLU_TESS_ERROR3 = 100153; + public static final int GLU_TESS_ERROR4 = 100154; + public static final int GLU_TESS_ERROR5 = 100155; + public static final int GLU_TESS_ERROR6 = 100156; + public static final int GLU_TESS_ERROR7 = 100157; + public static final int GLU_TESS_ERROR8 = 100158; + + public static final int GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + public static final int GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + public static final int GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + public static final int GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + public static final int GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + public static final int GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + + /**** NURBS constants ****/ + + /* NurbsProperty */ + public static final int GLU_AUTO_LOAD_MATRIX = 100200; + public static final int GLU_CULLING = 100201; + public static final int GLU_SAMPLING_TOLERANCE = 100203; + public static final int GLU_DISPLAY_MODE = 100204; + public static final int GLU_PARAMETRIC_TOLERANCE = 100202; + public static final int GLU_SAMPLING_METHOD = 100205; + public static final int GLU_U_STEP = 100206; + public static final int GLU_V_STEP = 100207; + + /* NurbsSampling */ + public static final int GLU_PATH_LENGTH = 100215; + public static final int GLU_PARAMETRIC_ERROR = 100216; + public static final int GLU_DOMAIN_DISTANCE = 100217; + + + /* NurbsTrim */ + public static final int GLU_MAP1_TRIM_2 = 100210; + public static final ... [truncated message content] |