diff --git a/src/java/org/lwjgl/Display.java b/src/java/org/lwjgl/Display.java index 5d0fe60d..eef2bc47 100644 --- a/src/java/org/lwjgl/Display.java +++ b/src/java/org/lwjgl/Display.java @@ -57,9 +57,6 @@ public final class Display { /** The current display mode, if created */ private static DisplayMode mode; - /** A pointer to the native display window. On Windows this will be an hWnd. */ - private static int handle; - /** Whether or not the display has been requested to shutdown by the user */ private static boolean closeRequested = false; @@ -180,18 +177,6 @@ public final class Display { return mode.freq; } - /** - * Retrieves the native handle to the created window. The meaning of this value - * is platform specific. Under Win32, it is an HWND. - * - * @return the native handle - * @throws AssertionError if the display has not been created yet. - */ - public static int getHandle() { - assert created : "The display has not been created yet."; - return handle; - } - /** * Returns the operating system windowing platform. This will be one of the * constants defined above. There is no "unknown" platform; a native library port diff --git a/src/java/org/lwjgl/opengl/glu/Cylinder.java b/src/java/org/lwjgl/opengl/glu/Cylinder.java index 3ff4d73f..8c365c68 100644 --- a/src/java/org/lwjgl/opengl/glu/Cylinder.java +++ b/src/java/org/lwjgl/opengl/glu/Cylinder.java @@ -1,6 +1,6 @@ package org.lwjgl.opengl.glu; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; /** * Cylinder.java @@ -62,7 +62,7 @@ public class Cylinder extends Quadric implements GLUConstants { // Z component of normal vectors if (super.drawStyle == GLU_POINT) { - GL.glBegin(GL.GL_POINTS); + GL11.glBegin(GL11.GL_POINTS); for (i = 0; i < slices; i++) { x = cos((i * da)); y = sin((i * da)); @@ -71,60 +71,60 @@ public class Cylinder extends Quadric implements GLUConstants { z = 0.0f; r = baseRadius; for (j = 0; j <= stacks; j++) { - GL.glVertex3f((x * r), (y * r), z); + GL11.glVertex3f((x * r), (y * r), z); z += dz; r += dr; } } - GL.glEnd(); + GL11.glEnd(); } else if (super.drawStyle == GLU_LINE || super.drawStyle == GLU_SILHOUETTE) { // Draw rings if (super.drawStyle == GLU_LINE) { z = 0.0f; r = baseRadius; for (j = 0; j <= stacks; j++) { - GL.glBegin(GL.GL_LINE_LOOP); + 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); - GL.glVertex3f((x * r), (y * r), z); + GL11.glVertex3f((x * r), (y * r), z); } - GL.glEnd(); + GL11.glEnd(); z += dz; r += dr; } } else { // draw one ring at each end if (baseRadius != 0.0) { - GL.glBegin(GL.GL_LINE_LOOP); + 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); - GL.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); + GL11.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); } - GL.glEnd(); - GL.glBegin(GL.GL_LINE_LOOP); + 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); - GL.glVertex3f((x * topRadius), (y * topRadius), height); + GL11.glVertex3f((x * topRadius), (y * topRadius), height); } - GL.glEnd(); + GL11.glEnd(); } } // draw length lines - GL.glBegin(GL.GL_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); - GL.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); - GL.glVertex3f((x * topRadius), (y * topRadius), (height)); + GL11.glVertex3f((x * baseRadius), (y * baseRadius), 0.0f); + GL11.glVertex3f((x * topRadius), (y * topRadius), (height)); } - GL.glEnd(); + GL11.glEnd(); } else if (super.drawStyle == GLU_FILL) { float ds = 1.0f / slices; float dt = 1.0f / stacks; @@ -133,7 +133,7 @@ public class Cylinder extends Quadric implements GLUConstants { r = baseRadius; for (j = 0; j < stacks; j++) { float s = 0.0f; - GL.glBegin(GL.GL_QUAD_STRIP); + GL11.glBegin(GL11.GL_QUAD_STRIP); for (i = 0; i <= slices; i++) { if (i == slices) { x = sin(0.0f); @@ -145,21 +145,21 @@ public class Cylinder extends Quadric implements GLUConstants { if (nsign == 1.0f) { normal3f((x * nsign), (y * nsign), (nz * nsign)); TXTR_COORD(s, t); - GL.glVertex3f((x * r), (y * r), z); + GL11.glVertex3f((x * r), (y * r), z); normal3f((x * nsign), (y * nsign), (nz * nsign)); TXTR_COORD(s, t + dt); - GL.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); + GL11.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); } else { normal3f(x * nsign, y * nsign, nz * nsign); TXTR_COORD(s, t); - GL.glVertex3f((x * r), (y * r), z); + GL11.glVertex3f((x * r), (y * r), z); normal3f(x * nsign, y * nsign, nz * nsign); TXTR_COORD(s, t + dt); - GL.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); + GL11.glVertex3f((x * (r + dr)), (y * (r + dr)), (z + dz)); } s += ds; } // for slices - GL.glEnd(); + GL11.glEnd(); r += dr; t += dt; z += dz; diff --git a/src/java/org/lwjgl/opengl/glu/Disk.java b/src/java/org/lwjgl/opengl/glu/Disk.java index b4787d76..d54a5c90 100644 --- a/src/java/org/lwjgl/opengl/glu/Disk.java +++ b/src/java/org/lwjgl/opengl/glu/Disk.java @@ -1,6 +1,6 @@ package org.lwjgl.opengl.glu; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; /** * Disk.java @@ -43,10 +43,10 @@ public class Disk extends Quadric implements GLUConstants { /* Normal vectors */ if (super.normals != GLU_NONE) { if (super.orientation == GLU_OUTSIDE) { - GL.glNormal3f(0.0f, 0.0f, +1.0f); + GL11.glNormal3f(0.0f, 0.0f, +1.0f); } else { - GL.glNormal3f(0.0f, 0.0f, -1.0f); + GL11.glNormal3f(0.0f, 0.0f, -1.0f); } } @@ -68,7 +68,7 @@ public class Disk extends Quadric implements GLUConstants { float r2 = r1 + dr; if (super.orientation == GLU_OUTSIDE) { int s; - GL.glBegin(GL.GL_QUAD_STRIP); + GL11.glBegin(GL11.GL_QUAD_STRIP); for (s = 0; s <= slices; s++) { float a; if (s == slices) @@ -78,15 +78,15 @@ public class Disk extends Quadric implements GLUConstants { sa = sin(a); ca = cos(a); TXTR_COORD(0.5f + sa * r2 / dtc, 0.5f + ca * r2 / dtc); - GL.glVertex2f(r2 * sa, r2 * ca); + GL11.glVertex2f(r2 * sa, r2 * ca); TXTR_COORD(0.5f + sa * r1 / dtc, 0.5f + ca * r1 / dtc); - GL.glVertex2f(r1 * sa, r1 * ca); + GL11.glVertex2f(r1 * sa, r1 * ca); } - GL.glEnd(); + GL11.glEnd(); } else { int s; - GL.glBegin(GL.GL_QUAD_STRIP); + GL11.glBegin(GL11.GL_QUAD_STRIP); for (s = slices; s >= 0; s--) { float a; if (s == slices) @@ -96,11 +96,11 @@ public class Disk extends Quadric implements GLUConstants { sa = sin(a); ca = cos(a); TXTR_COORD(0.5f - sa * r2 / dtc, 0.5f + ca * r2 / dtc); - GL.glVertex2f(r2 * sa, r2 * ca); + GL11.glVertex2f(r2 * sa, r2 * ca); TXTR_COORD(0.5f - sa * r1 / dtc, 0.5f + ca * r1 / dtc); - GL.glVertex2f(r1 * sa, r1 * ca); + GL11.glVertex2f(r1 * sa, r1 * ca); } - GL.glEnd(); + GL11.glEnd(); } r1 = r2; } @@ -112,31 +112,31 @@ public class Disk extends Quadric implements GLUConstants { /* draw loops */ for (l = 0; l <= loops; l++) { float r = innerRadius + l * dr; - GL.glBegin(GL.GL_LINE_LOOP); + GL11.glBegin(GL11.GL_LINE_LOOP); for (s = 0; s < slices; s++) { float a = s * da; - GL.glVertex2f(r * sin(a), r * cos(a)); + GL11.glVertex2f(r * sin(a), r * cos(a)); } - GL.glEnd(); + GL11.glEnd(); } /* draw spokes */ for (s = 0; s < slices; s++) { float a = s * da; float x = sin(a); float y = cos(a); - GL.glBegin(GL.GL_LINE_STRIP); + GL11.glBegin(GL11.GL_LINE_STRIP); for (l = 0; l <= loops; l++) { float r = innerRadius + l * dr; - GL.glVertex2f(r * x, r * y); + GL11.glVertex2f(r * x, r * y); } - GL.glEnd(); + GL11.glEnd(); } break; } case GLU_POINT: { int s; - GL.glBegin(GL.GL_POINTS); + GL11.glBegin(GL11.GL_POINTS); for (s = 0; s < slices; s++) { float a = s * da; float x = sin(a); @@ -144,33 +144,33 @@ public class Disk extends Quadric implements GLUConstants { int l; for (l = 0; l <= loops; l++) { float r = innerRadius * l * dr; - GL.glVertex2f(r * x, r * y); + GL11.glVertex2f(r * x, r * y); } } - GL.glEnd(); + GL11.glEnd(); break; } case GLU_SILHOUETTE: { if (innerRadius != 0.0) { float a; - GL.glBegin(GL.GL_LINE_LOOP); + GL11.glBegin(GL11.GL_LINE_LOOP); for (a = 0.0f; a < 2.0 * PI; a += da) { float x = innerRadius * sin(a); float y = innerRadius * cos(a); - GL.glVertex2f(x, y); + GL11.glVertex2f(x, y); } - GL.glEnd(); + GL11.glEnd(); } { float a; - GL.glBegin(GL.GL_LINE_LOOP); + GL11.glBegin(GL11.GL_LINE_LOOP); for (a = 0; a < 2.0f * PI; a += da) { float x = outerRadius * sin(a); float y = outerRadius * cos(a); - GL.glVertex2f(x, y); + GL11.glVertex2f(x, y); } - GL.glEnd(); + GL11.glEnd(); } break; } diff --git a/src/java/org/lwjgl/opengl/glu/GLU.java b/src/java/org/lwjgl/opengl/glu/GLU.java index 310b3e7b..d8472ff1 100644 --- a/src/java/org/lwjgl/opengl/glu/GLU.java +++ b/src/java/org/lwjgl/opengl/glu/GLU.java @@ -2,7 +2,7 @@ package org.lwjgl.opengl.glu; import java.nio.ByteBuffer; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; /** * GLU.java @@ -52,7 +52,7 @@ public class GLU extends Util implements GLUConstants { float bottom, float top) { - GL.glOrtho(left, right, bottom, top, -1.0, 1.0); + GL11.glOrtho(left, right, bottom, top, -1.0, 1.0); } /** diff --git a/src/java/org/lwjgl/opengl/glu/MipMap.java b/src/java/org/lwjgl/opengl/glu/MipMap.java index 835a0a64..317c3ded 100644 --- a/src/java/org/lwjgl/opengl/glu/MipMap.java +++ b/src/java/org/lwjgl/opengl/glu/MipMap.java @@ -2,7 +2,7 @@ package org.lwjgl.opengl.glu; import java.nio.ByteBuffer; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; /** * MipMap.java @@ -43,7 +43,7 @@ public class MipMap extends Util implements GLUConstants { if (width < 1 || height < 1) return GLU_INVALID_VALUE; - maxSize = glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE); + maxSize = glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE); w = nearestPower(width); if (w > maxSize) { @@ -63,10 +63,10 @@ public class MipMap extends Util implements GLUConstants { PixelStoreState pss = new PixelStoreState(); // set pixel packing - GL.glPixelStorei(GL.GL_PACK_ROW_LENGTH, 0); - GL.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); - GL.glPixelStorei(GL.GL_PACK_SKIP_ROWS, 0); - GL.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, 0); + GL11.glPixelStorei(GL11.GL_PACK_ROW_LENGTH, 0); + GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); + GL11.glPixelStorei(GL11.GL_PACK_SKIP_ROWS, 0); + GL11.glPixelStorei(GL11.GL_PACK_SKIP_PIXELS, 0); done = false; @@ -86,13 +86,13 @@ public class MipMap extends Util implements GLUConstants { while (!done) { if (image != data) { /* set pixel unpacking */ - GL.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, 0); - GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); - GL.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, 0); - GL.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, 0); + GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0); + GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); + GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, 0); + GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, 0); } - GL.glTexImage2D(target, level, components, w, h, 0, format, type, image); + GL11.glTexImage2D(target, level, components, w, h, 0, format, type, image); if (w == 1 && h == 1) break; @@ -161,21 +161,21 @@ public class MipMap extends Util implements GLUConstants { // Determine bytes per input type switch (typein) { - case GL.GL_UNSIGNED_BYTE : + case GL11.GL_UNSIGNED_BYTE : sizein = 1; break; default : - return GL.GL_INVALID_ENUM; + return GL11.GL_INVALID_ENUM; } // Determine bytes per output type switch (typeOut) { - case GL.GL_UNSIGNED_BYTE : + case GL11.GL_UNSIGNED_BYTE : sizeout = 1; break; default : - return GL.GL_INVALID_ENUM; + return GL11.GL_INVALID_ENUM; } // Get glPixelStore state @@ -194,7 +194,7 @@ public class MipMap extends Util implements GLUConstants { } switch (typein) { - case GL.GL_UNSIGNED_BYTE : + case GL11.GL_UNSIGNED_BYTE : k = 0; dataIn.rewind(); for (i = 0; i < heightIn; i++) { @@ -267,7 +267,7 @@ public class MipMap extends Util implements GLUConstants { } switch (typeOut) { - case GL.GL_UNSIGNED_BYTE : + case GL11.GL_UNSIGNED_BYTE : k = 0; for (i = 0; i < heightOut; i++) { int ubptr = i * rowstride + pss.packSkipRows * rowstride + pss.packSkipPixels * components; diff --git a/src/java/org/lwjgl/opengl/glu/PixelStoreState.java b/src/java/org/lwjgl/opengl/glu/PixelStoreState.java index d9c1002a..ba955f3d 100644 --- a/src/java/org/lwjgl/opengl/glu/PixelStoreState.java +++ b/src/java/org/lwjgl/opengl/glu/PixelStoreState.java @@ -1,6 +1,6 @@ package org.lwjgl.opengl.glu; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; /** * PixelStoreState.java @@ -11,14 +11,14 @@ import org.lwjgl.opengl.GL; */ class PixelStoreState extends Util implements GLUConstants { - public int unpackRowLength = glGetIntegerv(GL.GL_UNPACK_ROW_LENGTH); - public int unpackAlignment = glGetIntegerv(GL.GL_UNPACK_ALIGNMENT); - public int unpackSkipRows = glGetIntegerv(GL.GL_UNPACK_SKIP_ROWS); - public int unpackSkipPixels = glGetIntegerv(GL.GL_UNPACK_SKIP_PIXELS); - public int packRowLength = glGetIntegerv(GL.GL_PACK_ROW_LENGTH); - public int packAlignment = glGetIntegerv(GL.GL_PACK_ALIGNMENT); - public int packSkipRows = glGetIntegerv(GL.GL_PACK_SKIP_ROWS); - public int packSkipPixels = glGetIntegerv(GL.GL_PACK_SKIP_PIXELS); + public int unpackRowLength = glGetIntegerv(GL11.GL_UNPACK_ROW_LENGTH); + public int unpackAlignment = glGetIntegerv(GL11.GL_UNPACK_ALIGNMENT); + public int unpackSkipRows = glGetIntegerv(GL11.GL_UNPACK_SKIP_ROWS); + public int unpackSkipPixels = glGetIntegerv(GL11.GL_UNPACK_SKIP_PIXELS); + public int packRowLength = glGetIntegerv(GL11.GL_PACK_ROW_LENGTH); + public int packAlignment = glGetIntegerv(GL11.GL_PACK_ALIGNMENT); + public int packSkipRows = glGetIntegerv(GL11.GL_PACK_SKIP_ROWS); + public int packSkipPixels = glGetIntegerv(GL11.GL_PACK_SKIP_PIXELS); /** * Constructor for PixelStoreState. @@ -29,25 +29,25 @@ class PixelStoreState extends Util implements GLUConstants { } public void load() { - unpackRowLength = glGetIntegerv(GL.GL_UNPACK_ROW_LENGTH); - unpackAlignment = glGetIntegerv(GL.GL_UNPACK_ALIGNMENT); - unpackSkipRows = glGetIntegerv(GL.GL_UNPACK_SKIP_ROWS); - unpackSkipPixels = glGetIntegerv(GL.GL_UNPACK_SKIP_PIXELS); - packRowLength = glGetIntegerv(GL.GL_PACK_ROW_LENGTH); - packAlignment = glGetIntegerv(GL.GL_PACK_ALIGNMENT); - packSkipRows = glGetIntegerv(GL.GL_PACK_SKIP_ROWS); - packSkipPixels = glGetIntegerv(GL.GL_PACK_SKIP_PIXELS); + unpackRowLength = glGetIntegerv(GL11.GL_UNPACK_ROW_LENGTH); + unpackAlignment = glGetIntegerv(GL11.GL_UNPACK_ALIGNMENT); + unpackSkipRows = glGetIntegerv(GL11.GL_UNPACK_SKIP_ROWS); + unpackSkipPixels = glGetIntegerv(GL11.GL_UNPACK_SKIP_PIXELS); + packRowLength = glGetIntegerv(GL11.GL_PACK_ROW_LENGTH); + packAlignment = glGetIntegerv(GL11.GL_PACK_ALIGNMENT); + packSkipRows = glGetIntegerv(GL11.GL_PACK_SKIP_ROWS); + packSkipPixels = glGetIntegerv(GL11.GL_PACK_SKIP_PIXELS); } public void save() { - GL.glPixelStorei(GL.GL_UNPACK_ROW_LENGTH, unpackRowLength); - GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, unpackAlignment); - GL.glPixelStorei(GL.GL_UNPACK_SKIP_ROWS, unpackSkipRows); - GL.glPixelStorei(GL.GL_UNPACK_SKIP_PIXELS, unpackSkipPixels); - GL.glPixelStorei(GL.GL_PACK_ROW_LENGTH, packRowLength); - GL.glPixelStorei(GL.GL_PACK_ALIGNMENT, packAlignment); - GL.glPixelStorei(GL.GL_PACK_SKIP_ROWS, packSkipRows); - GL.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, packSkipPixels); + GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, unpackRowLength); + GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, unpackAlignment); + GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, unpackSkipRows); + GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, unpackSkipPixels); + GL11.glPixelStorei(GL11.GL_PACK_ROW_LENGTH, packRowLength); + GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, packAlignment); + GL11.glPixelStorei(GL11.GL_PACK_SKIP_ROWS, packSkipRows); + GL11.glPixelStorei(GL11.GL_PACK_SKIP_PIXELS, packSkipPixels); } } diff --git a/src/java/org/lwjgl/opengl/glu/Project.java b/src/java/org/lwjgl/opengl/glu/Project.java index 65c63ed8..070e35ee 100644 --- a/src/java/org/lwjgl/opengl/glu/Project.java +++ b/src/java/org/lwjgl/opengl/glu/Project.java @@ -2,7 +2,7 @@ package org.lwjgl.opengl.glu; import java.nio.FloatBuffer; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; /** * Project.java @@ -64,7 +64,7 @@ public class Project extends Util implements GLUConstants { matrix.put(3 * 4 + 2, -2 * zNear * zFar / deltaZ); matrix.put(3 * 4 + 3, 0); - GL.glMultMatrixf(matrix); + GL11.glMultMatrixf(matrix); } /** @@ -125,8 +125,8 @@ public class Project extends Util implements GLUConstants { matrix.put(1 * 4 + 2, -forward[1]); matrix.put(2 * 4 + 2, -forward[2]); - GL.glMultMatrixf(matrix); - GL.glTranslatef(-eyex, -eyey, -eyez); + GL11.glMultMatrixf(matrix); + GL11.glTranslatef(-eyex, -eyey, -eyez); } /** @@ -148,10 +148,10 @@ public class Project extends Util implements GLUConstants { } /* Translate and scale the picked region to the entire window */ - GL.glTranslatef( + GL11.glTranslatef( (viewport[2] - 2 * (x - viewport[0])) / deltax, (viewport[3] - 2 * (y - viewport[1])) / deltay, 0); - GL.glScalef(viewport[2] / deltax, viewport[3] / deltay, 1.0f); + GL11.glScalef(viewport[2] / deltax, viewport[3] / deltay, 1.0f); } } diff --git a/src/java/org/lwjgl/opengl/glu/Quadric.java b/src/java/org/lwjgl/opengl/glu/Quadric.java index d2a18be3..a925420d 100644 --- a/src/java/org/lwjgl/opengl/glu/Quadric.java +++ b/src/java/org/lwjgl/opengl/glu/Quadric.java @@ -1,6 +1,6 @@ package org.lwjgl.opengl.glu; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; /** * Quadric.java @@ -44,7 +44,7 @@ public class Quadric implements GLUConstants { y /= mag; z /= mag; } - GL.glNormal3f(x, y, z); + GL11.glNormal3f(x, y, z); } /** @@ -152,7 +152,7 @@ public class Quadric implements GLUConstants { } protected void TXTR_COORD(float x, float y) { - if (textureFlag) GL.glTexCoord2f(x,y); + if (textureFlag) GL11.glTexCoord2f(x,y); } diff --git a/src/java/org/lwjgl/opengl/glu/Sphere.java b/src/java/org/lwjgl/opengl/glu/Sphere.java index 9427fbaa..34ebac63 100644 --- a/src/java/org/lwjgl/opengl/glu/Sphere.java +++ b/src/java/org/lwjgl/opengl/glu/Sphere.java @@ -1,7 +1,7 @@ package org.lwjgl.opengl.glu; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; /** * Sphere.java @@ -62,20 +62,20 @@ public class Sphere extends Quadric implements GLUConstants { if (super.drawStyle == GLU_FILL) { if (super.textureFlag) { // draw +Z end as a triangle fan - GL.glBegin(GL.GL_TRIANGLE_FAN); - GL.glNormal3f(0.0f, 0.0f, 1.0f); - GL.glVertex3f(0.0f, 0.0f, nsign * radius); + GL11.glBegin(GL11.GL_TRIANGLE_FAN); + GL11.glNormal3f(0.0f, 0.0f, 1.0f); + GL11.glVertex3f(0.0f, 0.0f, nsign * radius); for (j = 0; j <= slices; j++) { theta = (j == slices) ? 0.0f : j * dtheta; x = -sin(theta) * sin(drho); y = cos(theta) * sin(drho); z = nsign * cos(drho); if (normals) { - GL.glNormal3f(x * nsign, y * nsign, z * nsign); + GL11.glNormal3f(x * nsign, y * nsign, z * nsign); } - GL.glVertex3f(x * radius, y * radius, z * radius); + GL11.glVertex3f(x * radius, y * radius, z * radius); } - GL.glEnd(); + GL11.glEnd(); } ds = 1.0f / slices; @@ -92,7 +92,7 @@ public class Sphere extends Quadric implements GLUConstants { // draw intermediate stacks as quad strips for (i = imin; i < imax; i++) { rho = i * drho; - GL.glBegin(GL.GL_QUAD_STRIP); + GL11.glBegin(GL11.GL_QUAD_STRIP); s = 0.0f; for (j = 0; j <= slices; j++) { theta = (j == slices) ? 0.0f : j * dtheta; @@ -100,29 +100,29 @@ public class Sphere extends Quadric implements GLUConstants { y = cos(theta) * sin(rho); z = nsign * cos(rho); if (normals) { - GL.glNormal3f(x * nsign, y * nsign, z * nsign); + GL11.glNormal3f(x * nsign, y * nsign, z * nsign); } TXTR_COORD(s, t); - GL.glVertex3f(x * radius, y * radius, z * radius); + GL11.glVertex3f(x * radius, y * radius, z * radius); x = -sin(theta) * sin(rho + drho); y = cos(theta) * sin(rho + drho); z = nsign * cos(rho + drho); if (normals) { - GL.glNormal3f(x * nsign, y * nsign, z * nsign); + GL11.glNormal3f(x * nsign, y * nsign, z * nsign); } TXTR_COORD(s, t - dt); s += ds; - GL.glVertex3f(x * radius, y * radius, z * radius); + GL11.glVertex3f(x * radius, y * radius, z * radius); } - GL.glEnd(); + GL11.glEnd(); t -= dt; } if (!super.textureFlag) { // draw -Z end as a triangle fan - GL.glBegin(GL.GL_TRIANGLE_FAN); - GL.glNormal3f(0.0f, 0.0f, -1.0f); - GL.glVertex3f(0.0f, 0.0f, -radius * nsign); + 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; s = 1.0f; t = dt; @@ -132,11 +132,11 @@ public class Sphere extends Quadric implements GLUConstants { y = cos(theta) * sin(rho); z = nsign * cos(rho); if (normals) - GL.glNormal3f(x * nsign, y * nsign, z * nsign); + GL11.glNormal3f(x * nsign, y * nsign, z * nsign); s -= ds; - GL.glVertex3f(x * radius, y * radius, z * radius); + GL11.glVertex3f(x * radius, y * radius, z * radius); } - GL.glEnd(); + GL11.glEnd(); } } else if ( super.drawStyle == GLU_LINE @@ -146,42 +146,42 @@ public class Sphere extends Quadric implements GLUConstants { i < stacks; i++) { // stack line at i==stacks-1 was missing here rho = i * drho; - GL.glBegin(GL.GL_LINE_LOOP); + GL11.glBegin(GL11.GL_LINE_LOOP); for (j = 0; j < slices; j++) { theta = j * dtheta; x = cos(theta) * sin(rho); y = sin(theta) * sin(rho); z = cos(rho); if (normals) - GL.glNormal3f(x * nsign, y * nsign, z * nsign); - GL.glVertex3f(x * radius, y * radius, z * radius); + GL11.glNormal3f(x * nsign, y * nsign, z * nsign); + GL11.glVertex3f(x * radius, y * radius, z * radius); } - GL.glEnd(); + GL11.glEnd(); } // draw slice lines for (j = 0; j < slices; j++) { theta = j * dtheta; - GL.glBegin(GL.GL_LINE_STRIP); + GL11.glBegin(GL11.GL_LINE_STRIP); for (i = 0; i <= stacks; i++) { rho = i * drho; x = cos(theta) * sin(rho); y = sin(theta) * sin(rho); z = cos(rho); if (normals) - GL.glNormal3f(x * nsign, y * nsign, z * nsign); - GL.glVertex3f(x * radius, y * radius, z * radius); + GL11.glNormal3f(x * nsign, y * nsign, z * nsign); + GL11.glVertex3f(x * radius, y * radius, z * radius); } - GL.glEnd(); + GL11.glEnd(); } } else if (super.drawStyle == GLU_POINT) { // top and bottom-most points - GL.glBegin(GL.GL_POINTS); + GL11.glBegin(GL11.GL_POINTS); if (normals) - GL.glNormal3f(0.0f, 0.0f, nsign); - GL.glVertex3f(0.0f, 0.0f, radius); + GL11.glNormal3f(0.0f, 0.0f, nsign); + GL11.glVertex3f(0.0f, 0.0f, radius); if (normals) - GL.glNormal3f(0.0f, 0.0f, -nsign); - GL.glVertex3f(0.0f, 0.0f, -radius); + GL11.glNormal3f(0.0f, 0.0f, -nsign); + GL11.glVertex3f(0.0f, 0.0f, -radius); // loop over stacks for (i = 1; i < stacks - 1; i++) { @@ -192,11 +192,11 @@ public class Sphere extends Quadric implements GLUConstants { y = sin(theta) * sin(rho); z = cos(rho); if (normals) - GL.glNormal3f(x * nsign, y * nsign, z * nsign); - GL.glVertex3f(x * radius, y * radius, z * radius); + GL11.glNormal3f(x * nsign, y * nsign, z * nsign); + GL11.glVertex3f(x * radius, y * radius, z * radius); } } - GL.glEnd(); + GL11.glEnd(); } } diff --git a/src/java/org/lwjgl/opengl/glu/Util.java b/src/java/org/lwjgl/opengl/glu/Util.java index e14c672b..3b991f09 100644 --- a/src/java/org/lwjgl/opengl/glu/Util.java +++ b/src/java/org/lwjgl/opengl/glu/Util.java @@ -5,7 +5,8 @@ import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.opengl.GL; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; /** * Util.java @@ -68,22 +69,22 @@ public class Util { protected static int compPerPix(int format) { /* Determine number of components per pixel */ switch (format) { - case GL.GL_COLOR_INDEX : - case GL.GL_STENCIL_INDEX : - case GL.GL_DEPTH_COMPONENT : - case GL.GL_RED : - case GL.GL_GREEN : - case GL.GL_BLUE : - case GL.GL_ALPHA : - case GL.GL_LUMINANCE : + case GL11.GL_COLOR_INDEX : + case GL11.GL_STENCIL_INDEX : + case GL11.GL_DEPTH_COMPONENT : + case GL11.GL_RED : + case GL11.GL_GREEN : + case GL11.GL_BLUE : + case GL11.GL_ALPHA : + case GL11.GL_LUMINANCE : return 1; - case GL.GL_LUMINANCE_ALPHA : + case GL11.GL_LUMINANCE_ALPHA : return 2; - case GL.GL_RGB : - case GL.GL_BGR : + case GL11.GL_RGB : + case GL12.GL_BGR : return 3; - case GL.GL_RGBA : - case GL.GL_BGRA : + case GL11.GL_RGBA : + case GL12.GL_BGRA : return 4; default : return -1; @@ -129,25 +130,25 @@ public class Util { int n, m; switch (format) { - case GL.GL_COLOR_INDEX : - case GL.GL_STENCIL_INDEX : - case GL.GL_DEPTH_COMPONENT : - case GL.GL_RED : - case GL.GL_GREEN : - case GL.GL_BLUE : - case GL.GL_ALPHA : - case GL.GL_LUMINANCE : + case GL11.GL_COLOR_INDEX : + case GL11.GL_STENCIL_INDEX : + case GL11.GL_DEPTH_COMPONENT : + case GL11.GL_RED : + case GL11.GL_GREEN : + case GL11.GL_BLUE : + case GL11.GL_ALPHA : + case GL11.GL_LUMINANCE : n = 1; break; - case GL.GL_LUMINANCE_ALPHA : + case GL11.GL_LUMINANCE_ALPHA : n = 2; break; - case GL.GL_RGB : - case GL.GL_BGR : + case GL11.GL_RGB : + case GL12.GL_BGR : n = 3; break; - case GL.GL_RGBA : - case GL.GL_BGRA : + case GL11.GL_RGBA : + case GL12.GL_BGRA : n = 4; break; default : @@ -155,28 +156,28 @@ public class Util { } switch (type) { - case GL.GL_UNSIGNED_BYTE : + case GL11.GL_UNSIGNED_BYTE : m = 1; break; - case GL.GL_BYTE : + case GL11.GL_BYTE : m = 1; break; - case GL.GL_BITMAP : + case GL11.GL_BITMAP : m = 1; break; - case GL.GL_UNSIGNED_SHORT : + case GL11.GL_UNSIGNED_SHORT : m = 2; break; - case GL.GL_SHORT : + case GL11.GL_SHORT : m = 2; break; - case GL.GL_UNSIGNED_INT : + case GL11.GL_UNSIGNED_INT : m = 4; break; - case GL.GL_INT : + case GL11.GL_INT : m = 4; break; - case GL.GL_FLOAT : + case GL11.GL_FLOAT : m = 4; break; default : @@ -219,7 +220,7 @@ public class Util { */ protected static int glGetIntegerv(int what) { scratch.rewind(); - GL.glGetInteger(what, scratch); + GL11.glGetInteger(what, scratch); return scratch.get(); }