diff --git a/src/java/org/lwjgl/opengl/glu/Cylinder.java b/src/java/org/lwjgl/opengl/glu/Cylinder.java index 8c365c68..0f28977f 100644 --- a/src/java/org/lwjgl/opengl/glu/Cylinder.java +++ b/src/java/org/lwjgl/opengl/glu/Cylinder.java @@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11; * Created 23-dec-2003 * @author Erik Duijs */ -public class Cylinder extends Quadric implements GLUConstants { +public class Cylinder extends Quadric { /** * Constructor for Cylinder. @@ -49,19 +49,19 @@ public class Cylinder extends Quadric implements GLUConstants { float x, y, z, nz, nsign; int i, j; - if (super.orientation == GLU_INSIDE) { + if (super.orientation == GLU.GLU_INSIDE) { nsign = -1.0f; } else { nsign = 1.0f; } - da = 2.0f * PI / slices; + 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_POINT) { + if (super.drawStyle == GLU.GLU_POINT) { GL11.glBegin(GL11.GL_POINTS); for (i = 0; i < slices; i++) { x = cos((i * da)); @@ -77,9 +77,9 @@ public class Cylinder extends Quadric implements GLUConstants { } } GL11.glEnd(); - } else if (super.drawStyle == GLU_LINE || super.drawStyle == GLU_SILHOUETTE) { + } else if (super.drawStyle == GLU.GLU_LINE || super.drawStyle == GLU.GLU_SILHOUETTE) { // Draw rings - if (super.drawStyle == GLU_LINE) { + if (super.drawStyle == GLU.GLU_LINE) { z = 0.0f; r = baseRadius; for (j = 0; j <= stacks; j++) { @@ -125,7 +125,7 @@ public class Cylinder extends Quadric implements GLUConstants { GL11.glVertex3f((x * topRadius), (y * topRadius), (height)); } GL11.glEnd(); - } else if (super.drawStyle == GLU_FILL) { + } else if (super.drawStyle == GLU.GLU_FILL) { float ds = 1.0f / slices; float dt = 1.0f / stacks; float t = 0.0f; diff --git a/src/java/org/lwjgl/opengl/glu/Disk.java b/src/java/org/lwjgl/opengl/glu/Disk.java index d54a5c90..2d6f77d7 100644 --- a/src/java/org/lwjgl/opengl/glu/Disk.java +++ b/src/java/org/lwjgl/opengl/glu/Disk.java @@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11; * Created 23-dec-2003 * @author Erik Duijs */ -public class Disk extends Quadric implements GLUConstants { +public class Disk extends Quadric { /** * Constructor for Disk. @@ -41,8 +41,8 @@ public class Disk extends Quadric implements GLUConstants { float da, dr; /* Normal vectors */ - if (super.normals != GLU_NONE) { - if (super.orientation == GLU_OUTSIDE) { + if (super.normals != GLU.GLU_NONE) { + if (super.orientation == GLU.GLU_OUTSIDE) { GL11.glNormal3f(0.0f, 0.0f, +1.0f); } else { @@ -50,11 +50,11 @@ public class Disk extends Quadric implements GLUConstants { } } - da = 2.0f * PI / slices; + da = 2.0f * GLU.PI / slices; dr = (outerRadius - innerRadius) / loops; switch (super.drawStyle) { - case GLU_FILL: + 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] @@ -66,7 +66,7 @@ public class Disk extends Quadric implements GLUConstants { int l; for (l = 0; l < loops; l++) { float r2 = r1 + dr; - if (super.orientation == GLU_OUTSIDE) { + if (super.orientation == GLU.GLU_OUTSIDE) { int s; GL11.glBegin(GL11.GL_QUAD_STRIP); for (s = 0; s <= slices; s++) { @@ -106,7 +106,7 @@ public class Disk extends Quadric implements GLUConstants { } break; } - case GLU_LINE: + case GLU.GLU_LINE: { int l, s; /* draw loops */ @@ -133,7 +133,7 @@ public class Disk extends Quadric implements GLUConstants { } break; } - case GLU_POINT: + case GLU.GLU_POINT: { int s; GL11.glBegin(GL11.GL_POINTS); @@ -150,12 +150,12 @@ public class Disk extends Quadric implements GLUConstants { GL11.glEnd(); break; } - case GLU_SILHOUETTE: + case GLU.GLU_SILHOUETTE: { if (innerRadius != 0.0) { float a; GL11.glBegin(GL11.GL_LINE_LOOP); - for (a = 0.0f; a < 2.0 * PI; a += da) { + 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); @@ -165,7 +165,7 @@ public class Disk extends Quadric implements GLUConstants { { float a; GL11.glBegin(GL11.GL_LINE_LOOP); - for (a = 0; a < 2.0f * PI; a += da) { + for (a = 0; a < 2.0f * GLU.PI; a += da) { float x = outerRadius * sin(a); float y = outerRadius * cos(a); GL11.glVertex2f(x, y); diff --git a/src/java/org/lwjgl/opengl/glu/GLU.java b/src/java/org/lwjgl/opengl/glu/GLU.java index 8eaaaaea..d6be8489 100644 --- a/src/java/org/lwjgl/opengl/glu/GLU.java +++ b/src/java/org/lwjgl/opengl/glu/GLU.java @@ -14,7 +14,185 @@ import org.lwjgl.opengl.GL12; * Created 23-dec-2003 * @author Erik Duijs */ -public class GLU implements GLUConstants { +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 diff --git a/src/java/org/lwjgl/opengl/glu/GLUConstants.java b/src/java/org/lwjgl/opengl/glu/GLUConstants.java deleted file mode 100644 index d1aa7f51..00000000 --- a/src/java/org/lwjgl/opengl/glu/GLUConstants.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.lwjgl.opengl.glu; - -/** - * $Id$ - * - * GLU constants. - * - * NOTE: this was lifted from LWJGL 0.6 with some minor modifications. - * - * @author cix_foo - * @version $Revision$ - */ -public interface GLUConstants { - - public 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; -} diff --git a/src/java/org/lwjgl/opengl/glu/MipMap.java b/src/java/org/lwjgl/opengl/glu/MipMap.java index bb790711..abc44a84 100644 --- a/src/java/org/lwjgl/opengl/glu/MipMap.java +++ b/src/java/org/lwjgl/opengl/glu/MipMap.java @@ -11,7 +11,7 @@ import org.lwjgl.opengl.GL11; * Created 11-jan-2004 * @author Erik Duijs */ -public class MipMap extends Util implements GLUConstants { +public class MipMap extends Util { /** * Method gluBuild2DMipmaps @@ -41,7 +41,7 @@ public class MipMap extends Util implements GLUConstants { int neww, newh, level, bpp; boolean done; - if (width < 1 || height < 1) return GLU_INVALID_VALUE; + if (width < 1 || height < 1) return GLU.GLU_INVALID_VALUE; maxSize = glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE); @@ -56,7 +56,7 @@ public class MipMap extends Util implements GLUConstants { bpp = bytesPerPixel(format, type); if (bpp == 0) { - return GLU_INVALID_ENUM; + return GLU.GLU_INVALID_ENUM; } // Get current glPixelStore state @@ -152,7 +152,7 @@ public class MipMap extends Util implements GLUConstants { components = compPerPix(format); if (components == -1) { - return GLU_INVALID_ENUM; + return GLU.GLU_INVALID_ENUM; } // temp image data @@ -206,7 +206,7 @@ public class MipMap extends Util implements GLUConstants { break; default : - return GLU_INVALID_ENUM; + return GLU.GLU_INVALID_ENUM; } // Do scaling @@ -279,9 +279,9 @@ public class MipMap extends Util implements GLUConstants { break; default : - return GLU_INVALID_ENUM; + return GLU.GLU_INVALID_ENUM; } return 0; } -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/glu/PartialDisk.java b/src/java/org/lwjgl/opengl/glu/PartialDisk.java index a61a5787..f4ac066c 100644 --- a/src/java/org/lwjgl/opengl/glu/PartialDisk.java +++ b/src/java/org/lwjgl/opengl/glu/PartialDisk.java @@ -10,7 +10,7 @@ import org.lwjgl.opengl.GL11; * * @author Erik Duijs */ -public class PartialDisk extends Quadric implements GLUConstants { +public class PartialDisk extends Quadric { private static final int CACHE_SIZE = 240; @@ -36,7 +36,7 @@ public class PartialDisk extends Quadric implements GLUConstants { * * With respect to orientation, the +z side of the partial disk is * considered to be outside (see gluQuadricOrientation). This means that if - * the orientation is set to GLU_OUTSIDE, then any normals generated point + * the orientation is set to GLU.GLU_OUTSIDE, then any normals generated point * along the +z axis. Otherwise, they point along the -z axis. * * If texturing is turned on (with gluQuadricTexture), texture coordinates @@ -72,7 +72,7 @@ public class PartialDisk extends Quadric implements GLUConstants { || outerRadius <= 0.0f || innerRadius < 0.0f || innerRadius > outerRadius) { - //gluQuadricError(qobj, GLU_INVALID_VALUE); + //gluQuadricError(qobj, GLU.GLU_INVALID_VALUE); System.err.println("PartialDisk: GLU_INVALID_VALUE"); return; } @@ -97,9 +97,9 @@ public class PartialDisk extends Quadric implements GLUConstants { /* Cache is the vertex locations cache */ - angleOffset = startAngle / 180.0f * PI; + angleOffset = startAngle / 180.0f * GLU.PI; for (i = 0; i <= slices; i++) { - angle = angleOffset + ((PI * sweepAngle) / 180.0f) * i / slices; + angle = angleOffset + ((GLU.PI * sweepAngle) / 180.0f) * i / slices; sinCache[i] = sin(angle); cosCache[i] = cos(angle); } @@ -110,21 +110,21 @@ public class PartialDisk extends Quadric implements GLUConstants { } switch (super.normals) { - case GLU_FLAT : - case GLU_SMOOTH : - if (super.orientation == GLU_OUTSIDE) { + case GLU.GLU_FLAT : + case GLU.GLU_SMOOTH : + if (super.orientation == GLU.GLU_OUTSIDE) { GL11.glNormal3f(0.0f, 0.0f, 1.0f); } else { GL11.glNormal3f(0.0f, 0.0f, -1.0f); } break; default : - case GLU_NONE : + case GLU.GLU_NONE : break; } switch (super.drawStyle) { - case GLU_FILL : + case GLU.GLU_FILL : if (innerRadius == .0f) { finish = loops - 1; /* Triangle strip for inner polygons */ @@ -138,7 +138,7 @@ public class PartialDisk extends Quadric implements GLUConstants { texLow = radiusLow / outerRadius / 2; } - if (super.orientation == GLU_OUTSIDE) { + if (super.orientation == GLU.GLU_OUTSIDE) { for (i = slices; i >= 0; i--) { if (super.textureFlag) { GL11.glTexCoord2f( @@ -171,7 +171,7 @@ public class PartialDisk extends Quadric implements GLUConstants { GL11.glBegin(GL11.GL_QUAD_STRIP); for (i = 0; i <= slices; i++) { - if (super.orientation == GLU_OUTSIDE) { + if (super.orientation == GLU.GLU_OUTSIDE) { if (super.textureFlag) { GL11.glTexCoord2f( texLow * sinCache[i] + 0.5f, @@ -210,7 +210,7 @@ public class PartialDisk extends Quadric implements GLUConstants { GL11.glEnd(); } break; - case GLU_POINT : + case GLU.GLU_POINT : GL11.glBegin(GL11.GL_POINTS); for (i = 0; i < slices2; i++) { sintemp = sinCache[i]; @@ -230,7 +230,7 @@ public class PartialDisk extends Quadric implements GLUConstants { } GL11.glEnd(); break; - case GLU_LINE : + case GLU.GLU_LINE : if (innerRadius == outerRadius) { GL11.glBegin(GL11.GL_LINE_STRIP); @@ -280,7 +280,7 @@ public class PartialDisk extends Quadric implements GLUConstants { GL11.glEnd(); } break; - case GLU_SILHOUETTE : + case GLU.GLU_SILHOUETTE : if (sweepAngle < 360.0f) { for (i = 0; i <= slices; i += slices) { sintemp = sinCache[i]; diff --git a/src/java/org/lwjgl/opengl/glu/PixelStoreState.java b/src/java/org/lwjgl/opengl/glu/PixelStoreState.java index 71a03ff8..44b3dc4b 100644 --- a/src/java/org/lwjgl/opengl/glu/PixelStoreState.java +++ b/src/java/org/lwjgl/opengl/glu/PixelStoreState.java @@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11; * Created 11-jan-2004 * @author Erik Duijs */ -class PixelStoreState extends Util implements GLUConstants { +class PixelStoreState extends Util { public int unpackRowLength = glGetIntegerv(GL11.GL_UNPACK_ROW_LENGTH); public int unpackAlignment = glGetIntegerv(GL11.GL_UNPACK_ALIGNMENT); diff --git a/src/java/org/lwjgl/opengl/glu/Project.java b/src/java/org/lwjgl/opengl/glu/Project.java index 99b1df2f..8e4a4531 100644 --- a/src/java/org/lwjgl/opengl/glu/Project.java +++ b/src/java/org/lwjgl/opengl/glu/Project.java @@ -14,7 +14,7 @@ import java.nio.IntBuffer; * * @author Erik Duijs */ -public class Project extends Util implements GLUConstants { +public class Project extends Util { private static final float[] IDENTITY_MATRIX = new float[] { 1.0f, 0.0f, 0.0f, 0.0f, @@ -159,7 +159,7 @@ public class Project extends Util implements GLUConstants { */ public static void gluPerspective(float fovy, float aspect, float zNear, float zFar) { float sine, cotangent, deltaZ; - float radians = fovy / 2 * PI / 180; + float radians = fovy / 2 * GLU.PI / 180; deltaZ = zFar - zNear; sine = (float)Math.sin(radians); diff --git a/src/java/org/lwjgl/opengl/glu/Quadric.java b/src/java/org/lwjgl/opengl/glu/Quadric.java index 55c80a4a..902fdff4 100644 --- a/src/java/org/lwjgl/opengl/glu/Quadric.java +++ b/src/java/org/lwjgl/opengl/glu/Quadric.java @@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11; * Created 22-dec-2003 * @author Erik Duijs */ -public class Quadric implements GLUConstants { +public class Quadric { protected int drawStyle; protected int orientation; @@ -22,10 +22,10 @@ public class Quadric implements GLUConstants { public Quadric() { super(); - drawStyle = GLUConstants.GLU_FILL; - orientation = GLUConstants.GLU_OUTSIDE; + drawStyle = GLU.GLU_FILL; + orientation = GLU.GLU_OUTSIDE; textureFlag = false; - normals = GLUConstants.GLU_SMOOTH; + normals = GLU.GLU_SMOOTH; } /** diff --git a/src/java/org/lwjgl/opengl/glu/Registry.java b/src/java/org/lwjgl/opengl/glu/Registry.java index dbfab2e8..c45bf671 100644 --- a/src/java/org/lwjgl/opengl/glu/Registry.java +++ b/src/java/org/lwjgl/opengl/glu/Registry.java @@ -7,7 +7,7 @@ package org.lwjgl.opengl.glu; * Created 11-jan-2004 * @author Erik Duijs */ -public class Registry extends Util implements GLUConstants { +public class Registry extends Util { private static final String versionString = "1.3"; private static final String extensionString = @@ -20,9 +20,9 @@ public class Registry extends Util implements GLUConstants { */ public static String gluGetString(int name) { - if (name == GLU_VERSION) { + if (name == GLU.GLU_VERSION) { return versionString; - } else if (name == GLU_EXTENSIONS) { + } else if (name == GLU.GLU_EXTENSIONS) { return extensionString; } return null; diff --git a/src/java/org/lwjgl/opengl/glu/Sphere.java b/src/java/org/lwjgl/opengl/glu/Sphere.java index 654584cc..89e91b95 100644 --- a/src/java/org/lwjgl/opengl/glu/Sphere.java +++ b/src/java/org/lwjgl/opengl/glu/Sphere.java @@ -10,7 +10,7 @@ import org.lwjgl.opengl.GL11; * Created 23-dec-2003 * @author Erik Duijs */ -public class Sphere extends Quadric implements GLUConstants { +public class Sphere extends Quadric { /** * Constructor @@ -44,18 +44,18 @@ public class Sphere extends Quadric implements GLUConstants { boolean normals; float nsign; - normals = super.normals != GLU_NONE; + normals = super.normals != GLU.GLU_NONE; - if (super.orientation == GLU_INSIDE) { + if (super.orientation == GLU.GLU_INSIDE) { nsign = -1.0f; } else { nsign = 1.0f; } - drho = PI / stacks; - dtheta = 2.0f * PI / slices; + drho = GLU.PI / stacks; + dtheta = 2.0f * GLU.PI / slices; - if (super.drawStyle == GLU_FILL) { + if (super.drawStyle == GLU.GLU_FILL) { if (super.textureFlag) { // draw +Z end as a triangle fan GL11.glBegin(GL11.GL_TRIANGLE_FAN); @@ -119,7 +119,7 @@ public class Sphere extends Quadric implements GLUConstants { GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glNormal3f(0.0f, 0.0f, -1.0f); GL11.glVertex3f(0.0f, 0.0f, -radius * nsign); - rho = PI - drho; + rho = GLU.PI - drho; s = 1.0f; for (j = slices; j >= 0; j--) { theta = (j == slices) ? 0.0f : j * dtheta; @@ -134,8 +134,8 @@ public class Sphere extends Quadric implements GLUConstants { GL11.glEnd(); } } else if ( - super.drawStyle == GLU_LINE - || super.drawStyle == GLU_SILHOUETTE) { + super.drawStyle == GLU.GLU_LINE + || super.drawStyle == GLU.GLU_SILHOUETTE) { // draw stack lines for (i = 1; i < stacks; @@ -168,7 +168,7 @@ public class Sphere extends Quadric implements GLUConstants { } GL11.glEnd(); } - } else if (super.drawStyle == GLU_POINT) { + } else if (super.drawStyle == GLU.GLU_POINT) { // top and bottom-most points GL11.glBegin(GL11.GL_POINTS); if (normals) @@ -195,4 +195,4 @@ public class Sphere extends Quadric implements GLUConstants { } } -} \ No newline at end of file +}