• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Main repository of MikuMikuStudio


Commit MetaInfo

Revisiona889c6556262b4f9ed62adf4dfdb5e046ab8ee07 (tree)
Time2003-09-04 01:20:52
Authormojomonkey <mojomonkey@75d0...>
Commitermojomonkey

Log Message

Conversion to LWJGL 0.7

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@73 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

Change Summary

Incremental Difference

--- a/src/jme/AbstractGame.java
+++ b/src/jme/AbstractGame.java
@@ -42,7 +42,7 @@ import org.lwjgl.Display;
4242 import org.lwjgl.input.Keyboard;
4343 import org.lwjgl.input.Mouse;
4444 import org.lwjgl.opengl.GL;
45-import org.lwjgl.opengl.GLU;
45+import org.lwjgl.opengl.Window;
4646
4747 /**
4848 * <code>AbstractGame</code> defines a common way to organize the flow of a
@@ -56,18 +56,6 @@ import org.lwjgl.opengl.GLU;
5656
5757 public abstract class AbstractGame {
5858
59- /**
60- * gl is the object to communicate with the OpenGL base context.
61- * This object must be initialized during the initalization phase.
62- */
63- protected GL gl = null;
64-
65- /**
66- * glu is the object to communication with the OpenGL utility context.
67- * This object must be initialized during the initalization phase.
68- */
69- protected GLU glu = null;
70-
7159 //Flag for running the system.
7260 private boolean finished;
7361 //holds all splashscreens
@@ -88,16 +76,15 @@ public abstract class AbstractGame {
8876 initSystem();
8977
9078 //check if user initialized gl and glu;
91- if (null == gl || null == glu) {
79+ if (!Window.isCreated()) {
9280 throw new MonkeyRuntimeException(
93- "The gl and glu contexts"
94- + "must be initialized in the init phase");
81+ "Window must be created during initialization.");
9582 }
9683 showTitle();
9784 initGame();
9885
9986 //main loop
100- while (!finished && !gl.isCloseRequested()) {
87+ while (!finished && !Window.isCloseRequested()) {
10188 //update game state
10289 update();
10390
@@ -105,8 +92,8 @@ public abstract class AbstractGame {
10592 render();
10693
10794 //swap buffers
108- gl.paint();
109- gl.tick();
95+ Window.paint();
96+ Window.update();
11097 }
11198 } catch (Throwable t) {
11299 t.printStackTrace();
@@ -125,11 +112,11 @@ public abstract class AbstractGame {
125112 public final void showTitle() {
126113
127114 for(int i = 0; i < splashScreens.size(); i++) {
128- gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT);
129- gl.loadIdentity();
115+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
116+ GL.glLoadIdentity();
130117 ((SplashScreen)splashScreens.get(i)).render();
131- gl.paint();
132- gl.tick();
118+ Window.paint();
119+ Window.update();
133120 ((SplashScreen)splashScreens.get(i)).holdDisplay();
134121 }
135122 }
--- a/src/jme/controller/BaseFPSController.java
+++ b/src/jme/controller/BaseFPSController.java
@@ -360,8 +360,8 @@ public class BaseFPSController extends AbstractGameController {
360360 Vector view =
361361 entity.getView().subtract(entity.getPosition());
362362
363- float cosTheta = org.lwjgl.Math.cos(angle);
364- float sinTheta = org.lwjgl.Math.sin(angle);
363+ float cosTheta = (float)Math.cos(angle);
364+ float sinTheta = (float)Math.sin(angle);
365365
366366 newView.x = (cosTheta + (1 - cosTheta) * x * x) * view.x;
367367 newView.x += ((1 - cosTheta) * x * y - z * sinTheta) * view.y;
--- a/src/jme/entity/Entity.java
+++ b/src/jme/entity/Entity.java
@@ -41,12 +41,12 @@ import jme.exception.MonkeyRuntimeException;
4141 import jme.geometry.Geometry;
4242 import jme.geometry.bounding.BoundingVolume;
4343 import jme.math.Vector;
44-import jme.physics.PhysicsModule;
45-import jme.system.DisplaySystem;
44+import jme.physics.PhysicsModule;
4645 import jme.entity.camera.Frustum;
4746 import jme.utility.LoggingSystem;
4847
4948 import org.lwjgl.opengl.GL;
49+import org.lwjgl.opengl.Window;
5050
5151 /**
5252 * <code>Entity</code> defines a game entity that consists of a piece of
@@ -65,7 +65,7 @@ import org.lwjgl.opengl.GL;
6565 * <code>Entity</code> to represent something abstract.
6666 *
6767 * @author Mark Powell
68- * @version 0.1.0
68+ * @version $Id: Entity.java,v 1.7 2003-09-03 16:20:52 mojomonkey Exp $
6969 */
7070 public class Entity implements EntityInterface {
7171 /**
@@ -110,9 +110,6 @@ public class Entity implements EntityInterface {
110110 //physics
111111 private PhysicsModule physics;
112112
113- //the gl object for translation and rotation of the entity.
114- protected GL gl;
115-
116113 /**
117114 * Constructor initializes the entity. All attributes of the
118115 * <code>Entity</code> are empty.
@@ -127,11 +124,9 @@ public class Entity implements EntityInterface {
127124 }
128125 children = new ArrayList();
129126 position = new Vector();
130-
131- gl = DisplaySystem.getDisplaySystem().getGL();
132127
133- if(null == gl) {
134- throw new MonkeyGLException("The OpenGL context must be set before " + "using Entity.");
128+ if(!Window.isCreated()) {
129+ throw new MonkeyGLException("Window must be created before Entity.");
135130 }
136131
137132 LoggingSystem.getLoggingSystem().getLogger().log(
@@ -154,8 +149,6 @@ public class Entity implements EntityInterface {
154149 children = new ArrayList();
155150 position = new Vector();
156151
157- gl = DisplaySystem.getDisplaySystem().getGL();
158-
159152 children.add(child);
160153
161154 LoggingSystem.getLoggingSystem().getLogger().log(
@@ -318,12 +311,12 @@ public class Entity implements EntityInterface {
318311 * Each child is then rendered in turn.
319312 */
320313 public void render() {
321- gl.pushMatrix();
322- gl.enable(GL.DEPTH_TEST);
323- gl.translatef(position.x, position.y, position.z);
324- gl.rotatef(roll, 0, 0, 1);
325- gl.rotatef(yaw, 0, 1, 0);
326- gl.rotatef(pitch, 1, 0, 1);
314+ GL.glPushMatrix();
315+ GL.glEnable(GL.GL_DEPTH_TEST);
316+ GL.glTranslatef(position.x, position.y, position.z);
317+ GL.glRotatef(roll, 0, 0, 1);
318+ GL.glRotatef(yaw, 0, 1, 0);
319+ GL.glRotatef(pitch, 1, 0, 1);
327320
328321 //no geometry, so don't render.
329322 if (null != geometry) {
@@ -334,8 +327,8 @@ public class Entity implements EntityInterface {
334327 for (int i = 0; i < children.size(); i++) {
335328 ((Entity)children.get(i)).render();
336329 }
337- gl.disable(GL.DEPTH_TEST);
338- gl.popMatrix();
330+ GL.glDisable(GL.GL_DEPTH_TEST);
331+ GL.glPopMatrix();
339332 }
340333
341334 /**
--- a/src/jme/entity/camera/Camera.java
+++ b/src/jme/entity/camera/Camera.java
@@ -32,10 +32,12 @@
3232
3333 package jme.entity.camera;
3434
35+import org.lwjgl.opengl.GL;
36+import org.lwjgl.opengl.GLU;
37+
3538 import jme.entity.Entity;
3639 import jme.locale.external.feature.Sky;
3740 import jme.math.Vector;
38-import jme.system.DisplaySystem;
3941
4042 /**
4143 * <code>Camera</code> defines a camera in three dimensional space. The camera
@@ -288,20 +290,20 @@ public class Camera extends Entity{
288290 * camera to determine the view.
289291 */
290292 public void render() {
291- DisplaySystem.getDisplaySystem().getGLU().lookAt(
293+ GLU.gluLookAt(
292294 getPosition().x, getPosition().y, getPosition().z,
293295 getView().x, getView().y, getView().z,
294296 getUp().x, getUp().y, getUp().z);
295297
296298 if(null != sky) {
297- gl.pushMatrix();
299+ GL.glPushMatrix();
298300 float x = getPosition().x - sky.getSize() / 2;
299301 float y = getPosition().y - sky.getSize() * 0.75f;
300302 float z = getPosition().z - sky.getSize() / 2;
301- gl.translatef(x, y, z);
303+ GL.glTranslatef(x, y, z);
302304
303305 sky.render();
304- gl.popMatrix();
306+ GL.glPopMatrix();
305307 }
306308
307309 for(int i = 0; i < children.size(); i++) {
--- a/src/jme/entity/camera/Frustum.java
+++ b/src/jme/entity/camera/Frustum.java
@@ -37,10 +37,8 @@ import java.nio.ByteOrder;
3737 import java.nio.FloatBuffer;
3838 import java.util.logging.Level;
3939
40-import jme.system.DisplaySystem;
4140 import jme.utility.LoggingSystem;
4241
43-import org.lwjgl.Sys;
4442 import org.lwjgl.opengl.GL;
4543
4644 /**
@@ -71,7 +69,7 @@ public class Frustum {
7169 *
7270 */
7371 public Frustum() {
74- gl = DisplaySystem.getDisplaySystem().getGL();
72+ //gl = DisplaySystem.getDisplaySystem().getGL();
7573 proj = new float[16];
7674 modl = new float[16];
7775 clip = new float[16];
@@ -99,17 +97,14 @@ public class Frustum {
9997 */
10098 public void update() {
10199 float t;
102-
103- int projPtr = Sys.getDirectBufferAddress(projBuf);
104- gl.getFloatv(GL.PROJECTION_MATRIX, projPtr);
105- projBuf.rewind();
100+ projBuf.clear();
101+ modlBuf.clear();
102+ GL.glGetFloat(GL.GL_PROJECTION_MATRIX, projBuf);
106103 projBuf.get(proj);
107104
108- int modlPtr = Sys.getDirectBufferAddress(modlBuf);
109- gl.getFloatv(GL.MODELVIEW_MATRIX, modlPtr);
110- modlBuf.rewind();
105+ GL.glGetFloat(GL.GL_MODELVIEW_MATRIX, modlBuf);
111106 modlBuf.get(modl);
112-
107+
113108 clip[0] =
114109 modl[0] * proj[0]
115110 + modl[1] * proj[4]
@@ -202,7 +197,7 @@ public class Frustum {
202197
203198 /* Normalize the result */
204199 t =
205- org.lwjgl.Math.sqrt(
200+ (float)Math.sqrt(
206201 frustum[0][0] * frustum[0][0]
207202 + frustum[0][1] * frustum[0][1]
208203 + frustum[0][2] * frustum[0][2]);
@@ -219,7 +214,7 @@ public class Frustum {
219214
220215 /* Normalize the result */
221216 t =
222- org.lwjgl.Math.sqrt(
217+ (float)Math.sqrt(
223218 frustum[1][0] * frustum[1][0]
224219 + frustum[1][1] * frustum[1][1]
225220 + frustum[1][2] * frustum[1][2]);
@@ -236,7 +231,7 @@ public class Frustum {
236231
237232 /* Normalize the result */
238233 t =
239- org.lwjgl.Math.sqrt(
234+ (float)Math.sqrt(
240235 frustum[2][0] * frustum[2][0]
241236 + frustum[2][1] * frustum[2][1]
242237 + frustum[2][2] * frustum[2][2]);
@@ -253,7 +248,7 @@ public class Frustum {
253248
254249 /* Normalize the result */
255250 t =
256- org.lwjgl.Math.sqrt(
251+ (float)Math.sqrt(
257252 frustum[3][0] * frustum[3][0]
258253 + frustum[3][1] * frustum[3][1]
259254 + frustum[3][2] * frustum[3][2]);
@@ -270,7 +265,7 @@ public class Frustum {
270265
271266 /* Normalize the result */
272267 t =
273- org.lwjgl.Math.sqrt(
268+ (float)Math.sqrt(
274269 frustum[4][0] * frustum[4][0]
275270 + frustum[4][1] * frustum[4][1]
276271 + frustum[4][2] * frustum[4][2]);
@@ -287,7 +282,7 @@ public class Frustum {
287282
288283 /* Normalize the result */
289284 t =
290- org.lwjgl.Math.sqrt(
285+ (float)Math.sqrt(
291286 frustum[5][0] * frustum[5][0]
292287 + frustum[5][1] * frustum[5][1]
293288 + frustum[5][2] * frustum[5][2]);
--- a/src/jme/entity/effects/ParticleEmitter.java
+++ b/src/jme/entity/effects/ParticleEmitter.java
@@ -36,11 +36,9 @@ import java.nio.ByteBuffer;
3636 import java.nio.ByteOrder;
3737 import java.nio.FloatBuffer;
3838
39-import org.lwjgl.Sys;
4039 import org.lwjgl.opengl.GL;
4140 import org.lwjgl.vector.Vector3f;
4241
43-import jme.system.DisplaySystem;
4442 import jme.texture.TextureManager;
4543
4644 /**
@@ -64,8 +62,6 @@ import jme.texture.TextureManager;
6462 * @version 1
6563 */
6664 public class ParticleEmitter {
67- //gl object for rendering
68- private GL gl;
6965
7066 //handles the particle objects.
7167 private int numParticles;
@@ -110,7 +106,6 @@ public class ParticleEmitter {
110106 * on screen at any one time.
111107 */
112108 public ParticleEmitter(int numParticles) {
113- gl = DisplaySystem.getDisplaySystem().getGL();
114109
115110 this.numParticles = numParticles;
116111 particles = new Particle[numParticles];
@@ -206,16 +201,15 @@ public class ParticleEmitter {
206201 * effect using two dimensional objects.
207202 */
208203 public void render() {
209- gl.pushMatrix();
204+ GL.glPushMatrix();
210205 //set gl state.
211- gl.enable(GL.TEXTURE_2D);
212- gl.enable(GL.BLEND);
213- gl.blendFunc(GL.SRC_ALPHA, GL.ONE);
206+ GL.glEnable(GL.GL_TEXTURE_2D);
207+ GL.glEnable(GL.GL_BLEND);
208+ GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
214209 TextureManager.getTextureManager().bind(texId);
215210
216211 //get the view matrix for billboarding.
217- int bufPtr = Sys.getDirectBufferAddress(buf);
218- gl.getFloatv(GL.MODELVIEW_MATRIX, bufPtr);
212+ GL.glGetFloat(GL.GL_MODELVIEW_MATRIX, buf);
219213 buf.rewind();
220214 buf.get(matrix);
221215
@@ -230,13 +224,13 @@ public class ParticleEmitter {
230224
231225 //render each particle
232226 for (int i = 0; i < numParticles; i++) {
233- gl.color4f(
227+ GL.glColor4f(
234228 particles[i].color.x,
235229 particles[i].color.y,
236230 particles[i].color.z,
237231 particles[i].life);
238- gl.begin(GL.TRIANGLE_STRIP);
239- gl.texCoord2d(1, 1);
232+ GL.glBegin(GL.GL_TRIANGLE_STRIP);
233+ GL.glTexCoord2f(1, 1);
240234
241235 //top right of quad
242236 billboard.x =
@@ -248,8 +242,8 @@ public class ParticleEmitter {
248242 billboard.z =
249243 (right.z + up.z) * particles[i].size.z
250244 + particles[i].position.z;
251- gl.vertex3f(billboard.x, billboard.y, billboard.z);
252- gl.texCoord2d(0, 1);
245+ GL.glVertex3f(billboard.x, billboard.y, billboard.z);
246+ GL.glTexCoord2f(0, 1);
253247
254248 //top left of quad
255249 billboard.x =
@@ -262,8 +256,8 @@ public class ParticleEmitter {
262256 (up.z - right.z) * particles[i].size.z
263257 + particles[i].position.z;
264258
265- gl.vertex3f(billboard.x, billboard.y, billboard.z);
266- gl.texCoord2d(1, 0);
259+ GL.glVertex3f(billboard.x, billboard.y, billboard.z);
260+ GL.glTexCoord2f(1, 0);
267261
268262 //bottom right of quad
269263 billboard.x =
@@ -273,8 +267,8 @@ public class ParticleEmitter {
273267 billboard.z =
274268 (right.z - up.z) * particles[i].size.z + particles[i].position.z;
275269
276- gl.vertex3f(billboard.x, billboard.y, billboard.z);
277- gl.texCoord2d(0, 0);
270+ GL.glVertex3f(billboard.x, billboard.y, billboard.z);
271+ GL.glTexCoord2f(0, 0);
278272
279273 //bottom left of quad
280274 billboard.x =
@@ -290,15 +284,15 @@ public class ParticleEmitter {
290284 - particles[i].size.z
291285 + particles[i].position.z;
292286
293- gl.vertex3f(billboard.x, billboard.y, billboard.z);
294- gl.end();
287+ GL.glVertex3f(billboard.x, billboard.y, billboard.z);
288+ GL.glEnd();
295289
296290 }
297291
298292 //revert open gl state
299- gl.disable(GL.TEXTURE_2D);
300- gl.disable(GL.BLEND);
301- gl.popMatrix();
293+ GL.glDisable(GL.GL_TEXTURE_2D);
294+ GL.glDisable(GL.GL_BLEND);
295+ GL.glPopMatrix();
302296 }
303297
304298 /**
@@ -399,8 +393,8 @@ public class ParticleEmitter {
399393 public void setTexture(String filename) {
400394 texId = TextureManager.getTextureManager().loadTexture(
401395 filename,
402- GL.LINEAR_MIPMAP_LINEAR,
403- GL.LINEAR,
396+ GL.GL_LINEAR_MIPMAP_LINEAR,
397+ GL.GL_LINEAR,
404398 true);
405399 }
406400
--- a/src/jme/entity/effects/ParticleSystem.java
+++ b/src/jme/entity/effects/ParticleSystem.java
@@ -38,7 +38,6 @@ import org.lwjgl.opengl.GL;
3838 import org.lwjgl.vector.Vector3f;
3939
4040 import jme.entity.EntityInterface;
41-import jme.system.DisplaySystem;
4241 import jme.entity.camera.Frustum;
4342 import jme.geometry.bounding.BoundingVolume;
4443
@@ -47,17 +46,15 @@ import jme.geometry.bounding.BoundingVolume;
4746 * particle emitters.
4847 *
4948 * @author Mark Powell
50- * @version $Id: ParticleSystem.java,v 1.3 2003-08-31 19:49:49 mojomonkey Exp $
49+ * @version $Id: ParticleSystem.java,v 1.4 2003-09-03 16:20:52 mojomonkey Exp $
5150 */
5251 public class ParticleSystem implements EntityInterface {
5352 private ArrayList emitters;
5453 private Vector3f position;
55- private GL gl;
5654 private BoundingVolume boundingVolume;
5755
5856 public ParticleSystem() {
5957 emitters = new ArrayList();
60- gl = DisplaySystem.getDisplaySystem().getGL();
6158 position = new Vector3f();
6259 }
6360
@@ -65,12 +62,12 @@ public class ParticleSystem implements EntityInterface {
6562 * @see jme.entity.EntityInterface#render()
6663 */
6764 public void render() {
68- gl.pushMatrix();
69- gl.translatef(position.x, position.y, position.z);
65+ GL.glPushMatrix();
66+ GL.glTranslatef(position.x, position.y, position.z);
7067 for(int i = 0; i < emitters.size(); i++) {
7168 ((ParticleEmitter)emitters.get(i)).render();
7269 }
73- gl.popMatrix();
70+ GL.glPopMatrix();
7471 }
7572
7673 /**
--- a/src/jme/geometry/hud/SplashScreen.java
+++ b/src/jme/geometry/hud/SplashScreen.java
@@ -33,10 +33,10 @@ package jme.geometry.hud;
3333
3434 import jme.exception.MonkeyGLException;
3535 import jme.exception.MonkeyRuntimeException;
36-import jme.system.DisplaySystem;
3736 import jme.texture.TextureManager;
3837
3938 import org.lwjgl.opengl.GL;
39+import org.lwjgl.opengl.Window;
4040
4141 /**
4242 * <code>SplashScreen</code> creates a screen encompassing splash screen to
@@ -45,10 +45,9 @@ import org.lwjgl.opengl.GL;
4545 * to be displayed for a set amount of time.
4646 *
4747 * @author Mark Powell
48- * @version 0.1.0
48+ * @version $Id: SplashScreen.java,v 1.2 2003-09-03 16:20:51 mojomonkey Exp $
4949 */
5050 public class SplashScreen {
51- private GL gl;
5251 private int texId;
5352 private float x, y;
5453 private float width, height;
@@ -62,17 +61,16 @@ public class SplashScreen {
6261 * the OpenGL context.
6362 */
6463 public SplashScreen() {
65- gl = DisplaySystem.getDisplaySystem().getGL();
66- if(null == gl) {
67- throw new MonkeyGLException("GL is null. Insure Display has been " + "created.");
64+ if(!Window.isCreated()) {
65+ throw new MonkeyGLException("Window must be created first.");
6866 }
6967 red = 1.0f;
7068 blue = 1.0f;
7169 green = 1.0f;
7270 alpha = 1.0f;
7371
74- width = gl.getWidth();
75- height = gl.getHeight();
72+ width = Window.getWidth();
73+ height = Window.getHeight();
7674
7775 isBlended = true;
7876 }
@@ -84,8 +82,8 @@ public class SplashScreen {
8482 public void setTexture(String filename) {
8583 texId = TextureManager.getTextureManager().loadTexture(
8684 filename,
87- GL.LINEAR,
88- GL.LINEAR,
85+ GL.GL_LINEAR,
86+ GL.GL_LINEAR,
8987 true);
9088 }
9189
@@ -169,46 +167,46 @@ public class SplashScreen {
169167
170168 //set the GL states to how we want them.
171169 if(isBlended) {
172- gl.enable(GL.BLEND);
170+ GL.glEnable(GL.GL_BLEND);
173171 }
174- gl.disable(GL.DEPTH_TEST);
175- gl.enable(GL.TEXTURE_2D);
176- gl.matrixMode(GL.PROJECTION);
177- gl.pushMatrix();
178- gl.loadIdentity();
179- gl.ortho(0, gl.getWidth(), 0, gl.getHeight(), -1, 1);
180- gl.matrixMode(GL.MODELVIEW);
181- gl.pushMatrix();
182- gl.loadIdentity();
183- gl.translatef(x,y,0);
184- gl.color4f(red,green,blue,alpha);
172+ GL.glDisable(GL.GL_DEPTH_TEST);
173+ GL.glEnable(GL.GL_TEXTURE_2D);
174+ GL.glMatrixMode(GL.GL_PROJECTION);
175+ GL.glPushMatrix();
176+ GL.glLoadIdentity();
177+ GL.glOrtho(0, Window.getWidth(), 0, Window.getHeight(), -1, 1);
178+ GL.glMatrixMode(GL.GL_MODELVIEW);
179+ GL.glPushMatrix();
180+ GL.glLoadIdentity();
181+ GL.glTranslatef(x,y,0);
182+ GL.glColor4f(red,green,blue,alpha);
185183 TextureManager.getTextureManager().bind(texId);
186184
187- gl.begin(GL.QUADS);
185+ GL.glBegin(GL.GL_QUADS);
188186
189- gl.texCoord2i(0,1);
190- gl.vertex3f(0.0f, height, 0.0f);
187+ GL.glTexCoord2f(0,1);
188+ GL.glVertex3f(0.0f, height, 0.0f);
191189
192- gl.texCoord2i(0,0);
193- gl.vertex3f(0.0f, 0.0f, 0.0f);
190+ GL.glTexCoord2f(0,0);
191+ GL.glVertex3f(0.0f, 0.0f, 0.0f);
194192
195- gl.texCoord2i(1,0);
196- gl.vertex3f(width, 0.0f, 0.0f);
193+ GL.glTexCoord2f(1,0);
194+ GL.glVertex3f(width, 0.0f, 0.0f);
197195
198- gl.texCoord2i(1,1);
199- gl.vertex3f(width, height, 0.0f);
196+ GL.glTexCoord2f(1,1);
197+ GL.glVertex3f(width, height, 0.0f);
200198
201- gl.end();
199+ GL.glEnd();
202200
203201 if(isBlended) {
204- gl.disable(GL.BLEND);
202+ GL.glDisable(GL.GL_BLEND);
205203 }
206- gl.matrixMode(GL.PROJECTION);
207- gl.popMatrix();
208- gl.matrixMode(GL.MODELVIEW);
209- gl.popMatrix();
210- gl.enable(GL.DEPTH_TEST);
211- gl.disable(GL.TEXTURE_2D);
204+ GL.glMatrixMode(GL.GL_PROJECTION);
205+ GL.glPopMatrix();
206+ GL.glMatrixMode(GL.GL_MODELVIEW);
207+ GL.glPopMatrix();
208+ GL.glEnable(GL.GL_DEPTH_TEST);
209+ GL.glDisable(GL.GL_TEXTURE_2D);
212210 }
213211
214212
--- a/src/jme/geometry/hud/text/Font2D.java
+++ b/src/jme/geometry/hud/text/Font2D.java
@@ -35,11 +35,10 @@ package jme.geometry.hud.text;
3535 import java.nio.ByteBuffer;
3636 import java.util.logging.Level;
3737
38-import org.lwjgl.Sys;
3938 import org.lwjgl.opengl.GL;
39+import org.lwjgl.opengl.Window;
4040
4141 import jme.exception.MonkeyRuntimeException;
42-import jme.system.DisplaySystem;
4342
4443 import jme.texture.TextureManager;
4544 import jme.utility.LoggingSystem;
@@ -60,21 +59,19 @@ import jme.utility.LoggingSystem;
6059 *
6160 *
6261 * @author Mark Powell
63- * @version 1
62+ * @version $Id: Font2D.java,v 1.3 2003-09-03 16:20:52 mojomonkey Exp $
6463 */
6564 public class Font2D {
6665 public static final int NORMAL = 0;
6766 public static final int ITALICS = 1;
6867
69- private GL gl = null;
70-
7168 //texture name and
7269 private int texId;
7370 private int base;
74-
71+
7572 //Color to render the font.
7673 private float red, green, blue, alpha;
77-
74+
7875 private boolean isBlended = true;
7976
8077 /**
@@ -85,27 +82,24 @@ public class Font2D {
8582 * @see jme.texture.TextureManager
8683 *
8784 * @param texture the path to the image that defines the fonts.
88- */
85+ */
8986 public Font2D(String texture) {
9087 red = 1.0f;
9188 green = 1.0f;
9289 blue = 1.0f;
9390 alpha = 1.0f;
94-
95- gl = DisplaySystem.getDisplaySystem().getGL();
96-
97- if(null == gl) {
98- throw new MonkeyRuntimeException("GL must be created before a call " +
99- "to Font2D is allowed.");
91+
92+ if (!Window.isCreated()) {
93+ throw new MonkeyRuntimeException("Window must be created before Font2D.");
10094 }
101-
95+
10296 setFontTexture(texture);
10397
10498 buildDisplayList();
105-
106-
107- LoggingSystem.getLoggingSystem().getLogger().log(Level.INFO,
108- "Successfully created Font2D using " + texture);
99+
100+ LoggingSystem.getLoggingSystem().getLogger().log(
101+ Level.INFO,
102+ "Successfully created Font2D using " + texture);
109103 }
110104
111105 /**
@@ -115,11 +109,12 @@ public class Font2D {
115109 * @param texture the new texture to use.
116110 */
117111 public void setFontTexture(String texture) {
118- texId = TextureManager.getTextureManager().loadTexture(
119- texture,
120- GL.LINEAR,
121- GL.LINEAR,
122- false);
112+ texId =
113+ TextureManager.getTextureManager().loadTexture(
114+ texture,
115+ GL.GL_LINEAR,
116+ GL.GL_LINEAR,
117+ false);
123118 }
124119
125120 /**
@@ -137,14 +132,14 @@ public class Font2D {
137132 blue = b;
138133 alpha = a;
139134 }
140-
135+
141136 /**
142137 * <code>deleteFont</code> deletes the current display list of font objects.
143138 * The font will be useless until a call to <code>buildDisplayLists</code>
144139 * is made.
145140 */
146141 public void deleteFont() {
147- gl.deleteLists(base, 256);
142+ GL.glDeleteLists(base, 256);
148143 }
149144
150145 /**
@@ -165,43 +160,42 @@ public class Font2D {
165160 }
166161
167162 TextureManager.getTextureManager().bind(texId);
168-
163+
169164 //set the GL states to how we want them.
170- if(isBlended) {
171- gl.enable(GL.BLEND);
165+ if (isBlended) {
166+ GL.glEnable(GL.GL_BLEND);
172167 }
173- gl.disable(GL.DEPTH_TEST);
174- gl.enable(GL.TEXTURE_2D);
175- gl.matrixMode(GL.PROJECTION);
176- gl.pushMatrix();
177- gl.loadIdentity();
178- gl.ortho(0, gl.getWidth(), 0, gl.getHeight(), -1, 1);
179- gl.matrixMode(GL.MODELVIEW);
180- gl.pushMatrix();
181- gl.loadIdentity();
182- gl.translated(x, y, 0);
183- gl.listBase(base - 32 + (128 * set));
168+ GL.glDisable(GL.GL_DEPTH_TEST);
169+ GL.glEnable(GL.GL_TEXTURE_2D);
170+ GL.glMatrixMode(GL.GL_PROJECTION);
171+ GL.glPushMatrix();
172+ GL.glLoadIdentity();
173+ GL.glOrtho(0, Window.getWidth(), 0, Window.getHeight(), -1, 1);
174+ GL.glMatrixMode(GL.GL_MODELVIEW);
175+ GL.glPushMatrix();
176+ GL.glLoadIdentity();
177+ GL.glTranslatef(x, y, 0);
178+ GL.glListBase(base - 32 + (128 * set));
184179
185180 //Put the string into a "pointer"
186- ByteBuffer scratch = ByteBuffer.allocateDirect(text.getBytes().length);
181+ ByteBuffer scratch =
182+ ByteBuffer.allocateDirect(text.getBytes().length);
187183 scratch.put(text.getBytes());
188- gl.color4f(red,green,blue,alpha);
184+ scratch.flip();
185+ GL.glColor4f(red, green, blue, alpha);
189186 //call the list for each letter in the string.
190- gl.callLists(
191- text.length(),
192- GL.BYTE,
193- Sys.getDirectBufferAddress(scratch));
194-
187+ GL.glCallLists(scratch);
188+
195189 //reset the GL states.
196- if(isBlended) {
197- gl.disable(GL.BLEND);
190+ if (isBlended) {
191+ GL.glDisable(GL.GL_BLEND);
198192 }
199- gl.matrixMode(GL.PROJECTION);
200- gl.popMatrix();
201- gl.matrixMode(GL.MODELVIEW);
202- gl.popMatrix();
203- gl.enable(GL.DEPTH_TEST);
204- gl.disable(GL.TEXTURE_2D);
193+ GL.glMatrixMode(GL.GL_PROJECTION);
194+ GL.glPopMatrix();
195+ GL.glMatrixMode(GL.GL_MODELVIEW);
196+ GL.glPopMatrix();
197+ GL.glEnable(GL.GL_DEPTH_TEST);
198+ GL.glDisable(GL.GL_TEXTURE_2D);
205199 }
206200
207201 /**
@@ -213,29 +207,29 @@ public class Font2D {
213207 float cx;
214208 float cy;
215209
216- base = gl.genLists(256);
210+ base = GL.glGenLists(256);
217211 TextureManager.getTextureManager().bind(texId);
218212
219213 for (int loop = 0; loop < 256; loop++) {
220214 cx = (loop % 16) / 16.0f;
221215 cy = (loop / 16) / 16.0f;
222216
223- gl.newList(base + loop, GL.COMPILE);
224- gl.begin(GL.QUADS);
225- gl.texCoord2f(cx, 1 - cy - 0.0625f);
226- gl.vertex2i(0, 0);
227- gl.texCoord2f(cx + 0.0625f, 1 - cy - 0.0625f);
228- gl.vertex2i(16, 0);
229- gl.texCoord2f(cx + 0.0625f, 1 - cy);
230- gl.vertex2i(16, 16);
231- gl.texCoord2f(cx, 1 - cy);
232- gl.vertex2i(0, 16);
233- gl.end();
234- gl.translated(10, 0, 0);
235- gl.endList();
217+ GL.glNewList(base + loop, GL.GL_COMPILE);
218+ GL.glBegin(GL.GL_QUADS);
219+ GL.glTexCoord2f(cx, 1 - cy - 0.0625f);
220+ GL.glVertex2i(0, 0);
221+ GL.glTexCoord2f(cx + 0.0625f, 1 - cy - 0.0625f);
222+ GL.glVertex2i(16, 0);
223+ GL.glTexCoord2f(cx + 0.0625f, 1 - cy);
224+ GL.glVertex2i(16, 16);
225+ GL.glTexCoord2f(cx, 1 - cy);
226+ GL.glVertex2i(0, 16);
227+ GL.glEnd();
228+ GL.glTranslatef(10, 0, 0);
229+ GL.glEndList();
236230 }
237231 }
238-
232+
239233 /**
240234 * <code>toString</code> returns the string representation of this
241235 * font object in the Format:<br><br>
@@ -249,9 +243,9 @@ public class Font2D {
249243 public String toString() {
250244 String string = super.toString();
251245 string += "\nColor: " + red + " " + green + " " + blue + " " + alpha;
252- string += "\nBlended: " + isBlended;
246+ string += "\nBlended: " + isBlended;
253247 string += "\nTexture: " + texId;
254-
248+
255249 return string;
256250 }
257251 }
--- a/src/jme/geometry/model/md3/Md3Model.java
+++ b/src/jme/geometry/model/md3/Md3Model.java
@@ -59,8 +59,8 @@ import jme.geometry.bounding.BoundingBox;
5959 import jme.geometry.bounding.BoundingSphere;
6060 import jme.geometry.model.Triangle;
6161
62-import org.lwjgl.Sys;
6362 import org.lwjgl.opengl.GL;
63+import org.lwjgl.opengl.Window;
6464
6565 /**
6666 * <code>Md3Model</code> handles loading and rendering a Quake 3 MD3 format
@@ -99,6 +99,7 @@ import org.lwjgl.opengl.GL;
9999 *
100100 *
101101 * @author Mark Powell
102+ * @version $Id: Md3Model.java,v 1.7 2003-09-03 16:20:52 mojomonkey Exp $
102103 */
103104 public class Md3Model implements Geometry {
104105 /**
@@ -153,9 +154,6 @@ public class Md3Model implements Geometry {
153154 private BoundingSphere boundingSphere;
154155 private BoundingBox boundingBox;
155156
156- //OpenGL context.
157- private GL gl;
158-
159157 //Model constants
160158 private static final int START_TORSO_ANIMATION = 6;
161159 private static final int START_LEGS_ANIMATION = 13;
@@ -174,9 +172,8 @@ public class Md3Model implements Geometry {
174172 if (null == path || null == model) {
175173 throw new MonkeyRuntimeException("Path and model cannot be null.");
176174 }
177- gl = DisplaySystem.getDisplaySystem().getGL();
178- if (null == gl) {
179- throw new MonkeyGLException("OpenGL context must be created first.");
175+ if (!Window.isCreated()) {
176+ throw new MonkeyGLException("Window must be created first.");
180177 }
181178
182179 buf =
@@ -270,16 +267,16 @@ public class Md3Model implements Geometry {
270267 * front.
271268 */
272269 public void render() {
273- DisplaySystem.getDisplaySystem().cullMode(GL.FRONT, true);
270+ DisplaySystem.getDisplaySystem().cullMode(GL.GL_FRONT, true);
274271
275272 //MD3 has Z up, so remedy this.
276- gl.rotatef(-90,0,1,0);
277- gl.rotatef(-90, 1, 0, 0);
273+ GL.glRotatef(-90,0,1,0);
274+ GL.glRotatef(-90, 1, 0, 0);
278275
279276 //scale by a desired factor
280- gl.scalef(scale.x, scale.y, scale.z);
277+ GL.glScalef(scale.x, scale.y, scale.z);
281278 //set the desired color
282- gl.color4f(r, g, b, a);
279+ GL.glColor4f(r, g, b, a);
283280
284281 //Update the leg and torso animations
285282 updateModel(lower);
@@ -287,8 +284,8 @@ public class Md3Model implements Geometry {
287284
288285 //start rendering with the legs first.
289286 drawLink(lower);
290- //set culling back to GL.BACK
291- DisplaySystem.getDisplaySystem().cullMode(GL.BACK, true);
287+ //set culling back to GL.GL_BACK
288+ DisplaySystem.getDisplaySystem().cullMode(GL.GL_BACK, true);
292289 }
293290
294291 /**
@@ -1047,8 +1044,8 @@ public class Md3Model implements Geometry {
10471044 ((MaterialInfo)model.materials.get(i)).texureId =
10481045 TextureManager.getTextureManager().loadTexture(
10491046 fullPath,
1050- GL.LINEAR_MIPMAP_LINEAR,
1051- GL.LINEAR,
1047+ GL.GL_LINEAR_MIPMAP_LINEAR,
1048+ GL.GL_LINEAR,
10521049 true);
10531050 }
10541051 }
@@ -1246,16 +1243,16 @@ public class Md3Model implements Geometry {
12461243 finalMatrix[14] = position.z;
12471244
12481245 //render the model
1249- gl.pushMatrix();
1246+ GL.glPushMatrix();
12501247
12511248 buf.clear();
12521249 buf.put(finalMatrix);
1253- int ptr = Sys.getDirectBufferAddress(buf);
1254- gl.multMatrixf(ptr);
1250+ buf.flip();
1251+ GL.glMultMatrixf(buf);
12551252 //render the children
12561253 drawLink(model.links[i]);
12571254
1258- gl.popMatrix();
1255+ GL.glPopMatrix();
12591256 }
12601257 }
12611258
@@ -1308,18 +1305,18 @@ public class Md3Model implements Geometry {
13081305
13091306 //if there is a texture assigned to the model, use it.
13101307 if (object3d.hasTexture) {
1311- gl.enable(GL.TEXTURE_2D);
1308+ GL.glEnable(GL.GL_TEXTURE_2D);
13121309
13131310 int textureID = ((MaterialInfo)model.materials.get(
13141311 object3d.materialID)).texureId;
13151312
13161313 TextureManager.getTextureManager().bind(textureID);
13171314 } else {
1318- gl.disable(GL.TEXTURE_2D);
1315+ GL.glDisable(GL.GL_TEXTURE_2D);
13191316 }
13201317
13211318 //render the model as triangles
1322- gl.begin(GL.TRIANGLES);
1319+ GL.glBegin(GL.GL_TRIANGLES);
13231320
13241321 for (int j = 0; j < object3d.numOfFaces; j++) {
13251322 for (int whichVertex = 0; whichVertex < 3; whichVertex++) {
@@ -1327,7 +1324,7 @@ public class Md3Model implements Geometry {
13271324
13281325 if (object3d.texVerts != null) {
13291326 // Assign the texture coordinate to this vertex
1330- gl.texCoord2f(
1327+ GL.glTexCoord2f(
13311328 object3d.texVerts[index].x,
13321329 object3d.texVerts[index].y);
13331330 }
@@ -1336,14 +1333,14 @@ public class Md3Model implements Geometry {
13361333 Vector point2 = object3d.verts[nextIndex + index];
13371334
13381335 //interpolate
1339- gl.vertex3f(
1336+ GL.glVertex3f(
13401337 point1.x + model.t * (point2.x - point1.x),
13411338 point1.y + model.t * (point2.y - point1.y),
13421339 point1.z + model.t * (point2.z - point1.z));
13431340
13441341 }
13451342 }
1346- gl.end();
1343+ GL.glEnd();
13471344 }
13481345 }
13491346
--- a/src/jme/geometry/model/ms/MilkshapeModel.java
+++ b/src/jme/geometry/model/ms/MilkshapeModel.java
@@ -37,11 +37,11 @@ import java.io.FileNotFoundException;
3737 import java.io.IOException;
3838 import java.nio.ByteBuffer;
3939 import java.nio.ByteOrder;
40+import java.nio.FloatBuffer;
4041 import java.util.logging.Level;
4142
42-import org.lwjgl.Sys;
4343 import org.lwjgl.opengl.GL;
44-import org.lwjgl.vector.Vector3f;
44+import org.lwjgl.opengl.Window;
4545
4646 import jme.exception.MonkeyGLException;
4747 import jme.geometry.*;
@@ -55,7 +55,6 @@ import jme.geometry.model.Triangle;
5555 import jme.geometry.model.Vertex;
5656 import jme.math.Matrix;
5757 import jme.math.Vector;
58-import jme.system.DisplaySystem;
5958 import jme.texture.TextureManager;
6059 import jme.utility.Conversion;
6160 import jme.utility.LoggingSystem;
@@ -67,6 +66,7 @@ import jme.utility.LoggingSystem;
6766 * to version 3. Animation is not currently supported, but planned.
6867 *
6968 * @author Mark Powell
69+ * @version $Id: MilkshapeModel.java,v 1.5 2003-09-03 16:20:52 mojomonkey Exp $
7070 */
7171 public class MilkshapeModel implements Geometry {
7272 //defines the bounding volumes of the model.
@@ -77,17 +77,14 @@ public class MilkshapeModel implements Geometry {
7777 private float animationFPS;
7878 private float currentTime;
7979 private int totalFrames;
80-
80+
8181 //model data information
8282 private String modelFile;
8383 private ByteBuffer buffer;
8484 private String id;
8585 private String path;
8686 private int version;
87- /**
88- * the OpenGL context object.
89- */
90- private GL gl;
87+
9188 /**
9289 * the color of the model. This color will be applied as a whole to the
9390 * model and may be trumped by the material level.
@@ -96,7 +93,7 @@ public class MilkshapeModel implements Geometry {
9693 /**
9794 * the scale of the model, where 1.0 is the standard size of the model.
9895 */
99- private Vector3f scale;
96+ private Vector scale;
10097 /**
10198 * the number of meshes that makes up the model.
10299 */
@@ -148,8 +145,7 @@ public class MilkshapeModel implements Geometry {
148145 * @throws MonkeyGLException if the OpenGL context has not been created.
149146 */
150147 public MilkshapeModel(String modelFile) {
151- gl = DisplaySystem.getDisplaySystem().getGL();
152- if (null == gl) {
148+ if (!Window.isCreated()) {
153149 throw new MonkeyGLException(
154150 "OpenGL context must be " + "created before MilkshapeModel.");
155151 }
@@ -160,7 +156,7 @@ public class MilkshapeModel implements Geometry {
160156 blue = 1.0f;
161157 green = 1.0f;
162158 alpha = 1.0f;
163- scale = new Vector3f(1.0f, 1.0f, 1.0f);
159+ scale = new Vector(1.0f, 1.0f, 1.0f);
164160
165161 initialize();
166162 setBoundingVolumes();
@@ -178,7 +174,7 @@ public class MilkshapeModel implements Geometry {
178174 file.getAbsolutePath().substring(
179175 0,
180176 file.getAbsolutePath().length() - file.getName().length());
181- int length = (int)file.length();
177+ int length = (int) file.length();
182178 data = new byte[length];
183179 FileInputStream fis;
184180 try {
@@ -428,58 +424,56 @@ public class MilkshapeModel implements Geometry {
428424 Triangle currentTri;
429425 int triangleIndex;
430426 int index;
431- ByteBuffer temp = ByteBuffer.allocateDirect(16);
432- temp.order(ByteOrder.nativeOrder());
433- gl.color4f(red, green, blue, alpha);
434- gl.pushMatrix();
435- gl.scalef(scale.x, scale.y, scale.z);
427+ FloatBuffer temp =
428+ ByteBuffer
429+ .allocateDirect(16)
430+ .order(ByteOrder.nativeOrder())
431+ .asFloatBuffer();
432+ GL.glColor4f(red, green, blue, alpha);
433+ GL.glPushMatrix();
434+ GL.glScalef(scale.x, scale.y, scale.z);
436435
437436 //go through each mesh and render them.
438437 for (int i = 0; i < numMeshes; i++) {
439438 int materialIndex = meshes[i].materialIndex;
440439 //if the material is set, use it to set the texture and lighting.
441440 if (materialIndex >= 0) {
442-
443- gl.materialfv(
444- GL.FRONT,
445- GL.AMBIENT,
446- Sys.getDirectBufferAddress(
447- temp.asFloatBuffer().put(
448- materials[materialIndex].ambient)));
449- gl.materialfv(
450- GL.FRONT,
451- GL.DIFFUSE,
452- Sys.getDirectBufferAddress(
453- temp.asFloatBuffer().put(
454- materials[materialIndex].diffuse)));
455- gl.materialfv(
456- GL.FRONT,
457- GL.SPECULAR,
458- Sys.getDirectBufferAddress(
459- temp.asFloatBuffer().put(
460- materials[materialIndex].specular)));
461- gl.materialfv(
462- GL.FRONT,
463- GL.EMISSION,
464- Sys.getDirectBufferAddress(
465- temp.asFloatBuffer().put(
466- materials[materialIndex].emissive)));
467- gl.materialf(
468- GL.FRONT,
469- GL.SHININESS,
441+ temp.clear();
442+ temp.put(materials[materialIndex].ambient);
443+ temp.flip();
444+ GL.glMaterial(GL.GL_FRONT, GL.GL_AMBIENT, temp);
445+
446+ temp.clear();
447+ temp.put(materials[materialIndex].diffuse);
448+ temp.flip();
449+ GL.glMaterial(GL.GL_FRONT, GL.GL_DIFFUSE, temp);
450+
451+ temp.clear();
452+ temp.put(materials[materialIndex].specular);
453+ temp.flip();
454+ GL.glMaterial(GL.GL_FRONT, GL.GL_SPECULAR, temp);
455+
456+ temp.clear();
457+ temp.put(materials[materialIndex].emissive);
458+ temp.flip();
459+ GL.glMaterial(GL.GL_FRONT, GL.GL_EMISSION, temp);
460+
461+ GL.glMaterialf(
462+ GL.GL_FRONT,
463+ GL.GL_SHININESS,
470464 materials[materialIndex].shininess);
471465
472466 if (materials[materialIndex].texture > 0) {
473467 TextureManager.getTextureManager().bind(
474468 materials[materialIndex].texture);
475- gl.enable(GL.TEXTURE_2D);
469+ GL.glEnable(GL.GL_TEXTURE_2D);
476470 } else
477- gl.disable(GL.TEXTURE_2D);
471+ GL.glDisable(GL.GL_TEXTURE_2D);
478472 } else {
479- gl.disable(GL.TEXTURE_2D);
473+ GL.glDisable(GL.GL_TEXTURE_2D);
480474 }
481475
482- gl.begin(GL.TRIANGLES);
476+ GL.glBegin(GL.GL_TRIANGLES);
483477 int m = meshes[i].numTriangles;
484478
485479 //render all triangles defined for the current mesh.
@@ -490,21 +484,21 @@ public class MilkshapeModel implements Geometry {
490484 for (int k = 0; k < 3; k++) {
491485 index = currentTri.vertexIndices[k];
492486
493- gl.normal3f(
487+ GL.glNormal3f(
494488 currentTri.vertexNormals[k][0],
495489 currentTri.vertexNormals[k][1],
496490 currentTri.vertexNormals[k][2]);
497- gl.texCoord2f(currentTri.s[k], currentTri.t[k]);
498- gl.vertex3f(
491+ GL.glTexCoord2f(currentTri.s[k], currentTri.t[k]);
492+ GL.glVertex3f(
499493 vertices[index].point[0],
500494 vertices[index].point[1],
501495 vertices[index].point[2]);
502496 }
503497 }
504- gl.end();
498+ GL.glEnd();
505499 }
506- gl.popMatrix();
507- gl.disable(GL.TEXTURE_2D);
500+ GL.glPopMatrix();
501+ GL.glDisable(GL.GL_TEXTURE_2D);
508502 }
509503
510504 /**
@@ -538,7 +532,7 @@ public class MilkshapeModel implements Geometry {
538532 * normal size of the model.
539533 * @param scale the multiplier of the model's size.
540534 */
541- public void setScale(Vector3f scale) {
535+ public void setScale(Vector scale) {
542536 this.scale = scale;
543537 }
544538
@@ -578,11 +572,13 @@ public class MilkshapeModel implements Geometry {
578572 }
579573 }
580574 distanceSqr *= scale.x;
581- float distance = (float)Math.sqrt(distanceSqr);
575+ float distance = (float) Math.sqrt(distanceSqr);
582576 boundingSphere = new BoundingSphere(distance, null);
583- boundingBox = new BoundingBox(new Vector(),
584- new Vector(-distance, -distance, -distance),
585- new Vector(distance, distance, distance));
577+ boundingBox =
578+ new BoundingBox(
579+ new Vector(),
580+ new Vector(-distance, -distance, -distance),
581+ new Vector(distance, distance, distance));
586582 }
587583
588584 /**
@@ -653,8 +649,8 @@ public class MilkshapeModel implements Geometry {
653649 materials[i].texture =
654650 TextureManager.getTextureManager().loadTexture(
655651 fullFilename,
656- GL.LINEAR_MIPMAP_LINEAR,
657- GL.LINEAR,
652+ GL.GL_LINEAR_MIPMAP_LINEAR,
653+ GL.GL_LINEAR,
658654 true);
659655 } else
660656 materials[i].texture = 0;
--- a/src/jme/geometry/primitive/Box.java
+++ b/src/jme/geometry/primitive/Box.java
@@ -37,7 +37,6 @@ import jme.exception.MonkeyRuntimeException;
3737 import jme.geometry.bounding.BoundingBox;
3838 import jme.geometry.bounding.BoundingSphere;
3939 import jme.math.Vector;
40-import jme.system.DisplaySystem;
4140 import jme.texture.TextureManager;
4241 import jme.utility.LoggingSystem;
4342
@@ -60,7 +59,7 @@ import org.lwjgl.opengl.GL;
6059 * 7 - Back face, bottom right<br>
6160 *
6261 * @author Mark Powell
63- * @version $Id: Box.java,v 1.3 2003-08-08 18:59:01 mojomonkey Exp $
62+ * @version $Id: Box.java,v 1.4 2003-09-03 16:20:51 mojomonkey Exp $
6463 */
6564 public class Box extends Primitive {
6665 private GL gl;
@@ -71,7 +70,6 @@ public class Box extends Primitive {
7170 * of the box defined as (0,0,0).
7271 */
7372 public Box() {
74- gl = DisplaySystem.getDisplaySystem().getGL();
7573 corners = new Vector[8];
7674 for(int i = 0; i < 8; i++) {
7775 corners[i] = new Vector();
@@ -92,7 +90,6 @@ public class Box extends Primitive {
9290 throw new MonkeyRuntimeException("Corners cannot be null.");
9391 }
9492 this.corners = corners;
95- gl = DisplaySystem.getDisplaySystem().getGL();
9693 initialize();
9794 LoggingSystem.getLoggingSystem().getLogger().log(Level.INFO,
9895 "Box created.");
@@ -105,7 +102,6 @@ public class Box extends Primitive {
105102 * @param size the length of a side of the cube.
106103 */
107104 public Box(float size) {
108- gl = DisplaySystem.getDisplaySystem().getGL();
109105 corners = new Vector[8];
110106
111107 corners[0] = new Vector(-size/2, size/2, -size/2);
@@ -129,76 +125,76 @@ public class Box extends Primitive {
129125 public void render() {
130126 if(getTextureId() > 0) {
131127 TextureManager.getTextureManager().bind(getTextureId());
132- gl.enable(GL.TEXTURE_2D);
128+ GL.glEnable(GL.GL_TEXTURE_2D);
133129 }
134130
135- gl.begin(GL.QUADS);
131+ GL.glBegin(GL.GL_QUADS);
136132
137133 //front
138- gl.color4f(red, blue, green, alpha);
139- gl.texCoord2i(1,1);
140- gl.vertex3f(corners[0].x, corners[0].y, corners[0].z);
141- gl.texCoord2i(0,1);
142- gl.vertex3f(corners[1].x, corners[1].y, corners[1].z);
143- gl.texCoord2i(0,0);
144- gl.vertex3f(corners[3].x, corners[3].y, corners[3].z);
145- gl.texCoord2i(1,0);
146- gl.vertex3f(corners[2].x, corners[2].y, corners[2].z);
134+ GL.glColor4f(red, blue, green, alpha);
135+ GL.glTexCoord2f(1,1);
136+ GL.glVertex3f(corners[0].x, corners[0].y, corners[0].z);
137+ GL.glTexCoord2f(0,1);
138+ GL.glVertex3f(corners[1].x, corners[1].y, corners[1].z);
139+ GL.glTexCoord2f(0,0);
140+ GL.glVertex3f(corners[3].x, corners[3].y, corners[3].z);
141+ GL.glTexCoord2f(1,0);
142+ GL.glVertex3f(corners[2].x, corners[2].y, corners[2].z);
147143
148144 //back
149- gl.texCoord2i(1,1);
150- gl.vertex3f(corners[5].x, corners[5].y, corners[5].z);
151- gl.texCoord2i(0,1);
152- gl.vertex3f(corners[4].x, corners[4].y, corners[4].z);
153- gl.texCoord2i(0,0);
154- gl.vertex3f(corners[6].x, corners[6].y, corners[6].z);
155- gl.texCoord2i(1,0);
156- gl.vertex3f(corners[7].x, corners[7].y, corners[7].z);
145+ GL.glTexCoord2f(1,1);
146+ GL.glVertex3f(corners[5].x, corners[5].y, corners[5].z);
147+ GL.glTexCoord2f(0,1);
148+ GL.glVertex3f(corners[4].x, corners[4].y, corners[4].z);
149+ GL.glTexCoord2f(0,0);
150+ GL.glVertex3f(corners[6].x, corners[6].y, corners[6].z);
151+ GL.glTexCoord2f(1,0);
152+ GL.glVertex3f(corners[7].x, corners[7].y, corners[7].z);
157153
158154 //Top
159- gl.texCoord2i(1,1);
160- gl.vertex3f(corners[4].x, corners[4].y, corners[4].z);
161- gl.texCoord2i(0,1);
162- gl.vertex3f(corners[5].x, corners[5].y, corners[5].z);
163- gl.texCoord2i(0,0);
164- gl.vertex3f(corners[1].x, corners[1].y, corners[1].z);
165- gl.texCoord2i(1,0);
166- gl.vertex3f(corners[0].x, corners[0].y, corners[0].z);
155+ GL.glTexCoord2f(1,1);
156+ GL.glVertex3f(corners[4].x, corners[4].y, corners[4].z);
157+ GL.glTexCoord2f(0,1);
158+ GL.glVertex3f(corners[5].x, corners[5].y, corners[5].z);
159+ GL.glTexCoord2f(0,0);
160+ GL.glVertex3f(corners[1].x, corners[1].y, corners[1].z);
161+ GL.glTexCoord2f(1,0);
162+ GL.glVertex3f(corners[0].x, corners[0].y, corners[0].z);
167163
168164 //Bottom
169- gl.texCoord2i(1,1);
170- gl.vertex3f(corners[6].x, corners[6].y, corners[6].z);
171- gl.texCoord2i(0,1);
172- gl.vertex3f(corners[2].x, corners[2].y, corners[2].z);
173- gl.texCoord2i(0,0);
174- gl.vertex3f(corners[3].x, corners[3].y, corners[3].z);
175- gl.texCoord2i(1,0);
176- gl.vertex3f(corners[7].x, corners[7].y, corners[7].z);
165+ GL.glTexCoord2f(1,1);
166+ GL.glVertex3f(corners[6].x, corners[6].y, corners[6].z);
167+ GL.glTexCoord2f(0,1);
168+ GL.glVertex3f(corners[2].x, corners[2].y, corners[2].z);
169+ GL.glTexCoord2f(0,0);
170+ GL.glVertex3f(corners[3].x, corners[3].y, corners[3].z);
171+ GL.glTexCoord2f(1,0);
172+ GL.glVertex3f(corners[7].x, corners[7].y, corners[7].z);
177173
178174 //left
179- gl.texCoord2i(1,1);
180- gl.vertex3f(corners[4].x, corners[4].y, corners[4].z);
181- gl.texCoord2i(0,1);
182- gl.vertex3f(corners[0].x, corners[0].y, corners[0].z);
183- gl.texCoord2i(0,0);
184- gl.vertex3f(corners[2].x, corners[2].y, corners[2].z);
185- gl.texCoord2i(1,0);
186- gl.vertex3f(corners[6].x, corners[6].y, corners[6].z);
175+ GL.glTexCoord2f(1,1);
176+ GL.glVertex3f(corners[4].x, corners[4].y, corners[4].z);
177+ GL.glTexCoord2f(0,1);
178+ GL.glVertex3f(corners[0].x, corners[0].y, corners[0].z);
179+ GL.glTexCoord2f(0,0);
180+ GL.glVertex3f(corners[2].x, corners[2].y, corners[2].z);
181+ GL.glTexCoord2f(1,0);
182+ GL.glVertex3f(corners[6].x, corners[6].y, corners[6].z);
187183
188184 //right
189- gl.texCoord2i(1,1);
190- gl.vertex3f(corners[1].x, corners[1].y, corners[1].z);
191- gl.texCoord2i(0,1);
192- gl.vertex3f(corners[5].x, corners[5].y, corners[5].z);
193- gl.texCoord2i(0,0);
194- gl.vertex3f(corners[7].x, corners[7].y, corners[7].z);
195- gl.texCoord2i(1,0);
196- gl.vertex3f(corners[3].x, corners[3].y, corners[3].z);
185+ GL.glTexCoord2f(1,1);
186+ GL.glVertex3f(corners[1].x, corners[1].y, corners[1].z);
187+ GL.glTexCoord2f(0,1);
188+ GL.glVertex3f(corners[5].x, corners[5].y, corners[5].z);
189+ GL.glTexCoord2f(0,0);
190+ GL.glVertex3f(corners[7].x, corners[7].y, corners[7].z);
191+ GL.glTexCoord2f(1,0);
192+ GL.glVertex3f(corners[3].x, corners[3].y, corners[3].z);
197193
198- gl.end();
194+ GL.glEnd();
199195
200196 if(getTextureId() > 0) {
201- gl.disable(GL.TEXTURE_2D);
197+ GL.glDisable(GL.GL_TEXTURE_2D);
202198 }
203199
204200 }
--- a/src/jme/geometry/primitive/Cylinder.java
+++ b/src/jme/geometry/primitive/Cylinder.java
@@ -38,7 +38,6 @@ import jme.exception.MonkeyRuntimeException;
3838 import jme.geometry.bounding.BoundingBox;
3939 import jme.geometry.bounding.BoundingSphere;
4040 import jme.math.Vector;
41-import jme.system.DisplaySystem;
4241 import jme.utility.LoggingSystem;
4342
4443 import org.lwjgl.opengl.GLU;
@@ -53,7 +52,7 @@ import org.lwjgl.opengl.GLU;
5352 * image, but framerate will suffer.
5453 *
5554 * @author Mark Powell
56- * @version $Id: Cylinder.java,v 1.2 2003-08-07 21:24:37 mojomonkey Exp $
55+ * @version $Id: Cylinder.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
5756 */
5857 public class Cylinder extends Quadric {
5958
@@ -100,7 +99,6 @@ public class Cylinder extends Quadric {
10099 boundingBox = new BoundingBox(new Vector(), new Vector(-(float)height,-(float)height,-(float)height),
101100 new Vector((float)height,(float)height,(float)height));
102101
103- glu = DisplaySystem.getDisplaySystem().getGLU();
104102
105103 super.initialize();
106104
@@ -113,8 +111,8 @@ public class Cylinder extends Quadric {
113111 */
114112 public void render() {
115113 super.preRender();
116- glu.cylinder(quadricPointer, baseRadius, topRadius, height, slices,
117- stacks);
114+// GLU.gluCylinder(quadricPointer, baseRadius, topRadius, height, slices,
115+// stacks);
118116 super.clean();
119117 }
120118
--- a/src/jme/geometry/primitive/Disk.java
+++ b/src/jme/geometry/primitive/Disk.java
@@ -38,10 +38,8 @@ import jme.exception.MonkeyRuntimeException;
3838 import jme.geometry.bounding.BoundingBox;
3939 import jme.geometry.bounding.BoundingSphere;
4040 import jme.math.Vector;
41-import jme.system.DisplaySystem;
4241 import jme.utility.LoggingSystem;
4342
44-import org.lwjgl.opengl.GLU;
4543
4644 /**
4745 * <code>Disk</code> defines a disk geometry. The disk is defined by two radii.
@@ -52,7 +50,7 @@ import org.lwjgl.opengl.GLU;
5250 * determine the number of concentric rings around the center.
5351 *
5452 * @author Mark Powell
55- * @version $Id: Disk.java,v 1.2 2003-08-07 21:24:37 mojomonkey Exp $
53+ * @version $Id: Disk.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
5654 */
5755 public class Disk extends Quadric {
5856
@@ -62,8 +60,6 @@ public class Disk extends Quadric {
6260 protected int slices;
6361 protected int loops;
6462
65- //reference to the GLU object
66- protected GLU glu;
6763
6864 /**
6965 * Constructor creates a new Disk geometry object. The disk is defined by
@@ -100,8 +96,6 @@ public class Disk extends Quadric {
10096 new Vector((float)outerRadius,(float)outerRadius,(float)outerRadius));
10197 boundingSphere = new BoundingSphere((float)outerRadius, null);
10298
103- glu = DisplaySystem.getDisplaySystem().getGLU();
104-
10599 super.initialize();
106100
107101 LoggingSystem.getLoggingSystem().getLogger().log(Level.INFO,
@@ -113,7 +107,7 @@ public class Disk extends Quadric {
113107 */
114108 public void render() {
115109 super.preRender();
116- glu.disk(quadricPointer, innerRadius, outerRadius, slices, loops);
110+ //glu.disk(quadricPointer, innerRadius, outerRadius, slices, loops);
117111 super.clean();
118112 }
119113
--- a/src/jme/geometry/primitive/PartialDisk.java
+++ b/src/jme/geometry/primitive/PartialDisk.java
@@ -50,7 +50,7 @@ import jme.math.Vector;
5050 * the negative x-axis
5151 *
5252 * @author Mark Powell
53- * @version $Id: PartialDisk.java,v 1.2 2003-08-07 21:24:37 mojomonkey Exp $
53+ * @version $Id: PartialDisk.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
5454 */
5555 public class PartialDisk extends Disk {
5656
@@ -91,8 +91,8 @@ public class PartialDisk extends Disk {
9191 public void render() {
9292 super.preRender();
9393
94- glu.partialDisk(quadricPointer, innerRadius, outerRadius, slices,
95- loops, startAngle, endAngle);
94+// glu.partialDisk(quadricPointer, innerRadius, outerRadius, slices,
95+// loops, startAngle, endAngle);
9696
9797 super.clean();
9898 }
--- a/src/jme/geometry/primitive/Primitive.java
+++ b/src/jme/geometry/primitive/Primitive.java
@@ -37,7 +37,6 @@ import org.lwjgl.opengl.GL;
3737 import jme.geometry.Geometry;
3838 import jme.geometry.bounding.BoundingBox;
3939 import jme.geometry.bounding.BoundingSphere;
40-import jme.system.DisplaySystem;
4140 import jme.texture.TextureManager;
4241
4342 /**
@@ -91,8 +90,8 @@ public abstract class Primitive implements Geometry {
9190 public void setTexture(String filename) {
9291 texID = TextureManager.getTextureManager().loadTexture(
9392 filename,
94- GL.LINEAR_MIPMAP_LINEAR,
95- GL.LINEAR,
93+ GL.GL_LINEAR_MIPMAP_LINEAR,
94+ GL.GL_LINEAR,
9695 true);
9796 }
9897 /**
@@ -131,7 +130,7 @@ public abstract class Primitive implements Geometry {
131130 */
132131 public void clean() {
133132 if (-1 != texID) {
134- DisplaySystem.getDisplaySystem().getGL().disable(GL.TEXTURE_2D);
133+ GL.glDisable(GL.GL_TEXTURE_2D);
135134 }
136135 }
137136
--- a/src/jme/geometry/primitive/Pyramid.java
+++ b/src/jme/geometry/primitive/Pyramid.java
@@ -38,11 +38,11 @@ import jme.exception.MonkeyRuntimeException;
3838 import jme.geometry.bounding.BoundingBox;
3939 import jme.geometry.bounding.BoundingSphere;
4040 import jme.math.Vector;
41-import jme.system.DisplaySystem;
4241 import jme.texture.TextureManager;
4342 import jme.utility.LoggingSystem;
4443
4544 import org.lwjgl.opengl.GL;
45+import org.lwjgl.opengl.Window;
4646
4747 /**
4848 * <code>Pyramid</code> defines a primitive object of a pyramid shape. The
@@ -50,7 +50,7 @@ import org.lwjgl.opengl.GL;
5050 * base and the height.
5151 *
5252 * @author Mark Powell
53- * @version $Id: Pyramid.java,v 1.2 2003-08-07 21:24:37 mojomonkey Exp $
53+ * @version $Id: Pyramid.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
5454 */
5555 public class Pyramid extends Primitive {
5656 private boolean usingDisplay;
@@ -73,11 +73,10 @@ public class Pyramid extends Primitive {
7373 throw new MonkeyRuntimeException(
7474 "Neither base nor height can be " + "negative.");
7575 }
76- gl = DisplaySystem.getDisplaySystem().getGL();
7776
78- if (null == gl) {
77+ if (!Window.isCreated()) {
7978 throw new MonkeyGLException(
80- "OpenGL context must be created " + "before Pyramid.");
79+ "Window must be created before Pyramid.");
8180 }
8281 this.base = base;
8382 this.height = height;
@@ -119,10 +118,11 @@ public class Pyramid extends Primitive {
119118 */
120119 public void useDisplayList(boolean value) {
121120 if (value) {
122- listId = gl.genLists(1);
123- gl.newList(listId, GL.COMPILE);
121+ listId = GL.glGenLists(1);
122+ GL.glNewList(listId, GL.GL_COMPILE);
124123 renderPyramid();
125- gl.endList();
124+ GL.glEndList();
125+ usingDisplay = true;
126126 } else {
127127 usingDisplay = false;
128128 }
@@ -133,7 +133,7 @@ public class Pyramid extends Primitive {
133133 */
134134 public void render() {
135135 if (usingDisplay) {
136- gl.callList(listId);
136+ GL.glCallList(listId);
137137 } else {
138138 renderPyramid();
139139 }
@@ -171,62 +171,62 @@ public class Pyramid extends Primitive {
171171 private void renderPyramid() {
172172 if (getTextureId() > 0) {
173173 TextureManager.getTextureManager().bind(getTextureId());
174- gl.enable(GL.TEXTURE_2D);
174+ GL.glEnable(GL.GL_TEXTURE_2D);
175175 }
176176
177- gl.color4f(red, green, blue, alpha);
178- gl.begin(GL.TRIANGLES);
177+ GL.glColor4f(red, green, blue, alpha);
178+ GL.glBegin(GL.GL_TRIANGLES);
179179
180180 //front
181- gl.texCoord2f(1, 0);
182- gl.vertex3f(-base / 2, -height / 2, -base / 2); //f1
183- gl.texCoord2f(0.5f, 1);
184- gl.vertex3f(0, height / 2, 0); //top
185- gl.texCoord2f(0.75f, 0);
186- gl.vertex3f(base / 2, -height / 2, -base / 2); //f2
181+ GL.glTexCoord2f(1, 0);
182+ GL.glVertex3f(-base / 2, -height / 2, -base / 2); //f1
183+ GL.glTexCoord2f(0.5f, 1);
184+ GL.glVertex3f(0, height / 2, 0); //top
185+ GL.glTexCoord2f(0.75f, 0);
186+ GL.glVertex3f(base / 2, -height / 2, -base / 2); //f2
187187
188188 //right
189- gl.texCoord2f(0.75f, 0);
190- gl.vertex3f(base / 2, -height / 2, -base / 2); //f2
191- gl.texCoord2f(0.5f, 1);
192- gl.vertex3f(0, height / 2, 0); //top
193- gl.texCoord2f(0.5f, 0);
194- gl.vertex3f(base / 2, -height / 2, base / 2); //b2
189+ GL.glTexCoord2f(0.75f, 0);
190+ GL.glVertex3f(base / 2, -height / 2, -base / 2); //f2
191+ GL.glTexCoord2f(0.5f, 1);
192+ GL.glVertex3f(0, height / 2, 0); //top
193+ GL.glTexCoord2f(0.5f, 0);
194+ GL.glVertex3f(base / 2, -height / 2, base / 2); //b2
195195
196196 //back
197- gl.texCoord2f(0.5f, 0);
198- gl.vertex3f(base / 2, -height / 2, base / 2); //b2
199- gl.texCoord2f(0.5f, 1);
200- gl.vertex3f(0, height / 2, 0); //top
201- gl.texCoord2f(0.25f, 0);
202- gl.vertex3f(-base / 2, -height / 2, base / 2); //b1
197+ GL.glTexCoord2f(0.5f, 0);
198+ GL.glVertex3f(base / 2, -height / 2, base / 2); //b2
199+ GL.glTexCoord2f(0.5f, 1);
200+ GL.glVertex3f(0, height / 2, 0); //top
201+ GL.glTexCoord2f(0.25f, 0);
202+ GL.glVertex3f(-base / 2, -height / 2, base / 2); //b1
203203
204204 //left
205- gl.texCoord2f(0.25f, 0);
206- gl.vertex3f(-base / 2, -height / 2, base / 2); //b1
207- gl.texCoord2f(0.5f, 1);
208- gl.vertex3f(0, height / 2, 0); //top
209- gl.texCoord2f(0, 0);
210- gl.vertex3f(-base / 2, -height / 2, -base / 2); //f1
205+ GL.glTexCoord2f(0.25f, 0);
206+ GL.glVertex3f(-base / 2, -height / 2, base / 2); //b1
207+ GL.glTexCoord2f(0.5f, 1);
208+ GL.glVertex3f(0, height / 2, 0); //top
209+ GL.glTexCoord2f(0, 0);
210+ GL.glVertex3f(-base / 2, -height / 2, -base / 2); //f1
211211
212212 //bottom
213- gl.texCoord2f(0, 0);
214- gl.vertex3f(-base / 2, -height / 2, -base / 2); //f1
215- gl.texCoord2f(1, 1);
216- gl.vertex3f(base / 2, -height / 2, base / 2); //b2
217- gl.texCoord2f(0, 1);
218- gl.vertex3f(-base / 2, -height / 2, base / 2); //b1
219- gl.texCoord2f(0, 0);
220- gl.vertex3f(-base / 2, -height / 2, -base / 2); //f1
221- gl.texCoord2f(1, 0);
222- gl.vertex3f(base / 2, -height / 2, -base / 2); //f2
223- gl.texCoord2f(1, 1);
224- gl.vertex3f(base / 2, -height / 2, base / 2); //b2
225-
226- gl.end();
213+ GL.glTexCoord2f(0, 0);
214+ GL.glVertex3f(-base / 2, -height / 2, -base / 2); //f1
215+ GL.glTexCoord2f(1, 1);
216+ GL.glVertex3f(base / 2, -height / 2, base / 2); //b2
217+ GL.glTexCoord2f(0, 1);
218+ GL.glVertex3f(-base / 2, -height / 2, base / 2); //b1
219+ GL.glTexCoord2f(0, 0);
220+ GL.glVertex3f(-base / 2, -height / 2, -base / 2); //f1
221+ GL.glTexCoord2f(1, 0);
222+ GL.glVertex3f(base / 2, -height / 2, -base / 2); //f2
223+ GL.glTexCoord2f(1, 1);
224+ GL.glVertex3f(base / 2, -height / 2, base / 2); //b2
225+
226+ GL.glEnd();
227227
228228 if (getTextureId() > 0) {
229- gl.disable(GL.TEXTURE_2D);
229+ GL.glDisable(GL.GL_TEXTURE_2D);
230230 }
231231 }
232232
--- a/src/jme/geometry/primitive/Quad.java
+++ b/src/jme/geometry/primitive/Quad.java
@@ -36,7 +36,6 @@ import jme.exception.MonkeyRuntimeException;
3636 import jme.geometry.bounding.BoundingBox;
3737 import jme.geometry.bounding.BoundingSphere;
3838 import jme.math.Vector;
39-import jme.system.DisplaySystem;
4039 import jme.texture.TextureManager;
4140
4241 import org.lwjgl.opengl.GL;
@@ -54,7 +53,7 @@ import org.lwjgl.opengl.GL;
5453 * 3 - BottomLeft<br>
5554 *
5655 * @author Mark Powell
57- * @version $Id: Quad.java,v 1.4 2003-08-19 02:10:14 mojomonkey Exp $
56+ * @version $Id: Quad.java,v 1.5 2003-09-03 16:20:51 mojomonkey Exp $
5857 */
5958 public class Quad extends Primitive {
6059 private GL gl;
@@ -70,7 +69,6 @@ public class Quad extends Primitive {
7069 if(null == points) {
7170 throw new MonkeyRuntimeException("Points cannot be null.");
7271 }
73- gl = DisplaySystem.getDisplaySystem().getGL();
7472 this.points = points;
7573 initialize();
7674 }
@@ -111,27 +109,27 @@ public class Quad extends Primitive {
111109 */
112110 public void render() {
113111 if(getTextureId() > 0) {
114- gl.enable(GL.TEXTURE_2D);
112+ GL.glEnable(GL.GL_TEXTURE_2D);
115113 TextureManager.getTextureManager().bind(getTextureId());
116114 }
117115
118- gl.begin(GL.QUADS);
116+ GL.glBegin(GL.GL_QUADS);
119117
120- gl.color4f(red,green,blue,alpha);
118+ GL.glColor4f(red,green,blue,alpha);
121119
122- gl.texCoord2i(1,1);
123- gl.vertex3f(points[0].x,points[0].y,points[0].z);
124- gl.texCoord2i(0,1);
125- gl.vertex3f(points[1].x,points[1].y,points[1].z);
126- gl.texCoord2i(0,0);
127- gl.vertex3f(points[2].x,points[2].y,points[2].z);
128- gl.texCoord2i(1,0);
129- gl.vertex3f(points[3].x,points[3].y,points[3].z);
120+ GL.glTexCoord2f(1,1);
121+ GL.glVertex3f(points[0].x,points[0].y,points[0].z);
122+ GL.glTexCoord2f(0,1);
123+ GL.glVertex3f(points[1].x,points[1].y,points[1].z);
124+ GL.glTexCoord2f(0,0);
125+ GL.glVertex3f(points[2].x,points[2].y,points[2].z);
126+ GL.glTexCoord2f(1,0);
127+ GL.glVertex3f(points[3].x,points[3].y,points[3].z);
130128
131- gl.end();
129+ GL.glEnd();
132130
133131 if(getTextureId() > 0) {
134- gl.disable(GL.TEXTURE_2D);
132+ GL.glDisable(GL.GL_TEXTURE_2D);
135133 }
136134
137135 }
--- a/src/jme/geometry/primitive/Quadric.java
+++ b/src/jme/geometry/primitive/Quadric.java
@@ -34,7 +34,6 @@ package jme.geometry.primitive;
3434
3535 import org.lwjgl.opengl.GL;
3636
37-import jme.system.DisplaySystem;
3837 import jme.texture.TextureManager;
3938
4039 /**
@@ -63,7 +62,7 @@ public abstract class Quadric extends Primitive {
6362 * subclass geometry. This creates a new quadric object.
6463 */
6564 public void initialize() {
66- quadricPointer = DisplaySystem.getDisplaySystem().getGLU().newQuadric();
65+ //quadricPointer = DisplaySystem.getDisplaySystem().getGLU().newQuadric();
6766 }
6867
6968 /**
@@ -72,13 +71,13 @@ public abstract class Quadric extends Primitive {
7271 */
7372 public void preRender() {
7473 if (getTextureId() > 0) {
75- DisplaySystem.getDisplaySystem().getGL().enable(GL.TEXTURE_2D);
74+ //DisplaySystem.getDisplaySystem().getGL().enable(GL.TEXTURE_2D);
7675 TextureManager.getTextureManager().bind(getTextureId());
77- DisplaySystem.getDisplaySystem().getGLU().quadricTexture(
78- quadricPointer,
79- true);
76+// DisplaySystem.getDisplaySystem().getGLU().quadricTexture(
77+// quadricPointer,
78+// true);
8079 }
81- DisplaySystem.getDisplaySystem().getGL().color4f(
80+ GL.glColor4f(
8281 red,
8382 green,
8483 blue,
--- a/src/jme/geometry/primitive/Sphere.java
+++ b/src/jme/geometry/primitive/Sphere.java
@@ -40,7 +40,6 @@ import jme.exception.MonkeyRuntimeException;
4040 import jme.geometry.bounding.BoundingBox;
4141 import jme.geometry.bounding.BoundingSphere;
4242 import jme.math.Vector;
43-import jme.system.DisplaySystem;
4443 import jme.utility.LoggingSystem;
4544
4645 /**
@@ -52,7 +51,7 @@ import jme.utility.LoggingSystem;
5251 * However, frame rate will drop accordingly.
5352 *
5453 * @author Mark Powell
55- * @version $Id: Sphere.java,v 1.2 2003-08-07 21:24:37 mojomonkey Exp $
54+ * @version $Id: Sphere.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
5655 */
5756 public class Sphere extends Quadric {
5857
@@ -91,8 +90,6 @@ public class Sphere extends Quadric {
9190 this.slices = slices;
9291 this.stacks = stacks;
9392
94- glu = DisplaySystem.getDisplaySystem().getGLU();
95-
9693 super.initialize();
9794
9895 //build bounding volumes
@@ -110,7 +107,7 @@ public class Sphere extends Quadric {
110107 public void render() {
111108 super.preRender();
112109
113- glu.sphere(quadricPointer, radius, slices, stacks);
110+ //glu.sphere(quadricPointer, radius, slices, stacks);
114111
115112 super.clean();
116113 }
--- a/src/jme/geometry/primitive/Triangle.java
+++ b/src/jme/geometry/primitive/Triangle.java
@@ -35,7 +35,6 @@ package jme.geometry.primitive;
3535 import jme.exception.MonkeyRuntimeException;
3636 import jme.geometry.bounding.BoundingBox;
3737 import jme.geometry.bounding.BoundingSphere;
38-import jme.system.DisplaySystem;
3938 import jme.texture.TextureManager;
4039 import jme.math.Vector;
4140
@@ -53,7 +52,7 @@ import org.lwjgl.opengl.GL;
5352 * 2 - BottomRight<br>
5453 *
5554 * @author Samuel Wasson
56- * @version $Id: Triangle.java,v 1.2 2003-08-19 02:10:14 mojomonkey Exp $
55+ * @version $Id: Triangle.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
5756 */
5857
5958 public class Triangle extends Primitive {
@@ -70,7 +69,6 @@ public class Triangle extends Primitive {
7069 if(null == points) {
7170 throw new MonkeyRuntimeException("Points cannot be null.");
7271 }
73- gl = DisplaySystem.getDisplaySystem().getGL();
7472 this.points = points;
7573 initialize();
7674 }
@@ -110,24 +108,24 @@ public class Triangle extends Primitive {
110108 */
111109 public void render() {
112110 if(getTextureId() > 0) {
113- gl.enable(GL.TEXTURE_2D);
111+ GL.glEnable(GL.GL_TEXTURE_2D);
114112 TextureManager.getTextureManager().bind(getTextureId());
115113 }
116114
117- gl.begin(GL.TRIANGLES);
118- gl.color4f(red, green, blue, alpha);
115+ GL.glBegin(GL.GL_TRIANGLES);
116+ GL.glColor4f(red, green, blue, alpha);
119117
120- gl.texCoord2i(1,1);
121- gl.vertex3f(points[0].x, points[0].y, points[0].z);
122- gl.texCoord2i(0,0);
123- gl.vertex3f(points[1].x, points[1].y, points[1].z);
124- gl.texCoord2i(1,0);
125- gl.vertex3f(points[2].x, points[2].y, points[2].z);
118+ GL.glTexCoord2f(1,1);
119+ GL.glVertex3f(points[0].x, points[0].y, points[0].z);
120+ GL.glTexCoord2f(0,0);
121+ GL.glVertex3f(points[1].x, points[1].y, points[1].z);
122+ GL.glTexCoord2f(1,0);
123+ GL.glVertex3f(points[2].x, points[2].y, points[2].z);
126124
127- gl.end();
125+ GL.glEnd();
128126
129127 if(getTextureId() > 0) {
130- gl.disable(GL.TEXTURE_2D);
128+ GL.glDisable(GL.GL_TEXTURE_2D);
131129 }
132130 }
133131
--- a/src/jme/locale/SimpleLocale.java
+++ b/src/jme/locale/SimpleLocale.java
@@ -35,7 +35,6 @@ package jme.locale;
3535 import java.util.logging.Level;
3636
3737 import jme.exception.MonkeyRuntimeException;
38-import jme.system.DisplaySystem;
3938 import jme.texture.TextureManager;
4039 import jme.utility.LoggingSystem;
4140
@@ -67,7 +66,7 @@ public class SimpleLocale implements Locale {
6766 private float alpha = 1.0f;
6867
6968 //gl object.
70- private GL gl;
69+ //private GL gl;
7170
7271 /**
7372 * Constructor builds a new <code>SimpleLocale</code> with the defined,
@@ -88,8 +87,7 @@ public class SimpleLocale implements Locale {
8887
8988 this.center = center;
9089 this.halfLength = length / 2;
91- gl = DisplaySystem.getDisplaySystem().getGL();
92-
90+
9391 LoggingSystem.getLoggingSystem().getLogger().log(
9492 Level.INFO,
9593 "SimpleLocale created.");
@@ -112,29 +110,29 @@ public class SimpleLocale implements Locale {
112110
113111 //bind texture only if one has been set.
114112 if (textureID > 0) {
115- gl.enable(GL.TEXTURE_2D);
113+ GL.glEnable(GL.GL_TEXTURE_2D);
116114 TextureManager.getTextureManager().bind(textureID);
117115 }
118116
119- gl.color4f(red, green, blue, alpha);
120- gl.begin(GL.QUADS);
117+ GL.glColor4f(red, green, blue, alpha);
118+ GL.glBegin(GL.GL_QUADS);
121119
122- gl.texCoord2f(0f, 1f);
123- gl.vertex3f(center.x - halfLength, center.y, center.z + halfLength);
120+ GL.glTexCoord2f(0f, 1f);
121+ GL.glVertex3f(center.x - halfLength, center.y, center.z + halfLength);
124122
125- gl.texCoord2f(1f, 1f);
126- gl.vertex3f(center.x + halfLength, center.y, center.z + halfLength);
123+ GL.glTexCoord2f(1f, 1f);
124+ GL.glVertex3f(center.x + halfLength, center.y, center.z + halfLength);
127125
128- gl.texCoord2f(1f, 0f);
129- gl.vertex3f(center.x + halfLength, center.y, center.z - halfLength);
126+ GL.glTexCoord2f(1f, 0f);
127+ GL.glVertex3f(center.x + halfLength, center.y, center.z - halfLength);
130128
131- gl.texCoord2f(0f, 0f);
132- gl.vertex3f(center.x - halfLength, center.y, center.z - halfLength);
129+ GL.glTexCoord2f(0f, 0f);
130+ GL.glVertex3f(center.x - halfLength, center.y, center.z - halfLength);
133131
134- gl.end();
132+ GL.glEnd();
135133
136134 if (textureID > 0) {
137- gl.disable(GL.TEXTURE_2D);
135+ GL.glDisable(GL.GL_TEXTURE_2D);
138136 }
139137 }
140138
@@ -145,8 +143,8 @@ public class SimpleLocale implements Locale {
145143 public void setTexture(String filename) {
146144 textureID = TextureManager.getTextureManager().loadTexture(
147145 filename,
148- GL.LINEAR_MIPMAP_LINEAR,
149- GL.LINEAR,
146+ GL.GL_LINEAR_MIPMAP_LINEAR,
147+ GL.GL_LINEAR,
150148 true);
151149 }
152150
--- a/src/jme/locale/external/BruteForce.java
+++ b/src/jme/locale/external/BruteForce.java
@@ -36,7 +36,6 @@ import org.lwjgl.opengl.GL;
3636
3737 import jme.exception.MonkeyRuntimeException;
3838 import jme.locale.external.data.AbstractHeightMap;
39-import jme.system.DisplaySystem;
4039 import jme.texture.TextureManager;
4140
4241 /**
@@ -46,7 +45,7 @@ import jme.texture.TextureManager;
4645 * distance, etc.
4746 *
4847 * @author Mark Powell
49- * @version 1
48+ * @version $Id: BruteForce.java,v 1.2 2003-09-03 16:20:51 mojomonkey Exp $
5049 */
5150 public class BruteForce extends Terrain {
5251
@@ -66,7 +65,6 @@ public class BruteForce extends Terrain {
6665
6766 this.heightData = heightData;
6867 this.terrainSize = heightData.getSize();
69- gl = DisplaySystem.getDisplaySystem().getGL();
7068 }
7169
7270
@@ -97,16 +95,16 @@ public class BruteForce extends Terrain {
9795
9896 //set up the appropriate textures.
9997 if (isDetailed && isTextured) {
100- gl.activeTextureARB(GL.TEXTURE0_ARB);
101- gl.enable(GL.TEXTURE_2D);
98+ GL.glActiveTextureARB(GL.GL_TEXTURE0_ARB);
99+ GL.glEnable(GL.GL_TEXTURE_2D);
102100 TextureManager.getTextureManager().bind(terrainTexture);
103- gl.activeTextureARB(GL.TEXTURE1_ARB);
104- gl.enable(GL.TEXTURE_2D);
101+ GL.glActiveTextureARB(GL.GL_TEXTURE1_ARB);
102+ GL.glEnable(GL.GL_TEXTURE_2D);
105103 TextureManager.getTextureManager().bind(detailId);
106- gl.texEnvi(GL.TEXTURE_ENV, GL.TEXTURE_ENV_MODE, GL.COMBINE_ARB);
107- gl.texEnvi(GL.TEXTURE_ENV, GL.RGB_SCALE_ARB, 2);
104+ GL.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_COMBINE_ARB);
105+ GL.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_RGB_SCALE_ARB, 2);
108106 } else if (isTextured) {
109- gl.enable(GL.TEXTURE_2D);
107+ GL.glEnable(GL.GL_TEXTURE_2D);
110108 TextureManager.getTextureManager().bind(terrainTexture);
111109 }
112110
@@ -117,7 +115,7 @@ public class BruteForce extends Terrain {
117115 //be swapped. This will need to be resolved in the loaders, before
118116 //the terrain can be rendered in a normal fashion.
119117 for (int z = 0; z < terrainSize - 1; z++) {
120- gl.begin(GL.TRIANGLE_STRIP);
118+ GL.glBegin(GL.GL_TRIANGLE_STRIP);
121119
122120 if (isTextured) {
123121 texDown = (float) z / terrainSize;
@@ -138,21 +136,21 @@ public class BruteForce extends Terrain {
138136 green = 1.0f;
139137 blue = 1.0f;
140138 }
141- gl.color3f(red, green, blue);
139+ GL.glColor3f(red, green, blue);
142140
143141 if (isTextured && isDetailed) {
144142 texLeft = (float) x / terrainSize;
145- gl.multiTexCoord2fARB(GL.TEXTURE0_ARB, texDown, texLeft);
146- gl.multiTexCoord2fARB(
147- GL.TEXTURE1_ARB,
143+ GL.glMultiTexCoord2fARB(GL.GL_TEXTURE0_ARB, texDown, texLeft);
144+ GL.glMultiTexCoord2fARB(
145+ GL.GL_TEXTURE1_ARB,
148146 texLeft * repeatDetailMap,
149147 texDown * repeatDetailMap);
150148 } else if (isTextured) {
151149 texLeft = (float) x / terrainSize;
152- gl.texCoord2f(texLeft, texDown);
150+ GL.glTexCoord2f(texLeft, texDown);
153151 }
154152
155- gl.vertex3f(x, heightData.getScaledHeightAtPoint(z, x), z);
153+ GL.glVertex3f(x, heightData.getScaledHeightAtPoint(z, x), z);
156154
157155 if (isLit) {
158156 shade = lightMap.getShade(z+1,x);
@@ -164,38 +162,38 @@ public class BruteForce extends Terrain {
164162 green = 1.0f;
165163 blue = 1.0f;
166164 }
167- gl.color3f(red, green, blue);
165+ GL.glColor3f(red, green, blue);
168166
169167 if (isTextured && isDetailed) {
170- gl.multiTexCoord2fARB(GL.TEXTURE0_ARB, texUp, texLeft);
171- gl.multiTexCoord2fARB(
172- GL.TEXTURE1_ARB,
168+ GL.glMultiTexCoord2fARB(GL.GL_TEXTURE0_ARB, texUp, texLeft);
169+ GL.glMultiTexCoord2fARB(
170+ GL.GL_TEXTURE1_ARB,
173171 texLeft * repeatDetailMap,
174172 texUp * repeatDetailMap);
175173 } else if (isTextured) {
176- gl.texCoord2f(texLeft, texUp);
174+ GL.glTexCoord2f(texLeft, texUp);
177175 }
178176
179- gl.vertex3f(
177+ GL.glVertex3f(
180178 x,
181179 heightData.getScaledHeightAtPoint(z+1, x),
182180 z + 1);
183181 }
184182
185- gl.end();
183+ GL.glEnd();
186184 }
187185
188186
189187
190188 if (isDetailed) {
191- gl.activeTextureARB(GL.TEXTURE1_ARB);
192- gl.bindTexture(GL.TEXTURE_2D, 0);
193- gl.activeTextureARB(GL.TEXTURE0_ARB);
194- gl.bindTexture(GL.TEXTURE_2D, 0);
189+ GL.glActiveTextureARB(GL.GL_TEXTURE1_ARB);
190+ GL.glBindTexture(GL.GL_TEXTURE_2D, 0);
191+ GL.glActiveTextureARB(GL.GL_TEXTURE0_ARB);
192+ GL.glBindTexture(GL.GL_TEXTURE_2D, 0);
195193 }
196194
197195 if (isTextured) {
198- gl.disable(GL.TEXTURE_2D);
196+ GL.glDisable(GL.GL_TEXTURE_2D);
199197 }
200198
201199 }
--- a/src/jme/locale/external/Geomipmap.java
+++ b/src/jme/locale/external/Geomipmap.java
@@ -36,7 +36,6 @@ import java.util.logging.Level;
3636
3737 import jme.exception.MonkeyRuntimeException;
3838 import jme.locale.external.data.AbstractHeightMap;
39-import jme.system.DisplaySystem;
4039 import jme.entity.camera.Camera;
4140 import jme.texture.TextureManager;
4241 import jme.utility.LoggingSystem;
@@ -70,7 +69,7 @@ import org.lwjgl.opengl.GL;
7069 * <code>MidPointHeightMap</code> would not work for this.
7170 *
7271 * @author Mark Powell
73- * @version 0.1.0
72+ * @version $Id: Geomipmap.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
7473 */
7574 public class Geomipmap extends Terrain {
7675 private Camera camera;
@@ -96,7 +95,6 @@ public class Geomipmap extends Terrain {
9695 if (patchSize <= 0) {
9796 throw new MonkeyRuntimeException("patchSize must be greater than 0.");
9897 }
99- gl = DisplaySystem.getDisplaySystem().getGL();
10098
10199 this.heightData = heightMap;
102100 this.terrainSize = heightData.getSize();
@@ -190,7 +188,7 @@ public class Geomipmap extends Terrain {
190188
191189 if (patches[patch].isVisible || camera.hasMoved()) {
192190 patches[patch].distance =
193- org.lwjgl.Math.sqrt(
191+ (float)Math.sqrt(
194192 (patchX - camera.getPosition().x)
195193 * (patchX - camera.getPosition().x)
196194 + (patchY - camera.getPosition().y)
@@ -210,20 +208,20 @@ public class Geomipmap extends Terrain {
210208 */
211209 public void render() {
212210
213- gl.activeTextureARB(GL.TEXTURE0_ARB);
214- gl.enable(GL.TEXTURE_2D);
215- gl.enable(GL.DEPTH_TEST);
211+ GL.glActiveTextureARB(GL.GL_TEXTURE0_ARB);
212+ GL.glEnable(GL.GL_TEXTURE_2D);
213+ GL.glEnable(GL.GL_DEPTH_TEST);
216214 if(useDistanceFog || useVolumeFog) {
217- gl.enable(GL.FOG);
215+ GL.glEnable(GL.GL_FOG);
218216 }
219217 TextureManager.getTextureManager().bind(terrainTexture);
220218
221219 if (isDetailed) {
222- gl.activeTextureARB(GL.TEXTURE1_ARB);
223- gl.enable(GL.TEXTURE_2D);
220+ GL.glActiveTextureARB(GL.GL_TEXTURE1_ARB);
221+ GL.glEnable(GL.GL_TEXTURE_2D);
224222 TextureManager.getTextureManager().bind(detailId);
225- gl.texEnvi(GL.TEXTURE_ENV, GL.TEXTURE_ENV_MODE, GL.COMBINE_ARB);
226- gl.texEnvi(GL.TEXTURE_ENV, GL.RGB_SCALE_ARB, 2);
223+ GL.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_COMBINE_ARB);
224+ GL.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_RGB_SCALE_ARB, 2);
227225 }
228226
229227 patchesRendered = 0;
@@ -236,16 +234,16 @@ public class Geomipmap extends Terrain {
236234 }
237235 }
238236
239- gl.activeTextureARB(GL.TEXTURE1_ARB);
240- gl.disable(GL.TEXTURE_2D);
241- gl.bindTexture(GL.TEXTURE_2D, 0);
237+ GL.glActiveTextureARB(GL.GL_TEXTURE1_ARB);
238+ GL.glDisable(GL.GL_TEXTURE_2D);
239+ GL.glBindTexture(GL.GL_TEXTURE_2D, 0);
242240
243- gl.activeTextureARB(GL.TEXTURE0_ARB);
244- gl.disable(GL.TEXTURE_2D);
245- gl.bindTexture(GL.TEXTURE_2D, 0);
246- gl.disable(GL.DEPTH_TEST);
241+ GL.glActiveTextureARB(GL.GL_TEXTURE0_ARB);
242+ GL.glDisable(GL.GL_TEXTURE_2D);
243+ GL.glBindTexture(GL.GL_TEXTURE_2D, 0);
244+ GL.glDisable(GL.GL_DEPTH_TEST);
247245 if(useDistanceFog || useVolumeFog) {
248- gl.disable(GL.FOG);
246+ GL.glDisable(GL.GL_FOG);
249247 }
250248 }
251249
@@ -285,13 +283,13 @@ public class Geomipmap extends Terrain {
285283 green = 1.0f;
286284 blue = 1.0f;
287285 }
288- gl.color3f(red, green, blue);
286+ GL.glColor3f(red, green, blue);
289287
290288 //set up the texture coordinates.
291- gl.multiTexCoord2fARB(GL.TEXTURE0_ARB, u, v);
289+ GL.glMultiTexCoord2fARB(GL.GL_TEXTURE0_ARB, u, v);
292290 if (isDetailed) {
293- gl.multiTexCoord2fARB(
294- GL.TEXTURE1_ARB,
291+ GL.glMultiTexCoord2fARB(
292+ GL.GL_TEXTURE1_ARB,
295293 u * repeatDetailMap,
296294 v * repeatDetailMap);
297295 }
@@ -301,7 +299,7 @@ public class Geomipmap extends Terrain {
301299 heightData.getScaledHeightAtPoint((int) x, (int) z));
302300 }
303301 //render the point.
304- gl.vertex3f(
302+ GL.glVertex3f(
305303 x * xScale,
306304 heightData.getScaledHeightAtPoint((int) x, (int) z),
307305 z * zScale);
@@ -335,7 +333,7 @@ public class Geomipmap extends Terrain {
335333 midX = ((texLeft + texRight) / 2);
336334 midZ = ((texBottom + texTop) / 2);
337335
338- gl.begin(GL.TRIANGLE_FAN);
336+ GL.glBegin(GL.GL_TRIANGLE_FAN);
339337
340338 //a fan is rendered by drawing a line from the center to the
341339 //four corners. If a neighbor side is true, we also draw a
@@ -371,7 +369,7 @@ public class Geomipmap extends Terrain {
371369
372370 renderVertex(x - halfSize, z - halfSize, texLeft, texBottom);
373371
374- gl.end();
372+ GL.glEnd();
375373 }
376374
377375 /**
--- a/src/jme/locale/external/Terrain.java
+++ b/src/jme/locale/external/Terrain.java
@@ -34,12 +34,13 @@ package jme.locale.external;
3434
3535 import java.nio.ByteBuffer;
3636 import java.nio.ByteOrder;
37+import java.nio.FloatBuffer;
3738 import java.util.logging.Level;
3839
3940 import javax.swing.ImageIcon;
4041
41-import org.lwjgl.Sys;
4242 import org.lwjgl.opengl.GL;
43+import org.lwjgl.opengl.GLCaps;
4344
4445 import jme.exception.MonkeyRuntimeException;
4546 import jme.lighting.AbstractLightMap;
@@ -153,16 +154,13 @@ public abstract class Terrain implements Locale {
153154 */
154155 public void setFogAttributes(int mode, float[] color,
155156 float density, float start, float end) {
156- ByteBuffer temp = ByteBuffer.allocateDirect(16);
157- temp.order(ByteOrder.nativeOrder());
158-
159- gl.fogi(GL.FOG_MODE, mode);
160- gl.fogfv(GL.FOG_COLOR,
161- Sys.getDirectBufferAddress(
162- temp.asFloatBuffer().put(color)));
163- gl.fogf(GL.FOG_DENSITY, density);
164- gl.fogf(GL.FOG_START, start);
165- gl.fogf(GL.FOG_END, end);
157+ FloatBuffer buf = ByteBuffer.allocateDirect(16).order(ByteOrder.nativeOrder()).asFloatBuffer();
158+
159+ GL.glFogi(GL.GL_FOG_MODE, mode);
160+ GL.glFog(GL.GL_FOG_COLOR, buf);
161+ GL.glFogf(GL.GL_FOG_DENSITY, density);
162+ GL.glFogf(GL.GL_FOG_START, start);
163+ GL.glFogf(GL.GL_FOG_END, end);
166164 }
167165
168166 /**
@@ -192,9 +190,9 @@ public abstract class Terrain implements Locale {
192190 public void setDistanceFog(boolean value) {
193191 useDistanceFog = value;
194192 if(value) {
195- gl.enable(GL.FOG);
193+ GL.glEnable(GL.GL_FOG);
196194 } else {
197- gl.disable(GL.FOG);
195+ GL.glDisable(GL.GL_FOG);
198196 }
199197 }
200198
@@ -217,10 +215,10 @@ public abstract class Terrain implements Locale {
217215 useVolumeFog = value;
218216
219217 if(value) {
220- gl.fogi( GL.FOG_COORDINATE_SOURCE_EXT, GL.FOG_COORDINATE_EXT );
221- gl.enable(GL.FOG);
218+ GL.glFogi( GL.GL_FOG_COORDINATE_SOURCE_EXT, GL.GL_FOG_COORDINATE_EXT );
219+ GL.glEnable(GL.GL_FOG);
222220 } else {
223- gl.disable(GL.FOG);
221+ GL.glDisable(GL.GL_FOG);
224222 }
225223 }
226224
@@ -231,9 +229,9 @@ public abstract class Terrain implements Locale {
231229 */
232230 protected void setVolumetricFogCoord(float height) {
233231 if(height > fogDepth) {
234- gl.fogCoordfEXT(-(height-fogDepth));
232+ GL.glFogCoordfEXT(-(height-fogDepth));
235233 } else {
236- gl.fogCoordfEXT(0);
234+ GL.glFogCoordfEXT(0);
237235 }
238236 }
239237
@@ -247,7 +245,7 @@ public abstract class Terrain implements Locale {
247245 public void setDetailTexture(String detailTexture, int repeat) {
248246
249247 this.repeatDetailMap = repeat;
250- boolean canMulti = gl.ARB_multitexture;
248+ boolean canMulti = GLCaps.GL_ARB_multitexture;
251249
252250 if (!canMulti) {
253251 LoggingSystem.getLoggingSystem().getLogger().log(
@@ -258,8 +256,8 @@ public abstract class Terrain implements Locale {
258256 if(null != detailTexture && canMulti) {
259257 detailId = TextureManager.getTextureManager().loadTexture(
260258 detailTexture,
261- GL.LINEAR_MIPMAP_LINEAR,
262- GL.LINEAR,
259+ GL.GL_LINEAR_MIPMAP_LINEAR,
260+ GL.GL_LINEAR,
263261 true);
264262 isDetailed = true;
265263 } else {
@@ -277,8 +275,8 @@ public abstract class Terrain implements Locale {
277275 if (texture != null) {
278276 if((terrainTexture = TextureManager.getTextureManager().loadTexture(
279277 texture,
280- GL.LINEAR_MIPMAP_LINEAR,
281- GL.LINEAR,
278+ GL.GL_LINEAR_MIPMAP_LINEAR,
279+ GL.GL_LINEAR,
282280 true)) != -1) {
283281 isTextured = true;
284282 }
@@ -297,8 +295,8 @@ public abstract class Terrain implements Locale {
297295 if (texture != null) {
298296 if((terrainTexture = TextureManager.getTextureManager().loadTexture(
299297 texture,
300- GL.LINEAR_MIPMAP_LINEAR,
301- GL.LINEAR,
298+ GL.GL_LINEAR_MIPMAP_LINEAR,
299+ GL.GL_LINEAR,
302300 true)) != -1) {
303301 isTextured = true;
304302 }
--- a/src/jme/locale/external/feature/SkyBox.java
+++ b/src/jme/locale/external/feature/SkyBox.java
@@ -35,12 +35,11 @@ package jme.locale.external.feature;
3535 import java.util.logging.Level;
3636
3737 import jme.exception.MonkeyRuntimeException;
38-import jme.system.DisplaySystem;
38+import jme.math.Vector;
3939 import jme.texture.TextureManager;
4040 import jme.utility.LoggingSystem;
4141
4242 import org.lwjgl.opengl.GL;
43-import org.lwjgl.vector.Vector3f;
4443
4544 /**
4645 * <code>SkyBox</code> defines a implementation of the sky interface
@@ -49,7 +48,7 @@ import org.lwjgl.vector.Vector3f;
4948 * depth buffer for the skybox is turn off so it will always appear behind
5049 * any object/locale rendered. The skybox moves with the connected entity.
5150 * @author Mark Powell
52- * @version 0.1.0
51+ * @version $Id: SkyBox.java,v 1.2 2003-09-03 16:20:51 mojomonkey Exp $
5352 */
5453 public class SkyBox implements Sky {
5554 /**
@@ -78,15 +77,12 @@ public class SkyBox implements Sky {
7877 public static final int BACK = 5;
7978
8079 //area of the box
81- private Vector3f center;
80+ private Vector center;
8281 private float size;
8382
8483 //appearance of box
8584 private int[] textures;
86- private Vector3f color;
87-
88- //gl object for rendering.
89- private GL gl;
85+ private Vector color;
9086
9187 /**
9288 * Constructor creates a new <code>SkyBox</code> object. The size of
@@ -95,12 +91,11 @@ public class SkyBox implements Sky {
9591 * @param size the size of each side of the box.
9692 */
9793 public SkyBox(float size) {
98- center = new Vector3f();
94+ center = new Vector();
9995 textures = new int[6];
100- gl = DisplaySystem.getDisplaySystem().getGL();
10196 this.size = size / 2;
102- this.center = new Vector3f(this.size, 32, this.size);
103- color = new Vector3f(1.0f, 1.0f, 1.0f);
97+ this.center = new Vector(this.size, 32, this.size);
98+ color = new Vector(1.0f, 1.0f, 1.0f);
10499
105100 LoggingSystem.getLoggingSystem().getLogger().log(
106101 Level.INFO,
@@ -122,8 +117,8 @@ public class SkyBox implements Sky {
122117
123118 textures[side] = TextureManager.getTextureManager().loadTexture(
124119 filename,
125- GL.LINEAR_MIPMAP_LINEAR,
126- GL.LINEAR,
120+ GL.GL_LINEAR_MIPMAP_LINEAR,
121+ GL.GL_LINEAR,
127122 true);
128123 }
129124
@@ -145,8 +140,8 @@ public class SkyBox implements Sky {
145140 for (int i = 0; i < 6; i++) {
146141 this.textures[i] = TextureManager.getTextureManager().loadTexture(
147142 textures[i],
148- GL.LINEAR_MIPMAP_LINEAR,
149- GL.LINEAR,
143+ GL.GL_LINEAR_MIPMAP_LINEAR,
144+ GL.GL_LINEAR,
150145 true);
151146 }
152147 }
@@ -163,7 +158,7 @@ public class SkyBox implements Sky {
163158 * <code>setColor</code> sets the color tint of the skybox.
164159 * @param color the tint of the box.
165160 */
166- public void setColor(Vector3f color) {
161+ public void setColor(Vector color) {
167162 if (null == color) {
168163 throw new MonkeyRuntimeException("Color cannot be null.");
169164 }
@@ -184,93 +179,93 @@ public class SkyBox implements Sky {
184179 */
185180 public void render() {
186181
187- gl.color4f(color.x, color.y, color.z, 1.0f);
188- gl.enable(GL.TEXTURE_2D);
189- gl.disable(GL.DEPTH_TEST);
182+ GL.glColor4f(color.x, color.y, color.z, 1.0f);
183+ GL.glEnable(GL.GL_TEXTURE_2D);
184+ GL.glDisable(GL.GL_DEPTH_TEST);
190185
191- gl.pushMatrix();
192- gl.translatef(center.x, center.y, center.z);
186+ GL.glPushMatrix();
187+ GL.glTranslatef(center.x, center.y, center.z);
193188
194189 //front face
195190 TextureManager.getTextureManager().bind(textures[FRONT]);
196- gl.begin(GL.TRIANGLE_FAN);
197- gl.texCoord2f(1.0f, 1.0f);
198- gl.vertex3f(size, size, size);
199- gl.texCoord2f(1.0f, 0.0f);
200- gl.vertex3f(size, -size, size);
201- gl.texCoord2f(0.0f, 0.0f);
202- gl.vertex3f(-size, -size, size);
203- gl.texCoord2f(0.0f, 1.0f);
204- gl.vertex3f(-size, size, size);
205- gl.end();
191+ GL.glBegin(GL.GL_TRIANGLE_FAN);
192+ GL.glTexCoord2f(1.0f, 1.0f);
193+ GL.glVertex3f(size, size, size);
194+ GL.glTexCoord2f(1.0f, 0.0f);
195+ GL.glVertex3f(size, -size, size);
196+ GL.glTexCoord2f(0.0f, 0.0f);
197+ GL.glVertex3f(-size, -size, size);
198+ GL.glTexCoord2f(0.0f, 1.0f);
199+ GL.glVertex3f(-size, size, size);
200+ GL.glEnd();
206201
207202 //back face
208203 TextureManager.getTextureManager().bind(textures[BACK]);
209- gl.begin(GL.TRIANGLE_FAN);
210- gl.texCoord2f(1.0f, 1.0f);
211- gl.vertex3f(-size, size, -size);
212- gl.texCoord2f(1.0f, 0.0f);
213- gl.vertex3f(-size, -size, -size);
214- gl.texCoord2f(0.0f, 0.0f);
215- gl.vertex3f(size, -size, -size);
216- gl.texCoord2f(0.0f, 1.0f);
217- gl.vertex3f(size, size, -size);
218- gl.end();
204+ GL.glBegin(GL.GL_TRIANGLE_FAN);
205+ GL.glTexCoord2f(1.0f, 1.0f);
206+ GL.glVertex3f(-size, size, -size);
207+ GL.glTexCoord2f(1.0f, 0.0f);
208+ GL.glVertex3f(-size, -size, -size);
209+ GL.glTexCoord2f(0.0f, 0.0f);
210+ GL.glVertex3f(size, -size, -size);
211+ GL.glTexCoord2f(0.0f, 1.0f);
212+ GL.glVertex3f(size, size, -size);
213+ GL.glEnd();
219214
220215 //right face
221216 TextureManager.getTextureManager().bind(textures[RIGHT]);
222- gl.begin(GL.TRIANGLE_FAN);
223- gl.texCoord2f(1.0f, 1.0f);
224- gl.vertex3f(size, size, -size);
225- gl.texCoord2f(1.0f, 0.0f);
226- gl.vertex3f(size, -size, -size);
227- gl.texCoord2f(0.0f, 0.0f);
228- gl.vertex3f(size, -size, size);
229- gl.texCoord2f(0.0f, 1.0f);
230- gl.vertex3f(size, size, size);
231- gl.end();
217+ GL.glBegin(GL.GL_TRIANGLE_FAN);
218+ GL.glTexCoord2f(1.0f, 1.0f);
219+ GL.glVertex3f(size, size, -size);
220+ GL.glTexCoord2f(1.0f, 0.0f);
221+ GL.glVertex3f(size, -size, -size);
222+ GL.glTexCoord2f(0.0f, 0.0f);
223+ GL.glVertex3f(size, -size, size);
224+ GL.glTexCoord2f(0.0f, 1.0f);
225+ GL.glVertex3f(size, size, size);
226+ GL.glEnd();
232227
233228 //left face
234229 TextureManager.getTextureManager().bind(textures[LEFT]);
235- gl.begin(GL.TRIANGLE_FAN);
236- gl.texCoord2f(1.0f, 1.0f);
237- gl.vertex3f(-size, size, size);
238- gl.texCoord2f(1.0f, 0.0f);
239- gl.vertex3f(-size, -size, size);
240- gl.texCoord2f(0.0f, 0.0f);
241- gl.vertex3f(-size, -size, -size);
242- gl.texCoord2f(0.0f, 1.0f);
243- gl.vertex3f(-size, size, -size);
244- gl.end();
230+ GL.glBegin(GL.GL_TRIANGLE_FAN);
231+ GL.glTexCoord2f(1.0f, 1.0f);
232+ GL.glVertex3f(-size, size, size);
233+ GL.glTexCoord2f(1.0f, 0.0f);
234+ GL.glVertex3f(-size, -size, size);
235+ GL.glTexCoord2f(0.0f, 0.0f);
236+ GL.glVertex3f(-size, -size, -size);
237+ GL.glTexCoord2f(0.0f, 1.0f);
238+ GL.glVertex3f(-size, size, -size);
239+ GL.glEnd();
245240
246241 //top face
247242 TextureManager.getTextureManager().bind(textures[TOP]);
248- gl.begin(GL.TRIANGLE_FAN);
249- gl.texCoord2f(0.0f, 0.0f);
250- gl.vertex3f(-size, size, size);
251- gl.texCoord2f(0.0f, 1.0f);
252- gl.vertex3f(-size, size, -size);
253- gl.texCoord2f(1.0f, 1.0f);
254- gl.vertex3f(size, size, -size);
255- gl.texCoord2f(1.0f, 0.0f);
256- gl.vertex3f(size, size, size);
257- gl.end();
243+ GL.glBegin(GL.GL_TRIANGLE_FAN);
244+ GL.glTexCoord2f(0.0f, 0.0f);
245+ GL.glVertex3f(-size, size, size);
246+ GL.glTexCoord2f(0.0f, 1.0f);
247+ GL.glVertex3f(-size, size, -size);
248+ GL.glTexCoord2f(1.0f, 1.0f);
249+ GL.glVertex3f(size, size, -size);
250+ GL.glTexCoord2f(1.0f, 0.0f);
251+ GL.glVertex3f(size, size, size);
252+ GL.glEnd();
258253
259254 //bottom face
260255 TextureManager.getTextureManager().bind(textures[BOTTOM]);
261- gl.begin(GL.TRIANGLE_FAN);
262- gl.texCoord2f(0.0f, 0.0f);
263- gl.vertex3f(-size, -size, -size);
264- gl.texCoord2f(0.0f, 1.0f);
265- gl.vertex3f(-size, -size, size);
266- gl.texCoord2f(1.0f, 1.0f);
267- gl.vertex3f(size, -size, size);
268- gl.texCoord2f(1.0f, 0.0f);
269- gl.vertex3f(size, -size, -size);
270- gl.end();
271- gl.popMatrix();
256+ GL.glBegin(GL.GL_TRIANGLE_FAN);
257+ GL.glTexCoord2f(0.0f, 0.0f);
258+ GL.glVertex3f(-size, -size, -size);
259+ GL.glTexCoord2f(0.0f, 1.0f);
260+ GL.glVertex3f(-size, -size, size);
261+ GL.glTexCoord2f(1.0f, 1.0f);
262+ GL.glVertex3f(size, -size, size);
263+ GL.glTexCoord2f(1.0f, 0.0f);
264+ GL.glVertex3f(size, -size, -size);
265+ GL.glEnd();
266+ GL.glPopMatrix();
272267
273- gl.enable(GL.DEPTH_TEST);
268+ GL.glEnable(GL.GL_DEPTH_TEST);
274269 }
275270
276271 }
--- a/src/jme/locale/external/feature/SkyDome.java
+++ b/src/jme/locale/external/feature/SkyDome.java
@@ -35,11 +35,11 @@ import java.util.logging.Level;
3535
3636 import jme.exception.MonkeyGLException;
3737 import jme.geometry.model.Vertex;
38-import jme.system.DisplaySystem;
3938 import jme.texture.TextureManager;
4039 import jme.utility.LoggingSystem;
4140
4241 import org.lwjgl.opengl.GL;
42+import org.lwjgl.opengl.Window;
4343
4444 /**
4545 * <code>SkyDome</code> defines an implementation of the sky interface where
@@ -52,11 +52,11 @@ import org.lwjgl.opengl.GL;
5252 * <a href="http://www.spheregames.com/files/SkyDomesPDF.zip">this</a>
5353 * PDF file.
5454 * @author Mark Powell
55+ * @version $Id: SkyDome.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
5556 */
5657 public class SkyDome implements Sky {
5758
5859 private int texId;
59- private GL gl;
6060
6161 //attributes of the dome
6262 private float radius;
@@ -97,11 +97,9 @@ public class SkyDome implements Sky {
9797 float hTile,
9898 float vTile) {
9999
100- gl = DisplaySystem.getDisplaySystem().getGL();
101-
102- if (null == gl) {
100+ if (!Window.isCreated()) {
103101 throw new MonkeyGLException(
104- "GL must be initialized before " + "calling SkyDome.");
102+ "Window must be created before SkyDome.");
105103 }
106104
107105 this.radius = radius;
@@ -126,8 +124,8 @@ public class SkyDome implements Sky {
126124 texId =
127125 TextureManager.getTextureManager().loadTexture(
128126 filename,
129- GL.LINEAR_MIPMAP_LINEAR,
130- GL.LINEAR,
127+ GL.GL_LINEAR_MIPMAP_LINEAR,
128+ GL.GL_LINEAR,
131129 true);
132130 }
133131
@@ -188,31 +186,31 @@ public class SkyDome implements Sky {
188186 * texture.
189187 */
190188 public void render() {
191- gl.enable(GL.TEXTURE_2D);
192- gl.disable(GL.DEPTH_TEST);
193- gl.cullFace(GL.FRONT);
194- gl.bindTexture(GL.TEXTURE_2D, texId);
189+ GL.glEnable(GL.GL_TEXTURE_2D);
190+ GL.glDisable(GL.GL_DEPTH_TEST);
191+ GL.glCullFace(GL.GL_FRONT);
192+ GL.glBindTexture(GL.GL_TEXTURE_2D, texId);
195193
196- gl.pushMatrix();
197- gl.rotatef(270, 1.0f, 0.0f, 0.0f);
198- gl.rotatef(rotation, 0.0f, 0.0f, 1.0f);
199- gl.begin(GL.TRIANGLE_STRIP);
194+ GL.glPushMatrix();
195+ GL.glRotatef(270, 1.0f, 0.0f, 0.0f);
196+ GL.glRotatef(rotation, 0.0f, 0.0f, 1.0f);
197+ GL.glBegin(GL.GL_TRIANGLE_STRIP);
200198
201199 for (int i = 0; i < numVertices; i++) {
202- gl.color3f(1.0f, 1.0f, 1.0f);
200+ GL.glColor3f(1.0f, 1.0f, 1.0f);
203201
204- gl.texCoord2f(
202+ GL.glTexCoord2f(
205203 vertices[i].u + xTexAnimation,
206204 vertices[i].v + yTexAnimation);
207- gl.vertex3f(vertices[i].x, vertices[i].y, vertices[i].z);
205+ GL.glVertex3f(vertices[i].x, vertices[i].y, vertices[i].z);
208206 }
209207
210- gl.end();
208+ GL.glEnd();
211209
212- gl.popMatrix();
213- gl.disable(GL.TEXTURE_2D);
214- gl.enable(GL.DEPTH_TEST);
215- gl.cullFace(GL.BACK);
210+ GL.glPopMatrix();
211+ GL.glDisable(GL.GL_TEXTURE_2D);
212+ GL.glEnable(GL.GL_DEPTH_TEST);
213+ GL.glCullFace(GL.GL_BACK);
216214 }
217215
218216 /**
--- a/src/jme/locale/external/feature/WaterMesh.java
+++ b/src/jme/locale/external/feature/WaterMesh.java
@@ -33,9 +33,7 @@ package jme.locale.external.feature;
3333
3434 import java.util.logging.Level;
3535
36-import jme.exception.MonkeyGLException;
3736 import jme.exception.MonkeyRuntimeException;
38-import jme.system.DisplaySystem;
3937 import jme.texture.TextureManager;
4038 import jme.utility.LoggingSystem;
4139
@@ -45,10 +43,10 @@ import org.lwjgl.opengl.GL;
4543 * <code>WaterMesh</code> creates a mesh that represents water height values.
4644 * This mesh contains a wave origin that causes ripples to flow outward.
4745 * @author Mark Powell
46+ * @version $Id: WaterMesh.java,v 1.2 2003-09-03 16:20:51 mojomonkey Exp $
4847 */
4948 public class WaterMesh implements Water {
5049 private int texId;
51- private GL gl;
5250 private float height;
5351 private int size;
5452 private int spacing;
@@ -74,13 +72,7 @@ public class WaterMesh implements Water {
7472 * @throws MonkeyRuntimeException if size is negative.
7573 */
7674 public WaterMesh(int size, int spacing, float amplitude) {
77- gl = DisplaySystem.getDisplaySystem().getGL();
78-
79- if (null == gl) {
80- throw new MonkeyGLException(
81- "OpenGL Context must be created before WaterMesh.");
82- }
83-
75+
8476 water = new float[size][size];
8577 wt = new float[size][size];
8678 v = -4;
@@ -111,8 +103,8 @@ public class WaterMesh implements Water {
111103 texId =
112104 TextureManager.getTextureManager().loadTexture(
113105 filename,
114- GL.LINEAR_MIPMAP_LINEAR,
115- GL.LINEAR,
106+ GL.GL_LINEAR_MIPMAP_LINEAR,
107+ GL.GL_LINEAR,
116108 true);
117109 }
118110
@@ -169,17 +161,17 @@ public class WaterMesh implements Water {
169161 * <code>render</code> displays the water mesh to the view port.
170162 */
171163 public void render() {
172- gl.enable(GL.BLEND);
173- gl.enable(GL.TEXTURE_2D);
174- gl.enable(GL.DEPTH_TEST);
175- gl.disable(GL.CULL_FACE);
164+ GL.glEnable(GL.GL_BLEND);
165+ GL.glEnable(GL.GL_TEXTURE_2D);
166+ GL.glEnable(GL.GL_DEPTH_TEST);
167+ GL.glDisable(GL.GL_CULL_FACE);
176168 TextureManager.getTextureManager().bind(texId);
177169 float tx, ty;
178170
179171 /* Draw water */
180- gl.color4f(1f, 1f, 1f, 0.6f);
172+ GL.glColor4f(1f, 1f, 1f, 0.6f);
181173
182- gl.begin(GL.TRIANGLES);
174+ GL.glBegin(GL.GL_TRIANGLES);
183175 float td = (float)1 / size;
184176
185177 for (int i = 0; i < size - 1; i++) {
@@ -188,38 +180,38 @@ public class WaterMesh implements Water {
188180 for (int j = 0; j < size - 1; j++) {
189181 ty = (float)j / size;
190182
191- gl.texCoord2f(tx, ty);
192- gl.vertex3f(spacing * i, water[i][j] + height, spacing * j);
193- gl.texCoord2f(tx + td, ty);
194- gl.vertex3f(
183+ GL.glTexCoord2f(tx, ty);
184+ GL.glVertex3f(spacing * i, water[i][j] + height, spacing * j);
185+ GL.glTexCoord2f(tx + td, ty);
186+ GL.glVertex3f(
195187 spacing * (i + 1),
196188 water[i + 1][j] + height,
197189 spacing * j);
198- gl.texCoord2f(tx + td, ty + td);
199- gl.vertex3f(
190+ GL.glTexCoord2f(tx + td, ty + td);
191+ GL.glVertex3f(
200192 spacing * (i + 1),
201193 water[i + 1][j + 1] + height,
202194 spacing * (j + 1));
203195
204- gl.texCoord2f(tx, ty + td);
205- gl.vertex3f(
196+ GL.glTexCoord2f(tx, ty + td);
197+ GL.glVertex3f(
206198 spacing * i,
207199 water[i][j + 1] + height,
208200 spacing * (j + 1));
209- gl.texCoord2f(tx, ty);
210- gl.vertex3f(spacing * i, water[i][j] + height, spacing * j);
211- gl.texCoord2f(tx + td, ty + td);
212- gl.vertex3f(
201+ GL.glTexCoord2f(tx, ty);
202+ GL.glVertex3f(spacing * i, water[i][j] + height, spacing * j);
203+ GL.glTexCoord2f(tx + td, ty + td);
204+ GL.glVertex3f(
213205 spacing * (i + 1),
214206 water[i + 1][j + 1] + height,
215207 spacing * (j + 1));
216208 }
217209 }
218- gl.end();
210+ GL.glEnd();
219211
220- gl.disable(GL.BLEND);
221- gl.disable(GL.TEXTURE_2D);
222- gl.disable(GL.DEPTH_TEST);
223- gl.enable(GL.CULL_FACE);
212+ GL.glDisable(GL.GL_BLEND);
213+ GL.glDisable(GL.GL_TEXTURE_2D);
214+ GL.glDisable(GL.GL_DEPTH_TEST);
215+ GL.glEnable(GL.GL_CULL_FACE);
224216 }
225217 }
--- a/src/jme/locale/external/feature/WaterPlane.java
+++ b/src/jme/locale/external/feature/WaterPlane.java
@@ -33,7 +33,6 @@ package jme.locale.external.feature;
3333
3434 import jme.exception.MonkeyRuntimeException;
3535 import jme.math.Vector;
36-import jme.system.DisplaySystem;
3736 import jme.texture.TextureManager;
3837
3938 import org.lwjgl.opengl.GL;
@@ -46,7 +45,7 @@ import org.lwjgl.opengl.GL;
4645 * the texture sliding across the plane.
4746 *
4847 * @author Mark Powell
49- * @version 1
48+ * @version $Id: WaterPlane.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
5049 */
5150 public class WaterPlane implements Water {
5251
@@ -77,8 +76,6 @@ public class WaterPlane implements Water {
7776 private float changeX = 0.0f;
7877 private float changeZ = 0.0f;
7978
80- //opengl object
81- private GL gl;
8279
8380 /**
8481 * Constructor instantiates a new <code>WaterPlane</code> object.
@@ -97,7 +94,6 @@ public class WaterPlane implements Water {
9794 this.baseLevel = baseLevel;
9895 this.variation = variation;
9996
100- gl = DisplaySystem.getDisplaySystem().getGL();
10197 }
10298
10399 /**
@@ -111,8 +107,8 @@ public class WaterPlane implements Water {
111107 }
112108 texId = TextureManager.getTextureManager().loadTexture(
113109 filename,
114- GL.LINEAR_MIPMAP_LINEAR,
115- GL.LINEAR,
110+ GL.GL_LINEAR_MIPMAP_LINEAR,
111+ GL.GL_LINEAR,
116112 true);
117113 }
118114
@@ -197,34 +193,34 @@ public class WaterPlane implements Water {
197193 * texture, color and location.
198194 */
199195 public void render() {
200- gl.enable(GL.BLEND);
201- gl.enable(GL.TEXTURE_2D);
202- gl.enable(GL.DEPTH_TEST);
203- gl.disable(GL.CULL_FACE);
204- gl.blendFunc(GL.SRC_ALPHA, GL.ONE);
196+ GL.glEnable(GL.GL_BLEND);
197+ GL.glEnable(GL.GL_TEXTURE_2D);
198+ GL.glEnable(GL.GL_DEPTH_TEST);
199+ GL.glDisable(GL.GL_CULL_FACE);
200+ GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
205201
206- gl.color4f(color.x, color.y, color.z, transparency);
202+ GL.glColor4f(color.x, color.y, color.z, transparency);
207203
208204 TextureManager.getTextureManager().bind(texId);
209205
210- gl.begin(GL.TRIANGLE_STRIP);
206+ GL.glBegin(GL.GL_TRIANGLE_STRIP);
211207
212208
213- gl.texCoord2f(changeX, changeZ);
214- gl.vertex3f(0.0f, currentLevel, 0.0f);
215- gl.texCoord2f(changeX + repeat, changeZ);
216- gl.vertex3f(size, currentLevel, 0.0f);
217- gl.texCoord2f(changeX, changeZ+repeat);
218- gl.vertex3f(0.0f, currentLevel, size);
219- gl.texCoord2f(changeX + repeat, changeZ + repeat);
220- gl.vertex3f(size, currentLevel, size);
209+ GL.glTexCoord2f(changeX, changeZ);
210+ GL.glVertex3f(0.0f, currentLevel, 0.0f);
211+ GL.glTexCoord2f(changeX + repeat, changeZ);
212+ GL.glVertex3f(size, currentLevel, 0.0f);
213+ GL.glTexCoord2f(changeX, changeZ+repeat);
214+ GL.glVertex3f(0.0f, currentLevel, size);
215+ GL.glTexCoord2f(changeX + repeat, changeZ + repeat);
216+ GL.glVertex3f(size, currentLevel, size);
221217
222- gl.end();
218+ GL.glEnd();
223219
224- gl.disable(GL.BLEND);
225- gl.disable(GL.TEXTURE_2D);
226- gl.disable(GL.DEPTH_TEST);
227- gl.enable(GL.CULL_FACE);
220+ GL.glDisable(GL.GL_BLEND);
221+ GL.glDisable(GL.GL_TEXTURE_2D);
222+ GL.glDisable(GL.GL_DEPTH_TEST);
223+ GL.glEnable(GL.GL_CULL_FACE);
228224 }
229225
230226 }
--- a/src/jme/system/DisplaySystem.java
+++ b/src/jme/system/DisplaySystem.java
@@ -48,11 +48,11 @@ import jme.utility.LoggingSystem;
4848
4949 import org.lwjgl.Display;
5050 import org.lwjgl.DisplayMode;
51-import org.lwjgl.Sys;
5251 import org.lwjgl.input.Keyboard;
5352 import org.lwjgl.input.Mouse;
5453 import org.lwjgl.opengl.GL;
55-import org.lwjgl.opengl.GLU;
54+import org.lwjgl.opengl.GLCaps;
55+import org.lwjgl.opengl.Window;
5656
5757 /**
5858 * <code>DisplaySystem</code> manages the Window and OpenGL context of the
@@ -82,10 +82,6 @@ public class DisplaySystem {
8282 //Singleton reference.
8383 private static DisplaySystem instance = null;
8484
85- //the OpenGL objects
86- private static GL gl;
87- private static GLU glu;
88-
8985 //attributes of the window
9086 private int height;
9187 private int width;
@@ -179,7 +175,7 @@ public class DisplaySystem {
179175 this.title = title;
180176
181177 //recreate the display
182- gl.destroy();
178+ Window.destroy();
183179 initDisplay();
184180 Keyboard.destroy();
185181 Mouse.destroy();
@@ -280,30 +276,6 @@ public class DisplaySystem {
280276 }
281277
282278 /**
283- * <code>getGL</code> returns the OpenGL core object. This <code>GL</code>
284- * object can be used to make any calls to the OpenGL core gl functions.
285- *
286- * @return the <code>GL</code> object referred to this display. If
287- * <code>createDisplaySystem</code> has not been called before invoking
288- * this method, null will be returned.
289- */
290- public GL getGL() {
291- return gl;
292- }
293-
294- /**
295- * <code>getGLU</code> returns the OpenGL utility object. This <code>GLU</code>
296- * object can be used to make any calls to the OpenGL utility functions.
297- *
298- * @return the <code>GLU</code> object referred to this display. If
299- * <code>createDisplaySystem</code> has not been called before invoking
300- * this method, null will be returned.
301- */
302- public GLU getGLU() {
303- return glu;
304- }
305-
306- /**
307279 * <code>getDisplaySystem</code> returns the reference to the singleton
308280 * object of the <code>DisplaySystem</code>. After a call to
309281 * <code>createDisplaySystem</code> is made, you can retrieve any
@@ -359,11 +331,11 @@ public class DisplaySystem {
359331 * @param on true turn on culling, false turn it off.
360332 */
361333 public void cullMode(int mode, boolean on) {
362- gl.cullFace(mode);
334+ GL.glCullFace(mode);
363335 if (on) {
364- gl.enable(GL.CULL_FACE);
336+ GL.glEnable(GL.GL_CULL_FACE);
365337 } else {
366- gl.disable(GL.CULL_FACE);
338+ GL.glDisable(GL.GL_CULL_FACE);
367339 }
368340 }
369341
@@ -395,15 +367,14 @@ public class DisplaySystem {
395367 .allocateDirect(width * height * 4)
396368 .order(ByteOrder.nativeOrder())
397369 .asIntBuffer();
398- int buffh = Sys.getDirectBufferAddress(buff);
399- gl.readPixels(
370+ GL.glReadPixels(
400371 0,
401372 0,
402373 width,
403374 height,
404- GL.BGRA,
405- GL.UNSIGNED_BYTE,
406- buffh);
375+ GL.GL_BGRA,
376+ GL.GL_UNSIGNED_BYTE,
377+ buff);
407378 BufferedImage img =
408379 new BufferedImage(
409380 width,
@@ -452,7 +423,7 @@ public class DisplaySystem {
452423
453424 if (fullscreen) {
454425 Display.setDisplayMode(mode);
455- gl = new GL(title, bpp, 0, 16, 0);
426+ Window.create(title, bpp, 0, 16, 0);
456427 } else {
457428 int x, y;
458429 x =
@@ -462,11 +433,10 @@ public class DisplaySystem {
462433 (Toolkit.getDefaultToolkit().getScreenSize().height
463434 - height)
464435 / 2;
465- gl = new GL(title, x, y, width, height, bpp, 0, 16, 0);
436+ Window.create(title, x, y, width, height, bpp, 0, 16, 0);
466437 }
467438
468- gl.create();
469- gl.determineAvailableExtensions();
439+ GLCaps.determineAvailableExtensions();
470440
471441 LoggingSystem.getLoggingSystem().getLogger().log(
472442 Level.INFO,
@@ -477,7 +447,5 @@ public class DisplaySystem {
477447 "Failed to create display due to " + e);
478448 System.exit(1);
479449 }
480-
481- glu = new GLU(gl);
482450 }
483451 }
--- a/src/jme/texture/TextureManager.java
+++ b/src/jme/texture/TextureManager.java
@@ -55,12 +55,11 @@ import javax.swing.ImageIcon;
5555
5656 import jme.exception.MonkeyGLException;
5757 import jme.exception.MonkeyRuntimeException;
58-import jme.system.DisplaySystem;
5958 import jme.utility.LoggingSystem;
6059
61-import org.lwjgl.Sys;
6260 import org.lwjgl.opengl.GL;
6361 import org.lwjgl.opengl.GLU;
62+import org.lwjgl.opengl.Window;
6463
6564 /**
6665 * <code>TextureManager</code> maintains all textures within the running
@@ -122,13 +121,10 @@ public class TextureManager {
122121 * @throws MonkeyGLException if OpenGL context has not been created.
123122 */
124123 private TextureManager() {
125- gl = DisplaySystem.getDisplaySystem().getGL();
126- glu = DisplaySystem.getDisplaySystem().getGLU();
127124
128- if (null == gl || null == glu) {
125+ if (!Window.isCreated()) {
129126 throw new MonkeyGLException(
130- "GL/GLU must be initialized before "
131- + "calling TextureManager.");
127+ "Window must be created before " + "TextureManager.");
132128 }
133129 textureList = new HashMap();
134130 keyList = new ArrayList();
@@ -330,7 +326,7 @@ public class TextureManager {
330326
331327 if (id != boundID) {
332328 boundID = id;
333- gl.bindTexture(GL.TEXTURE_2D, id);
329+ GL.glBindTexture(GL.GL_TEXTURE_2D, id);
334330 }
335331
336332 return true;
@@ -353,7 +349,7 @@ public class TextureManager {
353349 public void bind(int id) {
354350 if (id != boundID) {
355351 boundID = id;
356- gl.bindTexture(GL.TEXTURE_2D, id);
352+ GL.glBindTexture(GL.GL_TEXTURE_2D, id);
357353 }
358354 }
359355
@@ -378,9 +374,7 @@ public class TextureManager {
378374 .order(ByteOrder.nativeOrder())
379375 .asIntBuffer();
380376 buf.put(id);
381- int bufPtr = Sys.getDirectBufferAddress(buf);
382-
383- gl.deleteTextures(1, bufPtr);
377+ GL.glDeleteTextures(buf);
384378 textureList.remove(file);
385379 return true;
386380 }
@@ -404,16 +398,14 @@ public class TextureManager {
404398 for (int i = 0; i < keyList.size(); i++) {
405399 key = ((TextureData) keyList.get(i)).name;
406400 id = ((Integer) textureList.get(key)).intValue();
407- if (gl.isTexture(id)) {
401+ if (GL.glIsTexture(id)) {
408402 IntBuffer buf =
409403 ByteBuffer
410404 .allocateDirect(4)
411405 .order(ByteOrder.nativeOrder())
412406 .asIntBuffer();
413407 buf.put(id);
414- int bufPtr = Sys.getDirectBufferAddress(buf);
415-
416- gl.deleteTextures(1, bufPtr);
408+ GL.glDeleteTextures(buf);
417409 }
418410 }
419411
@@ -505,8 +497,6 @@ public class TextureManager {
505497 //Get a pointer to the image memory
506498 ByteBuffer scratch =
507499 ByteBuffer.allocateDirect(4 * tex.getWidth() * tex.getHeight());
508- int dataAddress = Sys.getDirectBufferAddress(scratch);
509-
510500 byte data[] =
511501 (byte[]) tex.getRaster().getDataElements(
512502 0,
@@ -516,47 +506,53 @@ public class TextureManager {
516506 null);
517507 scratch.clear();
518508 scratch.put(data);
509+ scratch.rewind();
519510
520- //Create A IntBuffer For Image Address In Memory
511+ // Create A IntBuffer For Image Address In Memory
521512 IntBuffer buf =
522513 ByteBuffer
523514 .allocateDirect(4)
524515 .order(ByteOrder.nativeOrder())
525516 .asIntBuffer();
526- int bufPtr = Sys.getDirectBufferAddress(buf);
527517
528518 //Create the texture
529- gl.genTextures(1, bufPtr);
519+ GL.glGenTextures(buf);
530520
531- gl.bindTexture(GL.TEXTURE_2D, buf.get(0));
521+ GL.glBindTexture(GL.GL_TEXTURE_2D, buf.get(0));
532522
533523 // Linear Filtering
534- gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER, minFilter);
524+ GL.glTexParameteri(
525+ GL.GL_TEXTURE_2D,
526+ GL.GL_TEXTURE_MIN_FILTER,
527+ minFilter);
535528 // Linear Filtering
536- gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MAG_FILTER, magFilter);
529+ GL.glTexParameteri(
530+ GL.GL_TEXTURE_2D,
531+ GL.GL_TEXTURE_MAG_FILTER,
532+ magFilter);
537533
538534 if (isMipmapped) {
539535 //generate the mipmaps
540- glu.build2DMipmaps(
541- GL.TEXTURE_2D,
536+ GLU.gluBuild2DMipmaps(
537+ GL.GL_TEXTURE_2D,
542538 3,
543539 tex.getWidth(),
544540 tex.getHeight(),
545- GL.RGB,
546- GL.UNSIGNED_BYTE,
547- dataAddress);
541+ GL.GL_RGB,
542+ GL.GL_UNSIGNED_BYTE,
543+ scratch);
548544 } else {
549545 // Generate The Texture
550- gl.texImage2D(
551- GL.TEXTURE_2D,
546+ GL.glTexImage2D(
547+ GL.GL_TEXTURE_2D,
552548 0,
553- GL.RGB,
549+ GL.GL_RGB,
554550 tex.getWidth(),
555551 tex.getHeight(),
556552 0,
557- GL.RGB,
558- GL.UNSIGNED_BYTE,
559- dataAddress);
553+ GL.GL_RGB,
554+ GL.GL_UNSIGNED_BYTE,
555+ scratch);
560556 }
561557
562558 LoggingSystem.getLoggingSystem().getLogger().log(
@@ -893,8 +889,7 @@ public class TextureManager {
893889
894890 private short constructShort(byte[] in, int offset) {
895891 short ret = (short) (in[offset + 1] & 0xff);
896- ret =
897- (short) ((ret << 8) | (short) (in[offset + 0] & 0xff));
892+ ret = (short) ((ret << 8) | (short) (in[offset + 0] & 0xff));
898893 return (ret);
899894 }
900895
--- a/src/jme/world/World.java
+++ b/src/jme/world/World.java
@@ -43,7 +43,6 @@ import jme.locale.Locale;
4343 import jme.locale.external.feature.Water;
4444 import jme.entity.camera.Camera;
4545 import jme.entity.effects.ParticleSystem;
46-import jme.system.DisplaySystem;
4746 import jme.utility.LoggingSystem;
4847
4948 /**
@@ -78,7 +77,7 @@ public class World {
7877 */
7978 public World() {
8079 entityList = new ArrayList();
81- gl = DisplaySystem.getDisplaySystem().getGL();
80+ //gl = DisplaySystem.getDisplaySystem().getGL();
8281 LoggingSystem.getLoggingSystem().getLogger().log(Level.INFO,
8382 "Created World");
8483 }
@@ -230,9 +229,9 @@ public class World {
230229
231230 if(null != locale) {
232231 if(o instanceof ParticleSystem && locale.useDistanceFog()) {
233- gl.disable(GL.FOG);
232+ GL.glDisable(GL.GL_FOG);
234233 } else if(locale.useDistanceFog()) {
235- gl.enable(GL.FOG);
234+ GL.glEnable(GL.GL_FOG);
236235 }
237236 }
238237
@@ -241,9 +240,9 @@ public class World {
241240
242241 if(null != locale) {
243242 if(o instanceof ParticleSystem && locale.useDistanceFog()) {
244- gl.enable(GL.FOG);
243+ GL.glEnable(GL.GL_FOG);
245244 } else if(locale.useDistanceFog()) {
246- gl.disable(GL.FOG);
245+ GL.glDisable(GL.GL_FOG);
247246 }
248247 }
249248 }
--- a/src/test/application/TestApplication.java
+++ b/src/test/application/TestApplication.java
@@ -31,9 +31,11 @@
3131 */
3232
3333 package test.application;
34-
34+
3535 import org.lwjgl.Display;
3636 import org.lwjgl.opengl.GL;
37+import org.lwjgl.opengl.GLU;
38+import org.lwjgl.opengl.Window;
3739
3840 import jme.AbstractGame;
3941 import jme.system.DisplaySystem;
@@ -44,7 +46,7 @@ import jme.system.DisplaySystem;
4446 * You will can use this basic construct to build more complex jME applications
4547 *
4648 * @author Samuel Wasson
47- * @version $Id: TestApplication.java,v 1.2 2003-08-08 02:16:56 mojomonkey Exp $
49+ * @version $Id: TestApplication.java,v 1.3 2003-09-03 16:20:51 mojomonkey Exp $
4850 */
4951
5052 //Edit: Mark Powell - altered comments slightly. 8/7/03
@@ -60,8 +62,8 @@ public class TestApplication extends AbstractGame {
6062 * Render is called once per frame to display the data.
6163 */
6264 protected void render() {
63- gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT);
64- gl.loadIdentity();
65+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
66+ GL.glLoadIdentity();
6567 }
6668
6769 /**
@@ -71,7 +73,7 @@ public class TestApplication extends AbstractGame {
7173
7274 DisplaySystem.createDisplaySystem(
7375 "TestApplication",
74- "jme/data/Images/Monkey.jpg",
76+ "data/Images/Monkey.jpg",
7577 true
7678 );
7779 }
@@ -80,27 +82,23 @@ public class TestApplication extends AbstractGame {
8082
8183 // Here we create the OpenGL bindings.
8284
83- gl = DisplaySystem.getDisplaySystem().getGL();
84- glu = DisplaySystem.getDisplaySystem().getGLU();
85-
86-
8785 //Define the clear color to be black
8886
89- gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
87+ GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
9088
91- gl.matrixMode(GL.PROJECTION);
92- gl.loadIdentity();
89+ GL.glMatrixMode(GL.GL_PROJECTION);
90+ GL.glLoadIdentity();
9391
9492
9593 // Calculate the aspect ratio
96- glu.perspective(
94+ GLU.gluPerspective(
9795 45.0f,
9896 (float)Display.getWidth() / (float)Display.getHeight(),
9997 0.01f,
10098 750.0f);
10199
102- gl.matrixMode(GL.MODELVIEW);
103- gl.hint(GL.PERSPECTIVE_CORRECTION_HINT, GL.NICEST);
100+ GL.glMatrixMode(GL.GL_MODELVIEW);
101+ GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
104102 }
105103
106104 /**
@@ -126,7 +124,7 @@ public class TestApplication extends AbstractGame {
126124 * Clean up the OpenGL resources
127125 */
128126 protected void cleanup() {
129- gl.destroy();
127+ Window.destroy();
130128 }
131129
132130 /**
--- a/src/test/general/TestController.java
+++ b/src/test/general/TestController.java
@@ -66,7 +66,7 @@ public class TestController extends TrackingController {
6666 if (isKeyDown("exit")) {
6767 return false;
6868 }
69-
69+
7070 if (isKeyDown("640x480")) {
7171 if (smode != 0) {
7272 smode = 0;
@@ -89,15 +89,15 @@ public class TestController extends TrackingController {
8989 }
9090
9191 if (isKeyDown("linemode")) {
92- DisplaySystem.getDisplaySystem().getGL().polygonMode(
93- GL.FRONT_AND_BACK,
94- GL.LINE);
92+ GL.glPolygonMode(
93+ GL.GL_FRONT_AND_BACK,
94+ GL.GL_LINE);
9595 }
9696
9797 if (isKeyDown("fillmode")) {
98- DisplaySystem.getDisplaySystem().getGL().polygonMode(
99- GL.FRONT_AND_BACK,
100- GL.FILL);
98+ GL.glPolygonMode(
99+ GL.GL_FRONT_AND_BACK,
100+ GL.GL_FILL);
101101 }
102102
103103 if (isKeyDown("screenshot")) {
--- a/src/test/general/TestMain.java
+++ b/src/test/general/TestMain.java
@@ -39,6 +39,10 @@ import org.lwjgl.Display;
3939 import org.lwjgl.input.Keyboard;
4040 import org.lwjgl.input.Mouse;
4141 import org.lwjgl.opengl.GL;
42+import org.lwjgl.opengl.GLCaps;
43+import org.lwjgl.opengl.GLU;
44+import org.lwjgl.opengl.Window;
45+
4246 import jme.AbstractGame;
4347 import jme.entity.Entity;
4448 import jme.geometry.model.md3.Md3Model;
@@ -83,10 +87,11 @@ public class TestMain extends AbstractGame {
8387 SplashScreen ss;
8488
8589 static {
86- if (GL.WGL_EXT_swap_control) {
90+ if (GLCaps.WGL_EXT_swap_control) {
8791 GL.wglSwapIntervalEXT(1);
8892 }
8993 }
94+
9095
9196 int tex1, tex2, tex3;
9297
@@ -181,8 +186,8 @@ public class TestMain extends AbstractGame {
181186
182187 }
183188 protected void render() {
184- gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT);
185- gl.loadIdentity();
189+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
190+ GL.glLoadIdentity();
186191 cc.render();
187192 world.render();
188193 font.print(
@@ -230,25 +235,23 @@ public class TestMain extends AbstractGame {
230235 }
231236
232237 private void initGL() {
233- gl = DisplaySystem.getDisplaySystem().getGL();
234- glu = DisplaySystem.getDisplaySystem().getGLU();
235- gl.shadeModel(GL.SMOOTH);
236- gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
237- gl.clearDepth(1.0);
238- gl.enable(GL.DEPTH_TEST);
239- gl.depthFunc(GL.LESS);
240- gl.matrixMode(GL.PROJECTION);
241- gl.loadIdentity();
238+ GL.glShadeModel(GL.GL_SMOOTH);
239+ GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
240+ GL.glClearDepth(1.0);
241+ GL.glEnable(GL.GL_DEPTH_TEST);
242+ GL.glDepthFunc(GL.GL_LESS);
243+ GL.glMatrixMode(GL.GL_PROJECTION);
244+ GL.glLoadIdentity();
242245 // Calculate The Aspect Ratio Of The Window
243- glu.perspective(
246+ GLU.gluPerspective(
244247 45.0f,
245248 (float) Display.getWidth() / (float) Display.getHeight(),
246249 0.1f,
247- 750.0f);
248- gl.matrixMode(GL.MODELVIEW);
249- gl.hint(GL.PERSPECTIVE_CORRECTION_HINT, GL.NICEST);
250- gl.blendFunc(GL.SRC_ALPHA, GL.ONE);
251- DisplaySystem.getDisplaySystem().cullMode(GL.BACK, true);
250+ 500.0f);
251+ GL.glMatrixMode(GL.GL_MODELVIEW);
252+ GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
253+ GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
254+ DisplaySystem.getDisplaySystem().cullMode(GL.GL_BACK, true);
252255
253256 }
254257 protected void reinit() {
@@ -267,7 +270,7 @@ public class TestMain extends AbstractGame {
267270 }
268271
269272 float[] color = { 0.5f, 0.5f, 0.5f, 1.0f };
270- l.setFogAttributes(GL.LINEAR, color, 0.35f, 100.0f, 750.0f);
273+ l.setFogAttributes(GL.GL_LINEAR, color, 0.35f, 50.0f, 500.0f);
271274 l.setDistanceFog(true);
272275 }
273276 protected void initSystem() {
@@ -376,7 +379,7 @@ public class TestMain extends AbstractGame {
376379 world.setWater(wp);
377380 world.setLocale(l);
378381 float[] color = { 0.5f, 0.5f, 0.5f, 1.0f };
379- l.setFogAttributes(GL.LINEAR, color, 0.35f, 50.0f, 750.0f);
382+ l.setFogAttributes(GL.GL_LINEAR, color, 0.35f, 50.0f, 750.0f);
380383 l.setDistanceFog(true);
381384 l.setVolumetricFog(false);
382385 l.setVolumetricFogDepth(100);
@@ -426,7 +429,7 @@ public class TestMain extends AbstractGame {
426429 protected void cleanup() {
427430 Keyboard.destroy();
428431 Mouse.destroy();
429- gl.destroy();
432+ Window.destroy();
430433 TextureManager.reset();
431434 }
432435 public static void main(String[] args) {
--- a/src/test/general/TestParticleSystem.java
+++ b/src/test/general/TestParticleSystem.java
@@ -34,6 +34,8 @@ package test.general;
3434
3535 import org.lwjgl.Display;
3636 import org.lwjgl.opengl.GL;
37+import org.lwjgl.opengl.GLU;
38+import org.lwjgl.opengl.Window;
3739 import org.lwjgl.vector.Vector3f;
3840
3941 import jme.AbstractGame;
@@ -57,30 +59,28 @@ public class TestParticleSystem extends AbstractGame {
5759 }
5860
5961 protected void render() {
60- gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT);
61- gl.loadIdentity();
62+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
63+ GL.glLoadIdentity();
6264 ps.render();
6365 }
6466
6567 protected void initSystem() {
6668 //create the window
67- DisplaySystem.createDisplaySystem("Particles", "jme/data/Images/Monkey.jpg", true);
68- //create the OpenGL bindings
69- gl = DisplaySystem.getDisplaySystem().getGL();
70- glu = DisplaySystem.getDisplaySystem().getGLU();
69+ DisplaySystem.createDisplaySystem("Particles", "data/Images/Monkey.jpg", true);
70+
7171 //Define what the clear color will be (black)
72- gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
73- gl.matrixMode(GL.PROJECTION);
74- gl.loadIdentity();
72+ GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
73+ GL.glMatrixMode(GL.GL_PROJECTION);
74+ GL.glLoadIdentity();
7575 // Calculate The Aspect Ratio Of The Window
76- glu.perspective(
76+ GLU.gluPerspective(
7777 45.0f,
7878 (float) Display.getWidth() / (float) Display.getHeight(),
7979 0.01f,
8080 750.0f);
81- gl.matrixMode(GL.MODELVIEW);
82- gl.hint(GL.PERSPECTIVE_CORRECTION_HINT, GL.NICEST);
83- gl.disable(GL.DEPTH_TEST);
81+ GL.glMatrixMode(GL.GL_MODELVIEW);
82+ GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
83+ GL.glDisable(GL.GL_DEPTH_TEST);
8484 }
8585
8686 protected void initGame() {
@@ -95,7 +95,7 @@ public class TestParticleSystem extends AbstractGame {
9595 pe.setSpeed(1);
9696 pe.setGravity(new Vector3f(0.0f,-100.0f,10.0f));
9797 pe.setFriction(1);
98- pe.setTexture("jme/data/texture/star.png");
98+ pe.setTexture("data/texture/star.png");
9999 pe.loopAnimation(true);
100100
101101 ps = new ParticleSystem();
@@ -106,10 +106,11 @@ public class TestParticleSystem extends AbstractGame {
106106 protected void reinit() {
107107 //nothing here... YET!
108108 }
109+
109110
110111 protected void cleanup() {
111112 //clean up the OpenGL resources
112- gl.destroy();
113+ Window.destroy();
113114 }
114115
115116 public static void main(String[] args) {
--- a/src/test/keycontroller/KeyController.java
+++ b/src/test/keycontroller/KeyController.java
@@ -48,6 +48,7 @@ public class KeyController extends BaseFPSController {
4848
4949 public void setKeys() {
5050 key.set("triangle", Keyboard.KEY_1);
51+ key.set("screenshot", Keyboard.KEY_P);
5152 }
5253
5354 protected boolean checkAdditionalKeys() {
@@ -60,6 +61,11 @@ public class KeyController extends BaseFPSController {
6061 app.setRenderObject(1);
6162 return true;
6263 }
64+
65+ if(isKeyDown("screenshot")) {
66+ app.takeScreenShot();
67+ return true;
68+ }
6369 return true;
6470 }
6571 }
\ No newline at end of file
--- a/src/test/keycontroller/TestKeyController.java
+++ b/src/test/keycontroller/TestKeyController.java
@@ -34,6 +34,8 @@ package test.keycontroller;
3434
3535 import org.lwjgl.Display;
3636 import org.lwjgl.opengl.GL;
37+import org.lwjgl.opengl.GLU;
38+import org.lwjgl.opengl.Window;
3739
3840 import jme.AbstractGame;
3941 import jme.system.DisplaySystem;
@@ -72,7 +74,7 @@ public class TestKeyController extends AbstractGame {
7274 */
7375 protected void update() {
7476 if(!controller.update(timer.getFrameRate())) {
75- finish();
77+ finish();
7678 }
7779 timer.update();
7880 }
@@ -83,26 +85,30 @@ public class TestKeyController extends AbstractGame {
8385 protected void setRenderObject(int value) {
8486 Flag = value;
8587 }
88+
89+ public void takeScreenShot() {
90+ DisplaySystem.getDisplaySystem().takeScreenShot("test");
91+ }
8692
8793 /**
8894 * Render is called once per frame to display the data.
8995 */
9096 protected void render() {
91- gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT);
92- gl.loadIdentity();
97+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
98+ GL.glLoadIdentity();
9399
94100 controller.render();
95101
96102 // Enable texture mapping
97- gl.enable(GL.TEXTURE_2D);
103+ GL.glEnable(GL.GL_TEXTURE_2D);
98104
99105 if(Flag == 1) {
100- gl.pushMatrix();
106+ GL.glPushMatrix();
101107 entity1.render();
102- gl.popMatrix();
108+ GL.glPopMatrix();
103109 }
104110
105- gl.end();
111+ GL.glEnd();
106112
107113 /*
108114 * Print out the frame rate.
@@ -124,7 +130,7 @@ public class TestKeyController extends AbstractGame {
124130 */
125131 protected void initDisplay() {
126132 DisplaySystem.createDisplaySystem(
127- "TestApplication",
133+ "TestKeyController",
128134 "data/Images/Monkey.jpg",
129135 true
130136 );
@@ -132,26 +138,21 @@ public class TestKeyController extends AbstractGame {
132138
133139 protected void initGL() {
134140
135- // Here we create the OpenGL bindings.
136- gl = DisplaySystem.getDisplaySystem().getGL();
137- glu = DisplaySystem.getDisplaySystem().getGLU();
138-
139-
140141 // Define the clear color to be black
141- gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
142+ GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
142143
143- gl.matrixMode(GL.PROJECTION);
144- gl.loadIdentity();
144+ GL.glMatrixMode(GL.GL_PROJECTION);
145+ GL.glLoadIdentity();
145146
146147 // Calculate the aspect ratio
147- glu.perspective(
148+ GLU.gluPerspective(
148149 45.0f,
149150 (float)Display.getWidth() / (float)Display.getHeight(),
150151 0.01f,
151152 750.0f);
152153
153- gl.matrixMode(GL.MODELVIEW);
154- gl.hint(GL.PERSPECTIVE_CORRECTION_HINT, GL.NICEST);
154+ GL.glMatrixMode(GL.GL_MODELVIEW);
155+ GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
155156 }
156157
157158 protected void initSystem() {
@@ -162,7 +163,7 @@ public class TestKeyController extends AbstractGame {
162163 protected void initGame() {
163164
164165 // Blend the font together so it doesn't chop the letters off
165- gl.blendFunc(GL.SRC_ALPHA, GL.ONE);
166+ GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
166167
167168 //Instantiate a font object
168169 font = new Font2D("data/Font/font.png");
@@ -207,7 +208,7 @@ public class TestKeyController extends AbstractGame {
207208 * Clean up the OpenGL resources
208209 */
209210 protected void cleanup() {
210- gl.destroy();
211+ Window.destroy();
211212 }
212213
213214 public static void main(String[] args) {
--- /dev/null
+++ b/src/test/model/TestMilkshape.java
@@ -0,0 +1,153 @@
1+/*
2+ * Copyright (c) 2003, jMonkeyEngine - Mojo Monkey Coding
3+ * All rights reserved.
4+ *
5+ * Redistribution and use in source and binary forms, with or without
6+ * modification, are permitted provided that the following conditions are met:
7+ *
8+ * Redistributions of source code must retain the above copyright notice, this
9+ * list of conditions and the following disclaimer.
10+ *
11+ * Redistributions in binary form must reproduce the above copyright notice,
12+ * this list of conditions and the following disclaimer in the documentation
13+ * and/or other materials provided with the distribution.
14+ *
15+ * Neither the name of the Mojo Monkey Coding, jME, jMonkey Engine, nor the
16+ * names of its contributors may be used to endorse or promote products derived
17+ * from this software without specific prior written permission.
18+ *
19+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+ * POSSIBILITY OF SUCH DAMAGE.
30+ *
31+ */
32+
33+package test.model;
34+
35+import org.lwjgl.Display;
36+import org.lwjgl.opengl.GL;
37+import org.lwjgl.opengl.GLU;
38+import org.lwjgl.opengl.Window;
39+
40+import jme.AbstractGame;
41+import jme.controller.BaseFPSController;
42+import jme.entity.camera.Camera;
43+import jme.geometry.model.ms.MilkshapeModel;
44+import jme.system.DisplaySystem;
45+import jme.utility.Timer;
46+
47+/**
48+ *
49+ * @author Mark Powell
50+ */
51+
52+public class TestMilkshape extends AbstractGame {
53+ //our model object
54+ private MilkshapeModel model;
55+
56+ BaseFPSController controller;
57+ Timer timer;
58+ Camera camera;
59+ /**
60+ * This is where we'll do any updating
61+ */
62+ protected void update() {
63+ timer.update();
64+ if(!controller.update(timer.getFrameRate())) {
65+ finish();
66+ }
67+ }
68+
69+ /**
70+ * Render is called once per frame to display the data.
71+ */
72+ protected void render() {
73+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
74+ GL.glLoadIdentity();
75+ controller.render();
76+ model.render();
77+ }
78+
79+ /**
80+ * This is where we create and initialize the window.
81+ */
82+ protected void initDisplay() {
83+
84+ DisplaySystem.createDisplaySystem(
85+ "TestMilkshape",
86+ "data/Images/Monkey.jpg",
87+ true
88+ );
89+ }
90+
91+ protected void initGL() {
92+
93+ // Here we create the OpenGL bindings.
94+
95+ //Define the clear color to be black
96+
97+ GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
98+
99+ GL.glMatrixMode(GL.GL_PROJECTION);
100+ GL.glLoadIdentity();
101+
102+
103+ // Calculate the aspect ratio
104+ GLU.gluPerspective(
105+ 45.0f,
106+ (float)Display.getWidth() / (float)Display.getHeight(),
107+ 0.01f,
108+ 750.0f);
109+
110+ GL.glMatrixMode(GL.GL_MODELVIEW);
111+ GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
112+ }
113+
114+ /**
115+ * Called first to initialize system attributes.
116+ */
117+ protected void initSystem() {
118+ initDisplay();
119+ initGL();
120+ }
121+ /**
122+ * Nothing here yet.
123+ */
124+ protected void initGame() {
125+ model = new MilkshapeModel("./data/model/arab/ak47.ms3d");
126+ camera = new Camera(1,0,0,100,0,10,0,0,1,0);
127+ controller = new BaseFPSController(camera);
128+ timer = Timer.getTimer();
129+ }
130+
131+ /**
132+ * Nothing here yet.
133+ */
134+ protected void reinit() {
135+ }
136+
137+ /**
138+ * Clean up the OpenGL resources
139+ */
140+ protected void cleanup() {
141+ Window.destroy();
142+ }
143+
144+ /**
145+ * <code>main</code> entry point for application.
146+ * @param args comman line arguments, none used.
147+ */
148+ public static void main(String[] args) {
149+ TestMilkshape testApp = new TestMilkshape();
150+ testApp.start();
151+ }
152+}
153+
\ No newline at end of file
--- a/src/test/polygon/TestPolygon.java
+++ b/src/test/polygon/TestPolygon.java
@@ -29,13 +29,15 @@
2929 * POSSIBILITY OF SUCH DAMAGE.
3030 *
3131 */
32-
32+
3333 package test.polygon;
34-
35-import org.lwjgl.Display;
36-import org.lwjgl.opengl.GL;
3734
38-import jme.AbstractGame;
35+import org.lwjgl.Display;
36+import org.lwjgl.opengl.GL;
37+import org.lwjgl.opengl.GLU;
38+import org.lwjgl.opengl.Window;
39+
40+import jme.AbstractGame;
3941 import jme.system.DisplaySystem;
4042 import jme.utility.Timer;
4143 import jme.math.Vector;
@@ -48,134 +50,133 @@ import jme.geometry.primitive.Triangle;
4850 * You will can use this basic construct to build more complex jME applications
4951 *
5052 * @author Samuel Wasson
51- * @version 0.1.0
53+ * @version $Id: TestPolygon.java,v 1.4 2003-09-03 16:20:51 mojomonkey Exp $
5254 */
5355
5456 public class TestPolygon extends AbstractGame {
55-
56- private Timer timer;
57- private Font2D font;
58- private Triangle triangle;
59- private Vector[] points;
60-
61- /**
62- * This is where we'll do any updating.
63- */
64- protected void update() {
65- // Update each frame to calculate the framerate
66- timer.getFrameRate();
67- timer.update();
68- }
69-
70- /**
71- * Render is called once per frame to display the data.
72- */
73- protected void render() {
74- gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT);
75- gl.loadIdentity();
76-
77-
78- // Enable texture mapping
79- gl.enable(GL.TEXTURE_2D);
80-
81- triangle.render();
82-
83- /*
84- * Print out the frame rate.
85- * The print method takes 4 parameters
86- * (int, int, string, int). The first two
87- * ints are the coordinates to start the text.
88- * These are screen coordinates in pixels where
89- * (0, 0) is the lower left hand of the screen.
90- * The String is whatever you want to display.
91- * The last parameter is the font type where 0
92- * is normal and 1 is italics
93- */
94- font.print(1,1,"Frame Rate - " + timer.getFrameRate(), 0);
95-
96- }
97-
98- /**
99- * This is where we create and initialize the window.
100- */
101- protected void initDisplay() {
102- DisplaySystem.createDisplaySystem(
103- "TestApplication",
104- "jme/data/Images/Monkey.jpg",
105- true
106- );
107- }
108-
109- protected void initGL() {
110-
111- // Here we create the OpenGL bindings.
112- gl = DisplaySystem.getDisplaySystem().getGL();
113- glu = DisplaySystem.getDisplaySystem().getGLU();
114-
115-
116- // Define the clear color to be black
117- gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
118-
119- gl.matrixMode(GL.PROJECTION);
120- gl.loadIdentity();
121-
122- // Calculate the aspect ratio
123- glu.perspective(
124- 45.0f,
125- (float)Display.getWidth() / (float)Display.getHeight(),
126- 0.01f,
127- 750.0f);
128-
129- gl.matrixMode(GL.MODELVIEW);
130- gl.hint(GL.PERSPECTIVE_CORRECTION_HINT, GL.NICEST);
131- }
132-
133- protected void initSystem() {
134- initDisplay();
135- initGL();
136- }
137-
138- protected void initGame() {
139-
140- // Blend the font together so it doesn't chop the letters off
141- gl.blendFunc(GL.SRC_ALPHA, GL.ONE);
142-
143- //Instantiate a font object
144- font = new Font2D("jme/data/Font/font.png");
145-
146- // Instantiate a new timer object
147- timer = Timer.getTimer();
148-
149- // Initiate a new Vector class
150- points = new Vector[3];
151-
152- // Initialize the Vector array
153- for (int i = 0; i < 3; i++) {
154- points[i] = new Vector();
155- }
156-
157- // Add points to the Vector array
158- points[0].x = 0.0f; points[0].y = 1.0f; points[0].z = -5.0f;
159- points[1].x = -1.0f; points[1].y = -1.0f; points[1].z = -5.0f;
160- points[2].x = 1.0f; points[2].y = -1.0f; points[2].z = -5.0f;
161-
162- // Instantiate a new Triangle object
163- triangle = new Triangle(points);
164- }
165-
166- protected void reinit() {
167- // Nothing here yet.
168- }
169-
170- /**
171- * Clean up the OpenGL resources
172- */
173- protected void cleanup() {
174- gl.destroy();
175- }
176-
177- public static void main(String[] args) {
178- TestPolygon testPoly = new TestPolygon();
179- testPoly.start();
180- }
57+
58+ private Timer timer;
59+ private Font2D font;
60+ private Triangle triangle;
61+ private Vector[] points;
62+
63+ /**
64+ * This is where we'll do any updating.
65+ */
66+ protected void update() {
67+ // Update each frame to calculate the framerate
68+ timer.getFrameRate();
69+ timer.update();
70+ }
71+
72+ /**
73+ * Render is called once per frame to display the data.
74+ */
75+ protected void render() {
76+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
77+ GL.glLoadIdentity();
78+
79+ // Enable texture mapping
80+ GL.glEnable(GL.GL_TEXTURE_2D);
81+
82+ triangle.render();
83+
84+ /*
85+ * Print out the frame rate.
86+ * The print method takes 4 parameters
87+ * (int, int, string, int). The first two
88+ * ints are the coordinates to start the text.
89+ * These are screen coordinates in pixels where
90+ * (0, 0) is the lower left hand of the screen.
91+ * The String is whatever you want to display.
92+ * The last parameter is the font type where 0
93+ * is normal and 1 is italics
94+ */
95+ font.print(1, 1, "Frame Rate - " + timer.getFrameRate(), 0);
96+
97+ }
98+
99+ /**
100+ * This is where we create and initialize the window.
101+ */
102+ protected void initDisplay() {
103+ DisplaySystem.createDisplaySystem(
104+ "TestPolygon",
105+ "data/Images/Monkey.jpg",
106+ true);
107+ }
108+
109+ protected void initGL() {
110+
111+ // Define the clear color to be black
112+ GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
113+
114+ GL.glMatrixMode(GL.GL_PROJECTION);
115+ GL.glLoadIdentity();
116+
117+ // Calculate the aspect ratio
118+ GLU.gluPerspective(
119+ 45.0f,
120+ (float) Display.getWidth() / (float) Display.getHeight(),
121+ 0.01f,
122+ 750.0f);
123+
124+ GL.glMatrixMode(GL.GL_MODELVIEW);
125+ GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
126+ }
127+
128+ protected void initSystem() {
129+ initDisplay();
130+ initGL();
131+ }
132+
133+ protected void initGame() {
134+
135+ // Blend the font together so it doesn't chop the letters off
136+ GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
137+
138+ //Instantiate a font object
139+ font = new Font2D("data/Font/font.png");
140+
141+ // Instantiate a new timer object
142+ timer = Timer.getTimer();
143+
144+ // Initiate a new Vector class
145+ points = new Vector[3];
146+
147+ // Initialize the Vector array
148+ for (int i = 0; i < 3; i++) {
149+ points[i] = new Vector();
150+ }
151+
152+ // Add points to the Vector array
153+ points[0].x = 0.0f;
154+ points[0].y = 1.0f;
155+ points[0].z = -5.0f;
156+ points[1].x = -1.0f;
157+ points[1].y = -1.0f;
158+ points[1].z = -5.0f;
159+ points[2].x = 1.0f;
160+ points[2].y = -1.0f;
161+ points[2].z = -5.0f;
162+
163+ // Instantiate a new Triangle object
164+ triangle = new Triangle(points);
165+ }
166+
167+ protected void reinit() {
168+ // Nothing here yet.
169+ }
170+
171+ /**
172+ * Clean up the OpenGL resources
173+ */
174+ protected void cleanup() {
175+ Window.destroy();
176+ }
177+
178+ public static void main(String[] args) {
179+ TestPolygon testPoly = new TestPolygon();
180+ testPoly.start();
181+ }
181182 }
\ No newline at end of file