aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jake2/render/fastjogl/Base.java54
-rw-r--r--src/jake2/render/fastjogl/Draw.java73
-rw-r--r--src/jake2/render/fastjogl/Image.java156
-rw-r--r--src/jake2/render/fastjogl/Light.java24
-rw-r--r--src/jake2/render/fastjogl/Main.java183
-rw-r--r--src/jake2/render/fastjogl/Mesh.java77
-rw-r--r--src/jake2/render/fastjogl/Misc.java80
-rw-r--r--src/jake2/render/fastjogl/Model.java13
-rw-r--r--src/jake2/render/fastjogl/Surf.java131
-rw-r--r--src/jake2/render/fastjogl/Warp.java7
10 files changed, 414 insertions, 384 deletions
diff --git a/src/jake2/render/fastjogl/Base.java b/src/jake2/render/fastjogl/Base.java
index 1e487a5..9d56c7c 100644
--- a/src/jake2/render/fastjogl/Base.java
+++ b/src/jake2/render/fastjogl/Base.java
@@ -2,7 +2,7 @@
* Base.java
* Copyright (C) 2003
*
- * $Id: Base.java,v 1.3 2005-06-08 20:43:07 cawe Exp $
+ * $Id: Base.java,v 1.3.4.1 2005-10-24 22:41:12 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -25,17 +25,20 @@
*/
package jake2.render.fastjogl;
-import jake2.render.JoglBase;
-import net.java.games.jogl.GL;
+import jake2.client.viddef_t;
+import jake2.game.cvar_t;
+import jake2.render.*;
+
+import java.awt.Dimension;
/**
* Base
*
* @author cwei
*/
-public abstract class Base extends JoglBase {
+public abstract class Base implements QGLConst {
- static final int GL_COLOR_INDEX8_EXT = GL.GL_COLOR_INDEX;
+ static final int GL_COLOR_INDEX8_EXT = GL_COLOR_INDEX;
static final String REF_VERSION = "GL 0.01";
@@ -152,4 +155,45 @@ public abstract class Base extends JoglBase {
static final int GL_RENDERER_MCD = 0x01000000;
static final int GL_RENDERER_OTHER = 0x80000000;
+
+ /*
+ * base members
+ */
+
+ protected viddef_t vid = new viddef_t();
+
+ protected cvar_t vid_fullscreen;
+
+// protected QGL gl = JoglGL.getInstance(); //DummyGL.getInstance();
+ protected QGL gl = LwjglGL.getInstance(); //DummyGL.getInstance();
+
+ // enum rserr_t
+ protected static final int rserr_ok = 0;
+
+ protected static final int rserr_invalid_fullscreen = 1;
+
+ protected static final int rserr_invalid_mode = 2;
+
+ protected static final int rserr_unknown = 3;
+
+ protected abstract int GLimp_SetMode(Dimension dim, int mode,
+ boolean fullscreen);
+
+ protected abstract void GLimp_Shutdown();
+
+ protected void GLimp_BeginFrame(float camera_separation) {
+ // do nothing
+ }
+
+ protected void GLimp_AppActivate(boolean activate) {
+ // do nothing
+ }
+
+ protected void GLimp_EnableLogging(boolean enable) {
+ // do nothing
+ }
+
+ protected void GLimp_LogNewFrame() {
+ // do nothing
+ }
} \ No newline at end of file
diff --git a/src/jake2/render/fastjogl/Draw.java b/src/jake2/render/fastjogl/Draw.java
index d3c62b6..30574d8 100644
--- a/src/jake2/render/fastjogl/Draw.java
+++ b/src/jake2/render/fastjogl/Draw.java
@@ -2,7 +2,7 @@
* Draw.java
* Copyright (C) 2003
*
- * $Id: Draw.java,v 1.4 2004-08-22 14:25:14 salomo Exp $
+ * $Id: Draw.java,v 1.4.12.1 2005-10-24 22:41:12 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -29,10 +29,11 @@ import jake2.Defines;
import jake2.client.VID;
import jake2.qcommon.Com;
import jake2.render.image_t;
+import jake2.util.Lib;
import java.awt.Dimension;
-
-import net.java.games.jogl.GL;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
/**
* Draw
@@ -51,8 +52,8 @@ public abstract class Draw extends Image {
// load console characters (don't bilerp characters)
draw_chars = GL_FindImage("pics/conchars.pcx", it_pic);
GL_Bind(draw_chars.texnum);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
/*
@@ -81,7 +82,7 @@ public abstract class Draw extends Image {
GL_Bind(draw_chars.texnum);
- gl.glBegin (GL.GL_QUADS);
+ gl.glBegin (GL_QUADS);
gl.glTexCoord2f (fcol, frow);
gl.glVertex2f (x, y);
gl.glTexCoord2f (fcol + size, frow);
@@ -146,10 +147,10 @@ public abstract class Draw extends Image {
Scrap_Upload();
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0) ) && !image.has_alpha)
- gl.glDisable(GL.GL_ALPHA_TEST);
+ gl.glDisable(GL_ALPHA_TEST);
GL_Bind(image.texnum);
- gl.glBegin (GL.GL_QUADS);
+ gl.glBegin (GL_QUADS);
gl.glTexCoord2f (image.sl, image.tl);
gl.glVertex2f (x, y);
gl.glTexCoord2f (image.sh, image.tl);
@@ -161,7 +162,7 @@ public abstract class Draw extends Image {
gl.glEnd ();
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) !=0 ) ) && !image.has_alpha)
- gl.glEnable(GL.GL_ALPHA_TEST);
+ gl.glEnable(GL_ALPHA_TEST);
}
@@ -184,11 +185,11 @@ public abstract class Draw extends Image {
Scrap_Upload();
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha)
- gl.glDisable (GL.GL_ALPHA_TEST);
+ gl.glDisable (GL_ALPHA_TEST);
GL_Bind(image.texnum);
- gl.glBegin (GL.GL_QUADS);
+ gl.glBegin (GL_QUADS);
gl.glTexCoord2f (image.sl, image.tl);
gl.glVertex2f (x, y);
gl.glTexCoord2f (image.sh, image.tl);
@@ -200,7 +201,7 @@ public abstract class Draw extends Image {
gl.glEnd ();
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha)
- gl.glEnable (GL.GL_ALPHA_TEST);
+ gl.glEnable (GL_ALPHA_TEST);
}
/*
@@ -222,10 +223,10 @@ public abstract class Draw extends Image {
}
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha)
- gl.glDisable(GL.GL_ALPHA_TEST);
+ gl.glDisable(GL_ALPHA_TEST);
GL_Bind(image.texnum);
- gl.glBegin (GL.GL_QUADS);
+ gl.glBegin (GL_QUADS);
gl.glTexCoord2f(x/64.0f, y/64.0f);
gl.glVertex2f (x, y);
gl.glTexCoord2f( (x+w)/64.0f, y/64.0f);
@@ -237,7 +238,7 @@ public abstract class Draw extends Image {
gl.glEnd ();
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha)
- gl.glEnable(GL.GL_ALPHA_TEST);
+ gl.glEnable(GL_ALPHA_TEST);
}
@@ -253,7 +254,7 @@ public abstract class Draw extends Image {
if ( colorIndex > 255)
Com.Error(Defines.ERR_FATAL, "Draw_Fill: bad color");
- gl.glDisable(GL.GL_TEXTURE_2D);
+ gl.glDisable(GL_TEXTURE_2D);
int color = d_8to24table[colorIndex];
@@ -263,7 +264,7 @@ public abstract class Draw extends Image {
(byte)((color >> 16) & 0xff) // b
);
- gl.glBegin (GL.GL_QUADS);
+ gl.glBegin (GL_QUADS);
gl.glVertex2f(x,y);
gl.glVertex2f(x+w, y);
@@ -272,7 +273,7 @@ public abstract class Draw extends Image {
gl.glEnd();
gl.glColor3f(1,1,1);
- gl.glEnable(GL.GL_TEXTURE_2D);
+ gl.glEnable(GL_TEXTURE_2D);
}
//=============================================================================
@@ -283,10 +284,10 @@ public abstract class Draw extends Image {
================
*/
protected void Draw_FadeScreen() {
- gl.glEnable(GL.GL_BLEND);
- gl.glDisable(GL.GL_TEXTURE_2D);
+ gl.glEnable(GL_BLEND);
+ gl.glDisable(GL_TEXTURE_2D);
gl.glColor4f(0, 0, 0, 0.8f);
- gl.glBegin(GL.GL_QUADS);
+ gl.glBegin(GL_QUADS);
gl.glVertex2f(0,0);
gl.glVertex2f(vid.width, 0);
@@ -295,12 +296,14 @@ public abstract class Draw extends Image {
gl.glEnd();
gl.glColor4f(1,1,1,1);
- gl.glEnable(GL.GL_TEXTURE_2D);
- gl.glDisable(GL.GL_BLEND);
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glDisable(GL_BLEND);
}
// ====================================================================
+ IntBuffer image32=Lib.newIntBuffer(256*256);
+ ByteBuffer image8=Lib.newByteBuffer(256*256);
/*
=============
@@ -332,7 +335,6 @@ public abstract class Draw extends Image {
if ( !qglColorTableEXT )
{
- int[] image32 = new int[256*256];
int destIndex = 0;
for (i=0 ; i<trows ; i++)
@@ -346,15 +348,14 @@ public abstract class Draw extends Image {
frac = fracstep >> 1;
for (j=0 ; j<256 ; j++)
{
- image32[destIndex + j] = r_rawpalette[data[sourceIndex + (frac>>16)] & 0xff];
+ image32.put(destIndex + j, r_rawpalette[data[sourceIndex + (frac>>16)] & 0xff]);
frac += fracstep;
}
}
- gl.glTexImage2D (GL.GL_TEXTURE_2D, 0, gl_tex_solid_format, 256, 256, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, image32);
+ gl.glTexImage2D (GL_TEXTURE_2D, 0, gl_tex_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, image32);
}
else
{
- byte[] image8 = new byte[256*256];
int destIndex = 0;;
for (i=0 ; i<trows ; i++)
@@ -368,27 +369,27 @@ public abstract class Draw extends Image {
frac = fracstep >> 1;
for (j=0 ; j<256 ; j++)
{
- image8[destIndex + j] = data[sourceIndex + (frac>>16)];
+ image8.put(destIndex + j, data[sourceIndex + (frac>>16)]);
frac += fracstep;
}
}
- gl.glTexImage2D( GL.GL_TEXTURE_2D,
+ gl.glTexImage2D( GL_TEXTURE_2D,
0,
GL_COLOR_INDEX8_EXT,
256, 256,
0,
- GL.GL_COLOR_INDEX,
- GL.GL_UNSIGNED_BYTE,
+ GL_COLOR_INDEX,
+ GL_UNSIGNED_BYTE,
image8 );
}
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) )
- gl.glDisable (GL.GL_ALPHA_TEST);
+ gl.glDisable (GL_ALPHA_TEST);
- gl.glBegin (GL.GL_QUADS);
+ gl.glBegin (GL_QUADS);
gl.glTexCoord2f (0, 0);
gl.glVertex2f (x, y);
gl.glTexCoord2f (1, 0);
@@ -400,7 +401,7 @@ public abstract class Draw extends Image {
gl.glEnd ();
if ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) )
- gl.glEnable (GL.GL_ALPHA_TEST);
+ gl.glEnable (GL_ALPHA_TEST);
}
}
diff --git a/src/jake2/render/fastjogl/Image.java b/src/jake2/render/fastjogl/Image.java
index 48c206a..4ed1343 100644
--- a/src/jake2/render/fastjogl/Image.java
+++ b/src/jake2/render/fastjogl/Image.java
@@ -2,7 +2,7 @@
* Image.java
* Copyright (C) 2003
*
- * $Id: Image.java,v 1.8 2004-11-10 20:35:36 cawe Exp $
+ * $Id: Image.java,v 1.8.8.1 2005-10-24 22:41:11 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -38,7 +38,6 @@ import java.awt.Dimension;
import java.nio.*;
import java.util.Arrays;
-import net.java.games.jogl.GL;
/**
* Image
@@ -69,9 +68,9 @@ public abstract class Image extends Main {
int gl_tex_alpha_format = 4;
- int gl_filter_min = GL.GL_LINEAR_MIPMAP_NEAREST;
+ int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
- int gl_filter_max = GL.GL_LINEAR;
+ int gl_filter_max = GL_LINEAR;
Image() {
// init the texture cache
@@ -85,33 +84,31 @@ public abstract class Image extends Main {
assert (palette != null && palette.length == 256) : "int palette[256] bug";
- int i;
- byte[] temptable = new byte[768];
-
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) {
- for (i = 0; i < 256; i++) {
- temptable[i * 3 + 0] = (byte) ((palette[i] >> 0) & 0xff);
- temptable[i * 3 + 1] = (byte) ((palette[i] >> 8) & 0xff);
- temptable[i * 3 + 2] = (byte) ((palette[i] >> 16) & 0xff);
+ ByteBuffer temptable = Lib.newByteBuffer(768);
+ for (int i = 0; i < 256; i++) {
+ temptable.put(i * 3 + 0, (byte) ((palette[i] >> 0) & 0xff));
+ temptable.put(i * 3 + 1, (byte) ((palette[i] >> 8) & 0xff));
+ temptable.put(i * 3 + 2, (byte) ((palette[i] >> 16) & 0xff));
}
- gl.glColorTableEXT(GL.GL_SHARED_TEXTURE_PALETTE_EXT, GL.GL_RGB,
- 256, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, temptable);
+ gl.glColorTable(GL_SHARED_TEXTURE_PALETTE_EXT, GL_RGB,
+ 256, GL_RGB, GL_UNSIGNED_BYTE, temptable);
}
}
void GL_EnableMultitexture(boolean enable) {
if (enable) {
GL_SelectTexture(GL_TEXTURE1);
- gl.glEnable(GL.GL_TEXTURE_2D);
- GL_TexEnv(GL.GL_REPLACE);
+ gl.glEnable(GL_TEXTURE_2D);
+ GL_TexEnv(GL_REPLACE);
} else {
GL_SelectTexture(GL_TEXTURE1);
- gl.glDisable(GL.GL_TEXTURE_2D);
- GL_TexEnv(GL.GL_REPLACE);
+ gl.glDisable(GL_TEXTURE_2D);
+ GL_TexEnv(GL_REPLACE);
}
GL_SelectTexture(GL_TEXTURE0);
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
}
void GL_SelectTexture(int texture) {
@@ -134,7 +131,7 @@ public abstract class Image extends Main {
void GL_TexEnv(int mode) {
if (mode != lastmodes[gl_state.currenttmu]) {
- gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, mode);
+ gl.glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode);
lastmodes[gl_state.currenttmu] = mode;
}
}
@@ -149,7 +146,7 @@ public abstract class Image extends Main {
return;
gl_state.currenttextures[gl_state.currenttmu] = texnum;
- gl.glBindTexture(GL.GL_TEXTURE_2D, texnum);
+ gl.glBindTexture(GL_TEXTURE_2D, texnum);
}
void GL_MBind(int target, int texnum) {
@@ -178,16 +175,16 @@ public abstract class Image extends Main {
}
static final glmode_t modes[] = {
- new glmode_t("GL_NEAREST", GL.GL_NEAREST, GL.GL_NEAREST),
- new glmode_t("GL_LINEAR", GL.GL_LINEAR, GL.GL_LINEAR),
+ new glmode_t("GL_NEAREST", GL_NEAREST, GL_NEAREST),
+ new glmode_t("GL_LINEAR", GL_LINEAR, GL_LINEAR),
new glmode_t("GL_NEAREST_MIPMAP_NEAREST",
- GL.GL_NEAREST_MIPMAP_NEAREST, GL.GL_NEAREST),
+ GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST),
new glmode_t("GL_LINEAR_MIPMAP_NEAREST",
- GL.GL_LINEAR_MIPMAP_NEAREST, GL.GL_LINEAR),
+ GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR),
new glmode_t("GL_NEAREST_MIPMAP_LINEAR",
- GL.GL_NEAREST_MIPMAP_LINEAR, GL.GL_NEAREST),
- new glmode_t("GL_LINEAR_MIPMAP_LINEAR", GL.GL_LINEAR_MIPMAP_LINEAR,
- GL.GL_LINEAR) };
+ GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST),
+ new glmode_t("GL_LINEAR_MIPMAP_LINEAR", GL_LINEAR_MIPMAP_LINEAR,
+ GL_LINEAR) };
static final int NUM_GL_MODES = modes.length;
@@ -204,21 +201,21 @@ public abstract class Image extends Main {
}
static final gltmode_t[] gl_alpha_modes = { new gltmode_t("default", 4),
- new gltmode_t("GL_RGBA", GL.GL_RGBA),
- new gltmode_t("GL_RGBA8", GL.GL_RGBA8),
- new gltmode_t("GL_RGB5_A1", GL.GL_RGB5_A1),
- new gltmode_t("GL_RGBA4", GL.GL_RGBA4),
- new gltmode_t("GL_RGBA2", GL.GL_RGBA2), };
+ new gltmode_t("GL_RGBA", GL_RGBA),
+ new gltmode_t("GL_RGBA8", GL_RGBA8),
+ new gltmode_t("GL_RGB5_A1", GL_RGB5_A1),
+ new gltmode_t("GL_RGBA4", GL_RGBA4),
+ new gltmode_t("GL_RGBA2", GL_RGBA2), };
static final int NUM_GL_ALPHA_MODES = gl_alpha_modes.length;
static final gltmode_t[] gl_solid_modes = { new gltmode_t("default", 3),
- new gltmode_t("GL_RGB", GL.GL_RGB),
- new gltmode_t("GL_RGB8", GL.GL_RGB8),
- new gltmode_t("GL_RGB5", GL.GL_RGB5),
- new gltmode_t("GL_RGB4", GL.GL_RGB4),
- new gltmode_t("GL_R3_G3_B2", GL.GL_R3_G3_B2),
- new gltmode_t("GL_RGB2", GL.GL_RGB2_EXT) };
+ new gltmode_t("GL_RGB", GL_RGB),
+ new gltmode_t("GL_RGB8", GL_RGB8),
+ new gltmode_t("GL_RGB5", GL_RGB5),
+ new gltmode_t("GL_RGB4", GL_RGB4),
+ new gltmode_t("GL_R3_G3_B2", GL_R3_G3_B2) };
+ /* new gltmode_t("GL_RGB2", GL_RGB2_EXT) */
static final int NUM_GL_SOLID_MODES = gl_solid_modes.length;
@@ -250,9 +247,9 @@ public abstract class Image extends Main {
if (glt.type != it_pic && glt.type != it_sky) {
GL_Bind(glt.texnum);
- gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER,
+ gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
gl_filter_min);
- gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER,
+ gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
}
}
@@ -979,7 +976,7 @@ public abstract class Image extends Main {
*
* Returns has_alpha
*/
- void GL_BuildPalettedTexture(byte[] paletted_texture, int[] scaled,
+ void GL_BuildPalettedTexture(ByteBuffer paletted_texture, int[] scaled,
int scaled_width, int scaled_height) {
int r, g, b, c;
@@ -993,7 +990,7 @@ public abstract class Image extends Main {
c = r | (g << 5) | (b << 11);
- paletted_texture[i] = gl_state.d_16to8table[c];
+ paletted_texture.put(i, gl_state.d_16to8table[c]);
}
}
@@ -1003,7 +1000,7 @@ public abstract class Image extends Main {
int[] scaled = new int[256 * 256];
- byte[] paletted_texture = new byte[256 * 256];
+ ByteBuffer paletted_texture = Lib.newByteBuffer(256*256);
IntBuffer tex = Lib.newIntBuffer(512 * 256, ByteOrder.LITTLE_ENDIAN);
@@ -1019,7 +1016,8 @@ public abstract class Image extends Main {
int comp;
Arrays.fill(scaled, 0);
- Arrays.fill(paletted_texture, (byte) 0);
+ paletted_texture.clear();
+ for (int j=0; j<256*256; j++) paletted_texture.put(j,(byte)0);
uploaded_paletted = false;
@@ -1086,16 +1084,16 @@ public abstract class Image extends Main {
uploaded_paletted = true;
GL_BuildPalettedTexture(paletted_texture, data,
scaled_width, scaled_height);
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0,
+ gl.glTexImage2D(GL_TEXTURE_2D, 0,
GL_COLOR_INDEX8_EXT, scaled_width,
- scaled_height, 0, GL.GL_COLOR_INDEX,
- GL.GL_UNSIGNED_BYTE, paletted_texture);
+ scaled_height, 0, GL_COLOR_INDEX,
+ GL_UNSIGNED_BYTE, paletted_texture);
} else {
- tex.rewind();
- tex.put(data, 0, scaled_width * scaled_height);
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, comp,
- scaled_width, scaled_height, 0, GL.GL_RGBA,
- GL.GL_UNSIGNED_BYTE, tex);
+ tex.clear();
+ tex.put(data, 0, scaled_width * scaled_height).flip();
+ gl.glTexImage2D(GL_TEXTURE_2D, 0, comp,
+ scaled_width, scaled_height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, tex);
}
//goto done;
throw new longjmpException();
@@ -1113,14 +1111,14 @@ public abstract class Image extends Main {
uploaded_paletted = true;
GL_BuildPalettedTexture(paletted_texture, scaled, scaled_width,
scaled_height);
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT,
- scaled_width, scaled_height, 0, GL.GL_COLOR_INDEX,
- GL.GL_UNSIGNED_BYTE, paletted_texture);
+ gl.glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT,
+ scaled_width, scaled_height, 0, GL_COLOR_INDEX,
+ GL_UNSIGNED_BYTE, paletted_texture);
} else {
- tex.rewind();
- tex.put(scaled, 0, scaled_width * scaled_height);
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, comp, scaled_width,
- scaled_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, tex);
+ tex.clear();
+ tex.put(scaled, 0, scaled_width * scaled_height).flip();
+ gl.glTexImage2D(GL_TEXTURE_2D, 0, comp, scaled_width,
+ scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex);
}
if (mipmap) {
@@ -1142,16 +1140,16 @@ public abstract class Image extends Main {
uploaded_paletted = true;
GL_BuildPalettedTexture(paletted_texture, scaled,
scaled_width, scaled_height);
- gl.glTexImage2D(GL.GL_TEXTURE_2D, miplevel,
+ gl.glTexImage2D(GL_TEXTURE_2D, miplevel,
GL_COLOR_INDEX8_EXT, scaled_width,
- scaled_height, 0, GL.GL_COLOR_INDEX,
- GL.GL_UNSIGNED_BYTE, paletted_texture);
+ scaled_height, 0, GL_COLOR_INDEX,
+ GL_UNSIGNED_BYTE, paletted_texture);
} else {
- tex.rewind();
- tex.put(scaled, 0, scaled_width * scaled_height);
- gl.glTexImage2D(GL.GL_TEXTURE_2D, miplevel, comp,
- scaled_width, scaled_height, 0, GL.GL_RGBA,
- GL.GL_UNSIGNED_BYTE, tex);
+ tex.clear();
+ tex.put(scaled, 0, scaled_width * scaled_height).flip();
+ gl.glTexImage2D(GL_TEXTURE_2D, miplevel, comp,
+ scaled_width, scaled_height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, tex);
}
}
}
@@ -1161,14 +1159,14 @@ public abstract class Image extends Main {
}
if (mipmap) {
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER,
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
gl_filter_min);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER,
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
} else {
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER,
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
gl_filter_max);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER,
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
}
@@ -1193,12 +1191,12 @@ public abstract class Image extends Main {
Com.Error(Defines.ERR_DROP, "GL_Upload8: too large");
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && is_sky) {
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width,
- height, 0, GL.GL_COLOR_INDEX, GL.GL_UNSIGNED_BYTE, data);
+ gl.glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width,
+ height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, ByteBuffer.wrap(data));
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER,
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
gl_filter_max);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER,
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
return false;
@@ -1458,6 +1456,8 @@ public abstract class Image extends Main {
return GL_FindImage(name, it_skin);
}
+ private IntBuffer texnum = Lib.newIntBuffer(1);
+
/*
* GL_FreeUnusedImages
*
@@ -1484,7 +1484,8 @@ public abstract class Image extends Main {
continue;
// free it
- gl.glDeleteTextures(1, new int[] { image.texnum });
+ texnum.put(0, image.texnum);
+ gl.glDeleteTextures(texnum);
image.clear();
}
}
@@ -1584,7 +1585,8 @@ public abstract class Image extends Main {
if (image.registration_sequence == 0)
continue; // free image_t slot
// free it
- gl.glDeleteTextures(1, new int[] { image.texnum });
+ texnum.put(0, image.texnum);
+ gl.glDeleteTextures(texnum);
image.clear();
}
}
diff --git a/src/jake2/render/fastjogl/Light.java b/src/jake2/render/fastjogl/Light.java
index 685b8d5..6ea4427 100644
--- a/src/jake2/render/fastjogl/Light.java
+++ b/src/jake2/render/fastjogl/Light.java
@@ -2,7 +2,7 @@
* Light.java
* Copyright (C) 2003
*
- * $Id: Light.java,v 1.12 2005-05-07 17:17:48 cawe Exp $
+ * $Id: Light.java,v 1.12.6.1 2005-10-24 22:41:12 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -38,8 +38,6 @@ import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.Arrays;
-import net.java.games.jogl.GL;
-
/**
* Light
*
@@ -65,7 +63,7 @@ public abstract class Light extends Warp {
float[] v = Vec3Cache.get();
Math3D.VectorSubtract(light.origin, r_origin, v);
- gl.glBegin(GL.GL_TRIANGLE_FAN);
+ gl.glBegin(GL_TRIANGLE_FAN);
gl.glColor3f(light.color[0] * 0.2f, light.color[1] * 0.2f,
light.color[2] * 0.2f);
for (int i = 0; i < 3; i++)
@@ -95,19 +93,19 @@ public abstract class Light extends Warp {
r_dlightframecount = r_framecount + 1; // because the count hasn't
// advanced yet for this frame
gl.glDepthMask(false);
- gl.glDisable(GL.GL_TEXTURE_2D);
- gl.glShadeModel(GL.GL_SMOOTH);
- gl.glEnable(GL.GL_BLEND);
- gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE);
+ gl.glDisable(GL_TEXTURE_2D);
+ gl.glShadeModel(GL_SMOOTH);
+ gl.glEnable(GL_BLEND);
+ gl.glBlendFunc(GL_ONE, GL_ONE);
for (int i = 0; i < r_newrefdef.num_dlights; i++) {
R_RenderDlight(r_newrefdef.dlights[i]);
}
gl.glColor3f(1, 1, 1);
- gl.glDisable(GL.GL_BLEND);
- gl.glEnable(GL.GL_TEXTURE_2D);
- gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
+ gl.glDisable(GL_BLEND);
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl.glDepthMask(true);
}
@@ -606,8 +604,6 @@ public abstract class Light extends Warp {
if (monolightmap == '0') {
for (i = 0; i < tmax; i++, destp += stride) {
- //dest.position(destp);
-
for (j = 0; j < smax; j++) {
r = (int) bl[blp++];
@@ -657,8 +653,6 @@ public abstract class Light extends Warp {
}
} else {
for (i = 0; i < tmax; i++, destp += stride) {
- //dest.position(destp);
-
for (j = 0; j < smax; j++) {
r = (int) bl[blp++];
diff --git a/src/jake2/render/fastjogl/Main.java b/src/jake2/render/fastjogl/Main.java
index cc3ed27..c5df8c9 100644
--- a/src/jake2/render/fastjogl/Main.java
+++ b/src/jake2/render/fastjogl/Main.java
@@ -2,7 +2,7 @@
* Main.java
* Copyright (C) 2003
*
- * $Id: Main.java,v 1.8 2005-05-07 18:23:26 cawe Exp $
+ * $Id: Main.java,v 1.8.6.1 2005-10-24 22:41:12 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -33,6 +33,7 @@ import jake2.game.cplane_t;
import jake2.game.cvar_t;
import jake2.qcommon.*;
import jake2.render.*;
+import jake2.util.*;
import jake2.util.Math3D;
import jake2.util.Vargs;
@@ -40,7 +41,6 @@ import java.awt.Dimension;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
-import net.java.games.jogl.GL;
import net.java.games.jogl.Version;
/**
@@ -112,10 +112,6 @@ public abstract class Main extends Base {
====================================================================
*/
- int GL_TEXTURE0 = GL.GL_TEXTURE0;
- int GL_TEXTURE1 = GL.GL_TEXTURE1;
-
-
model_t r_worldmodel;
float gldepthmin, gldepthmax;
@@ -146,7 +142,7 @@ public abstract class Main extends Base {
float[] vright = { 0, 0, 0 };
float[] r_origin = { 0, 0, 0 };
- float r_world_matrix[] = new float[16];
+ FloatBuffer r_world_matrix = Lib.newFloatBuffer(16);
float r_base_world_matrix[] = new float[16];
//
@@ -288,20 +284,20 @@ public abstract class Main extends Base {
alpha = e.alpha;
if (alpha != 1.0F)
- gl.glEnable(GL.GL_BLEND);
+ gl.glEnable(GL_BLEND);
gl.glColor4f(1, 1, 1, alpha);
GL_Bind(currentmodel.skins[e.frame].texnum);
- GL_TexEnv(GL.GL_MODULATE);
+ GL_TexEnv(GL_MODULATE);
if (alpha == 1.0)
- gl.glEnable(GL.GL_ALPHA_TEST);
+ gl.glEnable(GL_ALPHA_TEST);
else
- gl.glDisable(GL.GL_ALPHA_TEST);
+ gl.glDisable(GL_ALPHA_TEST);
- gl.glBegin(GL.GL_QUADS);
+ gl.glBegin(GL_QUADS);
gl.glTexCoord2f(0, 1);
Math3D.VectorMA(e.origin, -frame.origin_y, vup, point);
@@ -325,11 +321,11 @@ public abstract class Main extends Base {
gl.glEnd();
- gl.glDisable(GL.GL_ALPHA_TEST);
- GL_TexEnv(GL.GL_REPLACE);
+ gl.glDisable(GL_ALPHA_TEST);
+ GL_TexEnv(GL_REPLACE);
if (alpha != 1.0F)
- gl.glDisable(GL.GL_BLEND);
+ gl.glDisable(GL_BLEND);
gl.glColor4f(1, 1, 1, 1);
}
@@ -357,14 +353,13 @@ public abstract class Main extends Base {
gl.glPushMatrix();
R_RotateForEntity(currententity);
- gl.glDisable(GL.GL_TEXTURE_2D);
+ gl.glDisable(GL_TEXTURE_2D);
gl.glColor3f(shadelight[0], shadelight[1], shadelight[2]);
// this replaces the TRIANGLE_FAN
- glut.glutWireCube(gl, 20);
+ //glut.glutWireCube(gl, 20);
- /*
- gl.glBegin(GL.GL_TRIANGLE_FAN);
+ gl.glBegin(GL_TRIANGLE_FAN);
gl.glVertex3f(0, 0, -16);
int i;
for (i=0 ; i<=4 ; i++) {
@@ -372,16 +367,16 @@ public abstract class Main extends Base {
}
gl.glEnd();
- gl.glBegin(GL.GL_TRIANGLE_FAN);
+ gl.glBegin(GL_TRIANGLE_FAN);
gl.glVertex3f (0, 0, 16);
for (i=4 ; i>=0 ; i--) {
gl.glVertex3f((float)(16.0f * Math.cos(i * Math.PI / 2)), (float)(16.0f * Math.sin(i * Math.PI / 2)), 0.0f);
}
gl.glEnd();
- */
+
gl.glColor3f(1, 1, 1);
gl.glPopMatrix();
- gl.glEnable(GL.GL_TEXTURE_2D);
+ gl.glEnable(GL_TEXTURE_2D);
}
/*
@@ -480,10 +475,10 @@ public abstract class Main extends Base {
GL_Bind(r_particletexture.texnum);
gl.glDepthMask(false); // no z buffering
- gl.glEnable(GL.GL_BLEND);
- GL_TexEnv(GL.GL_MODULATE);
+ gl.glEnable(GL_BLEND);
+ GL_TexEnv(GL_MODULATE);
- gl.glBegin(GL.GL_TRIANGLES);
+ gl.glBegin(GL_TRIANGLES);
FloatBuffer sourceVertices = particle_t.vertexArray;
IntBuffer sourceColors = particle_t.colorArray;
@@ -520,10 +515,10 @@ public abstract class Main extends Base {
}
gl.glEnd();
- gl.glDisable(GL.GL_BLEND);
+ gl.glDisable(GL_BLEND);
gl.glColor4f(1, 1, 1, 1);
gl.glDepthMask(true); // back to normal Z buffering
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
}
/*
@@ -535,25 +530,25 @@ public abstract class Main extends Base {
if (gl_ext_pointparameters.value != 0.0f && qglPointParameterfEXT) {
- //gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
- gl.glVertexPointer(3, GL.GL_FLOAT, 0, particle_t.vertexArray);
- gl.glEnableClientState(GL.GL_COLOR_ARRAY);
- gl.glColorPointer(4, GL.GL_UNSIGNED_BYTE, 0, particle_t.colorArray);
+ //gl.glEnableClientState(GL_VERTEX_ARRAY);
+ gl.glVertexPointer(3, 0, particle_t.vertexArray);
+ gl.glEnableClientState(GL_COLOR_ARRAY);
+ gl.glColorPointer(4, true, 0, particle_t.getColorAsByteBuffer());
gl.glDepthMask(false);
- gl.glEnable(GL.GL_BLEND);
- gl.glDisable(GL.GL_TEXTURE_2D);
+ gl.glEnable(GL_BLEND);
+ gl.glDisable(GL_TEXTURE_2D);
gl.glPointSize(gl_particle_size.value);
- gl.glDrawArrays(GL.GL_POINTS, 0, r_newrefdef.num_particles);
+ gl.glDrawArrays(GL_POINTS, 0, r_newrefdef.num_particles);
- gl.glDisableClientState(GL.GL_COLOR_ARRAY);
- //gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
+ gl.glDisableClientState(GL_COLOR_ARRAY);
+ //gl.glDisableClientState(GL_VERTEX_ARRAY);
- gl.glDisable(GL.GL_BLEND);
+ gl.glDisable(GL_BLEND);
gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
gl.glDepthMask(true);
- gl.glEnable(GL.GL_TEXTURE_2D);
+ gl.glEnable(GL_TEXTURE_2D);
}
else {
@@ -573,10 +568,10 @@ public abstract class Main extends Base {
if (v_blend[3] == 0.0f)
return;
- gl.glDisable(GL.GL_ALPHA_TEST);
- gl.glEnable(GL.GL_BLEND);
- gl.glDisable(GL.GL_DEPTH_TEST);
- gl.glDisable(GL.GL_TEXTURE_2D);
+ gl.glDisable(GL_ALPHA_TEST);
+ gl.glEnable(GL_BLEND);
+ gl.glDisable(GL_DEPTH_TEST);
+ gl.glDisable(GL_TEXTURE_2D);
gl.glLoadIdentity();
@@ -586,7 +581,7 @@ public abstract class Main extends Base {
gl.glColor4f(v_blend[0], v_blend[1], v_blend[2], v_blend[3]);
- gl.glBegin(GL.GL_QUADS);
+ gl.glBegin(GL_QUADS);
gl.glVertex3f(10, 100, 100);
gl.glVertex3f(10, -100, 100);
@@ -594,9 +589,9 @@ public abstract class Main extends Base {
gl.glVertex3f(10, 100, -100);
gl.glEnd();
- gl.glDisable(GL.GL_BLEND);
- gl.glEnable(GL.GL_TEXTURE_2D);
- gl.glEnable(GL.GL_ALPHA_TEST);
+ gl.glDisable(GL_BLEND);
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glEnable(GL_ALPHA_TEST);
gl.glColor4f(1, 1, 1, 1);
}
@@ -683,16 +678,16 @@ public abstract class Main extends Base {
// clear out the portion of the screen that the NOWORLDMODEL defines
if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) {
- gl.glEnable(GL.GL_SCISSOR_TEST);
+ gl.glEnable(GL_SCISSOR_TEST);
gl.glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
gl.glScissor(
r_newrefdef.x,
vid.height - r_newrefdef.height - r_newrefdef.y,
r_newrefdef.width,
r_newrefdef.height);
- gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gl.glClearColor(1.0f, 0.0f, 0.5f, 0.5f);
- gl.glDisable(GL.GL_SCISSOR_TEST);
+ gl.glDisable(GL_SCISSOR_TEST);
}
}
@@ -739,13 +734,13 @@ public abstract class Main extends Base {
// set up projection matrix
//
float screenaspect = (float) r_newrefdef.width / r_newrefdef.height;
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
MYgluPerspective(r_newrefdef.fov_y, screenaspect, 4, 4096);
- gl.glCullFace(GL.GL_FRONT);
+ gl.glCullFace(GL_FRONT);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
gl.glRotatef(-90, 1, 0, 0); // put Z going up
@@ -755,19 +750,19 @@ public abstract class Main extends Base {
gl.glRotatef(-r_newrefdef.viewangles[1], 0, 0, 1);
gl.glTranslatef(-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]);
- gl.glGetFloatv(GL.GL_MODELVIEW_MATRIX, r_world_matrix);
+ gl.glGetFloat(GL_MODELVIEW_MATRIX, r_world_matrix);
//
// set drawing parms
//
if (gl_cull.value != 0.0f)
- gl.glEnable(GL.GL_CULL_FACE);
+ gl.glEnable(GL_CULL_FACE);
else
- gl.glDisable(GL.GL_CULL_FACE);
+ gl.glDisable(GL_CULL_FACE);
- gl.glDisable(GL.GL_BLEND);
- gl.glDisable(GL.GL_ALPHA_TEST);
- gl.glEnable(GL.GL_DEPTH_TEST);
+ gl.glDisable(GL_BLEND);
+ gl.glDisable(GL_ALPHA_TEST);
+ gl.glEnable(GL_DEPTH_TEST);
}
/*
@@ -781,30 +776,30 @@ public abstract class Main extends Base {
if (gl_ztrick.value != 0.0f) {
if (gl_clear.value != 0.0f) {
- gl.glClear(GL.GL_COLOR_BUFFER_BIT);
+ gl.glClear(GL_COLOR_BUFFER_BIT);
}
trickframe++;
if ((trickframe & 1) != 0) {
gldepthmin = 0;
gldepthmax = 0.49999f;
- gl.glDepthFunc(GL.GL_LEQUAL);
+ gl.glDepthFunc(GL_LEQUAL);
}
else {
gldepthmin = 1;
gldepthmax = 0.5f;
- gl.glDepthFunc(GL.GL_GEQUAL);
+ gl.glDepthFunc(GL_GEQUAL);
}
}
else {
if (gl_clear.value != 0.0f)
- gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
else
- gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
+ gl.glClear(GL_DEPTH_BUFFER_BIT);
gldepthmin = 0;
gldepthmax = 1;
- gl.glDepthFunc(GL.GL_LEQUAL);
+ gl.glDepthFunc(GL_LEQUAL);
}
gl.glDepthRange(gldepthmin, gldepthmax);
}
@@ -876,15 +871,15 @@ public abstract class Main extends Base {
void R_SetGL2D() {
// set 2D virtual screen size
gl.glViewport(0, 0, vid.width, vid.height);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
- gl.glDisable(GL.GL_DEPTH_TEST);
- gl.glDisable(GL.GL_CULL_FACE);
- gl.glDisable(GL.GL_BLEND);
- gl.glEnable(GL.GL_ALPHA_TEST);
+ gl.glDisable(GL_DEPTH_TEST);
+ gl.glDisable(GL_CULL_FACE);
+ gl.glDisable(GL_BLEND);
+ gl.glEnable(GL_ALPHA_TEST);
gl.glColor4f(1, 1, 1, 1);
}
@@ -1079,7 +1074,11 @@ public abstract class Main extends Base {
*/
float[] r_turbsin = new float[256];
- protected boolean R_Init(int vid_xpos, int vid_ypos) {
+ protected boolean R_Init() {
+ return R_Init(0, 0);
+ }
+
+ protected boolean R_Init(int vid_xpos, int vid_ypos) {
assert(Warp.SIN.length == 256) : "warpsin table bug";
@@ -1112,13 +1111,13 @@ public abstract class Main extends Base {
** get our various GL strings
*/
VID.Printf(Defines.PRINT_ALL, "JOGL_VERSION: " + Version.getVersion() + '\n');
- gl_config.vendor_string = gl.glGetString(GL.GL_VENDOR);
+ gl_config.vendor_string = gl.glGetString(GL_VENDOR);
VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n');
- gl_config.renderer_string = gl.glGetString(GL.GL_RENDERER);
+ gl_config.renderer_string = gl.glGetString(GL_RENDERER);
VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n');
- gl_config.version_string = gl.glGetString(GL.GL_VERSION);
+ gl_config.version_string = gl.glGetString(GL_VERSION);
VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n');
- gl_config.extensions_string = gl.glGetString(GL.GL_EXTENSIONS);
+ gl_config.extensions_string = gl.glGetString(GL_EXTENSIONS);
VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n');
gl_config.parseOpenGLVersion();
@@ -1273,8 +1272,8 @@ public abstract class Main extends Base {
if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) {
VID.Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\n");
qglActiveTextureARB = true;
- GL_TEXTURE0 = GL.GL_TEXTURE0_ARB;
- GL_TEXTURE1 = GL.GL_TEXTURE1_ARB;
+// TEXTURE0 = GL_TEXTURE0_ARB;
+// TEXTURE1 = GL_TEXTURE1_ARB;
}
else {
VID.Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n");
@@ -1291,7 +1290,7 @@ public abstract class Main extends Base {
Draw_InitLocal();
int err = gl.glGetError();
- if (err != GL.GL_NO_ERROR)
+ if (err != GL_NO_ERROR)
VID.Printf(
Defines.PRINT_ALL,
"glGetError() = 0x%x\n\t%s\n",
@@ -1380,15 +1379,15 @@ public abstract class Main extends Base {
** go into 2D mode
*/
gl.glViewport(0, 0, vid.width, vid.height);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
- gl.glDisable(GL.GL_DEPTH_TEST);
- gl.glDisable(GL.GL_CULL_FACE);
- gl.glDisable(GL.GL_BLEND);
- gl.glEnable(GL.GL_ALPHA_TEST);
+ gl.glDisable(GL_DEPTH_TEST);
+ gl.glDisable(GL_CULL_FACE);
+ gl.glDisable(GL_BLEND);
+ gl.glEnable(GL_ALPHA_TEST);
gl.glColor4f(1, 1, 1, 1);
/*
@@ -1399,9 +1398,9 @@ public abstract class Main extends Base {
if (gl_state.camera_separation == 0 || !gl_state.stereo_enabled) {
if (gl_drawbuffer.string.equalsIgnoreCase("GL_FRONT"))
- gl.glDrawBuffer(GL.GL_FRONT);
+ gl.glDrawBuffer(GL_FRONT);
else
- gl.glDrawBuffer(GL.GL_BACK);
+ gl.glDrawBuffer(GL_BACK);
}
}
@@ -1465,7 +1464,7 @@ public abstract class Main extends Base {
GL_SetTexturePalette(r_rawpalette);
gl.glClearColor(0, 0, 0, 0);
- gl.glClear(GL.GL_COLOR_BUFFER_BIT);
+ gl.glClear(GL_COLOR_BUFFER_BIT);
gl.glClearColor(1f, 0f, 0.5f, 0.5f);
}
@@ -1518,8 +1517,8 @@ public abstract class Main extends Base {
Math3D.VectorAdd(start_points[i], direction, end_points[i]);
}
- gl.glDisable(GL.GL_TEXTURE_2D);
- gl.glEnable(GL.GL_BLEND);
+ gl.glDisable(GL_TEXTURE_2D);
+ gl.glEnable(GL_BLEND);
gl.glDepthMask(false);
r = (d_8to24table[e.skinnum & 0xFF]) & 0xFF;
@@ -1532,7 +1531,7 @@ public abstract class Main extends Base {
gl.glColor4f(r, g, b, e.alpha);
- gl.glBegin(GL.GL_TRIANGLE_STRIP);
+ gl.glBegin(GL_TRIANGLE_STRIP);
float[] v;
@@ -1548,8 +1547,8 @@ public abstract class Main extends Base {
}
gl.glEnd();
- gl.glEnable(GL.GL_TEXTURE_2D);
- gl.glDisable(GL.GL_BLEND);
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glDisable(GL_BLEND);
gl.glDepthMask(true);
}
diff --git a/src/jake2/render/fastjogl/Mesh.java b/src/jake2/render/fastjogl/Mesh.java
index 0b52ad8..f774d13 100644
--- a/src/jake2/render/fastjogl/Mesh.java
+++ b/src/jake2/render/fastjogl/Mesh.java
@@ -2,7 +2,7 @@
* Mesh.java
* Copyright (C) 2003
*
- * $Id: Mesh.java,v 1.12 2005-06-09 07:59:58 cawe Exp $
+ * $Id: Mesh.java,v 1.12.4.1 2005-10-24 22:41:11 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -30,15 +30,11 @@ import jake2.client.VID;
import jake2.client.entity_t;
import jake2.qcommon.qfiles;
import jake2.render.image_t;
-import jake2.util.Math3D;
-import jake2.util.Vec3Cache;
+import jake2.util.*;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
-import net.java.games.jogl.GL;
-import net.java.games.jogl.util.BufferUtils;
-
/**
* Mesh
*
@@ -107,14 +103,11 @@ public abstract class Mesh extends Light {
}
}
- FloatBuffer colorArrayBuf = BufferUtils
- .newFloatBuffer(qfiles.MAX_VERTS * 4);
+ FloatBuffer colorArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 4);
- FloatBuffer vertexArrayBuf = BufferUtils
- .newFloatBuffer(qfiles.MAX_VERTS * 3);
+ FloatBuffer vertexArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 3);
- FloatBuffer textureArrayBuf = BufferUtils
- .newFloatBuffer(qfiles.MAX_VERTS * 2);
+ FloatBuffer textureArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 2);
boolean isFilled = false;
@@ -152,7 +145,7 @@ public abstract class Mesh extends Light {
if ((currententity.flags & (Defines.RF_SHELL_RED
| Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE
| Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0)
- gl.glDisable(GL.GL_TEXTURE_2D);
+ gl.glDisable(GL_TEXTURE_2D);
float frontlerp = 1.0f - backlerp;
@@ -183,8 +176,8 @@ public abstract class Mesh extends Light {
Vec3Cache.release(3); // frontv, move, backv
- //gl.glEnableClientState( GL.GL_VERTEX_ARRAY );
- gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertexArrayBuf);
+ //gl.glEnableClientState( GL_VERTEX_ARRAY );
+ gl.glVertexPointer(3, 0, vertexArrayBuf);
// PMM - added double damage shell
if ((currententity.flags & (Defines.RF_SHELL_RED
@@ -192,8 +185,8 @@ public abstract class Mesh extends Light {
| Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) {
gl.glColor4f(shadelight[0], shadelight[1], shadelight[2], alpha);
} else {
- gl.glEnableClientState(GL.GL_COLOR_ARRAY);
- gl.glColorPointer(4, GL.GL_FLOAT, 0, colorArrayBuf);
+ gl.glEnableClientState(GL_COLOR_ARRAY);
+ gl.glColorPointer(4, 0, colorArrayBuf);
//
// pre light everything
@@ -212,8 +205,8 @@ public abstract class Mesh extends Light {
}
gl.glClientActiveTextureARB(GL_TEXTURE0);
- gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, textureArrayBuf);
- //gl.glEnableClientState( GL.GL_TEXTURE_COORD_ARRAY);
+ gl.glTexCoordPointer(2, 0, textureArrayBuf);
+ //gl.glEnableClientState( GL_TEXTURE_COORD_ARRAY);
int pos = 0;
int[] counts = paliashdr.counts;
@@ -235,9 +228,9 @@ public abstract class Mesh extends Light {
srcIndexBuf = paliashdr.indexElements[j];
- int mode = GL.GL_TRIANGLE_STRIP;
+ int mode = GL_TRIANGLE_STRIP;
if (count < 0) {
- mode = GL.GL_TRIANGLE_FAN;
+ mode = GL_TRIANGLE_FAN;
count = -count;
}
srcIndex = pos << 1;
@@ -249,7 +242,7 @@ public abstract class Mesh extends Light {
.put(dstIndex, srcTextureCoords.get(srcIndex++));
}
- gl.glDrawElements(mode, count, GL.GL_UNSIGNED_INT, srcIndexBuf);
+ gl.glDrawElements(mode, srcIndexBuf);
pos += count;
}
@@ -258,9 +251,9 @@ public abstract class Mesh extends Light {
if ((currententity.flags & (Defines.RF_SHELL_RED
| Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE
| Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0)
- gl.glEnable(GL.GL_TEXTURE_2D);
+ gl.glEnable(GL_TEXTURE_2D);
- gl.glDisableClientState(GL.GL_COLOR_ARRAY);
+ gl.glDisableClientState(GL_COLOR_ARRAY);
}
@@ -296,9 +289,9 @@ public abstract class Mesh extends Light {
break; // done
if (count < 0) {
count = -count;
- gl.glBegin(GL.GL_TRIANGLE_FAN);
+ gl.glBegin(GL_TRIANGLE_FAN);
} else
- gl.glBegin(GL.GL_TRIANGLE_STRIP);
+ gl.glBegin(GL_TRIANGLE_STRIP);
do {
index = order[orderIndex + 2] * 3;
@@ -594,15 +587,15 @@ public abstract class Mesh extends Light {
if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0
&& (r_lefthand.value == 1.0f)) {
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glScalef(-1, 1, 1);
MYgluPerspective(r_newrefdef.fov_y, (float) r_newrefdef.width
/ r_newrefdef.height, 4, 4096);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL_MODELVIEW);
- gl.glCullFace(GL.GL_BACK);
+ gl.glCullFace(GL_BACK);
}
gl.glPushMatrix();
@@ -628,11 +621,11 @@ public abstract class Mesh extends Light {
// draw it
- gl.glShadeModel(GL.GL_SMOOTH);
+ gl.glShadeModel(GL_SMOOTH);
- GL_TexEnv(GL.GL_MODULATE);
+ GL_TexEnv(GL_MODULATE);
if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) {
- gl.glEnable(GL.GL_BLEND);
+ gl.glEnable(GL_BLEND);
}
if ((currententity.frame >= paliashdr.num_frames)
@@ -658,21 +651,21 @@ public abstract class Mesh extends Light {
GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp);
- GL_TexEnv(GL.GL_REPLACE);
- gl.glShadeModel(GL.GL_FLAT);
+ GL_TexEnv(GL_REPLACE);
+ gl.glShadeModel(GL_FLAT);
gl.glPopMatrix();
if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0
&& (r_lefthand.value == 1.0F)) {
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL_PROJECTION);
gl.glPopMatrix();
- gl.glMatrixMode(GL.GL_MODELVIEW);
- gl.glCullFace(GL.GL_FRONT);
+ gl.glMatrixMode(GL_MODELVIEW);
+ gl.glCullFace(GL_FRONT);
}
if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) {
- gl.glDisable(GL.GL_BLEND);
+ gl.glDisable(GL_BLEND);
}
if ((currententity.flags & Defines.RF_DEPTHHACK) != 0)
@@ -682,12 +675,12 @@ public abstract class Mesh extends Light {
&& (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) {
gl.glPushMatrix();
R_RotateForEntity(e);
- gl.glDisable(GL.GL_TEXTURE_2D);
- gl.glEnable(GL.GL_BLEND);
+ gl.glDisable(GL_TEXTURE_2D);
+ gl.glEnable(GL_BLEND);
gl.glColor4f(0, 0, 0, 0.5f);
GL_DrawAliasShadow(paliashdr, currententity.frame);
- gl.glEnable(GL.GL_TEXTURE_2D);
- gl.glDisable(GL.GL_BLEND);
+ gl.glEnable(GL_TEXTURE_2D);
+ gl.glDisable(GL_BLEND);
gl.glPopMatrix();
}
gl.glColor4f(1, 1, 1, 1);
diff --git a/src/jake2/render/fastjogl/Misc.java b/src/jake2/render/fastjogl/Misc.java
index e0e78ee..c79677a 100644
--- a/src/jake2/render/fastjogl/Misc.java
+++ b/src/jake2/render/fastjogl/Misc.java
@@ -2,7 +2,7 @@
* Misc.java
* Copyright (C) 2003
*
- * $Id: Misc.java,v 1.7 2005-05-11 21:44:55 cawe Exp $
+ * $Id: Misc.java,v 1.7.6.1 2005-10-24 22:41:11 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -29,13 +29,12 @@ import jake2.Defines;
import jake2.client.VID;
import jake2.qcommon.FS;
import jake2.qcommon.xcommand_t;
+import jake2.util.Lib;
import java.io.*;
-import java.nio.ByteBuffer;
-import java.nio.MappedByteBuffer;
+import java.nio.*;
import java.nio.channels.FileChannel;
-import net.java.games.jogl.GL;
import net.java.games.jogl.WGL;
/**
@@ -113,11 +112,12 @@ public abstract class Misc extends Mesh {
* GL_ScreenShot_f
*/
void GL_ScreenShot_f() {
- if (contextInUse) {
- screenshot_f();
- } else {
- updateScreen(screenshotCall);
- }
+ // TODO GL_ScreenShot_f() wieder aktivieren
+// if (contextInUse) {
+// screenshot_f();
+// } else {
+// updateScreen(screenshotCall);
+// }
}
private xcommand_t screenshotCall = new xcommand_t() {
@@ -166,7 +166,7 @@ public abstract class Misc extends Mesh {
// change pixel alignment for reading
if (vid.width % 4 != 0) {
- gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1);
+ gl.glPixelStorei(GL_PACK_ALIGNMENT, 1);
}
// OpenGL 1.2+ supports the GL_BGR color format
@@ -174,10 +174,10 @@ public abstract class Misc extends Mesh {
// e.g.: 1.5.2 NVIDIA 66.29
if (gl_config.getOpenGLVersion() >= 1.2f) {
// read the BGR values into the image buffer
- gl.glReadPixels(0, 0, vid.width, vid.height, GL.GL_BGR, GL.GL_UNSIGNED_BYTE, rgb);
+ gl.glReadPixels(0, 0, vid.width, vid.height, GL_BGR, GL_UNSIGNED_BYTE, rgb);
} else {
// read the RGB values into the image buffer
- gl.glReadPixels(0, 0, vid.width, vid.height, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, rgb);
+ gl.glReadPixels(0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, rgb);
// flip RGB to BGR
byte tmp;
for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) {
@@ -187,7 +187,7 @@ public abstract class Misc extends Mesh {
}
}
// reset to default alignment
- gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4);
+ gl.glPixelStorei(GL_PACK_ALIGNMENT, 4);
// close the file channel
ch.close();
} catch (IOException e) {
@@ -213,46 +213,52 @@ public abstract class Misc extends Mesh {
void GL_SetDefaultState() {
gl.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2
//gl.glClearColor(0, 0, 0, 0); // replaced with black
- gl.glCullFace(GL.GL_FRONT);
- gl.glEnable(GL.GL_TEXTURE_2D);
+ gl.glCullFace(GL_FRONT);
+ gl.glEnable(GL_TEXTURE_2D);
- gl.glEnable(GL.GL_ALPHA_TEST);
- gl.glAlphaFunc(GL.GL_GREATER, 0.666f);
+ gl.glEnable(GL_ALPHA_TEST);
+ gl.glAlphaFunc(GL_GREATER, 0.666f);
- gl.glDisable(GL.GL_DEPTH_TEST);
- gl.glDisable(GL.GL_CULL_FACE);
- gl.glDisable(GL.GL_BLEND);
+ gl.glDisable(GL_DEPTH_TEST);
+ gl.glDisable(GL_CULL_FACE);
+ gl.glDisable(GL_BLEND);
gl.glColor4f(1, 1, 1, 1);
- gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL);
- gl.glShadeModel(GL.GL_FLAT);
+ gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ gl.glShadeModel(GL_FLAT);
GL_TextureMode(gl_texturemode.string);
GL_TextureAlphaMode(gl_texturealphamode.string);
GL_TextureSolidMode(gl_texturesolidmode.string);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, gl_filter_min);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, gl_filter_max);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
+ gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
if (qglPointParameterfEXT) {
- float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value };
-
- gl.glEnable(GL.GL_POINT_SMOOTH);
- gl.glPointParameterfEXT(GL.GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value);
- gl.glPointParameterfEXT(GL.GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value);
- gl.glPointParameterfvEXT(GL.GL_DISTANCE_ATTENUATION_EXT, attenuations);
+
+ //float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value };
+
+ FloatBuffer att_buffer=Lib.newFloatBuffer(4);
+ att_buffer.put(0,gl_particle_att_a.value);
+ att_buffer.put(1,gl_particle_att_b.value);
+ att_buffer.put(2,gl_particle_att_c.value);
+
+ gl.glEnable(GL_POINT_SMOOTH);
+ gl.glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value);
+ gl.glPointParameterfEXT(GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value);
+ gl.glPointParameterEXT(GL_DISTANCE_ATTENUATION_EXT, att_buffer);
}
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) {
- gl.glEnable(GL.GL_SHARED_TEXTURE_PALETTE_EXT);
+ gl.glEnable(GL_SHARED_TEXTURE_PALETTE_EXT);
GL_SetTexturePalette(d_8to24table);
}
@@ -262,9 +268,9 @@ public abstract class Misc extends Mesh {
/*
* vertex array extension
*/
- gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
+ gl.glEnableClientState(GL_VERTEX_ARRAY);
gl.glClientActiveTextureARB(GL_TEXTURE0);
- gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
+ gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
void GL_UpdateSwapInterval() {
diff --git a/src/jake2/render/fastjogl/Model.java b/src/jake2/render/fastjogl/Model.java
index ae47135..787b7fe 100644
--- a/src/jake2/render/fastjogl/Model.java
+++ b/src/jake2/render/fastjogl/Model.java
@@ -2,7 +2,7 @@
* Model.java
* Copyright (C) 2003
*
- * $Id: Model.java,v 1.12 2005-05-15 16:06:15 cawe Exp $
+ * $Id: Model.java,v 1.12.6.1 2005-10-24 22:41:11 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -31,15 +31,12 @@ import jake2.game.cplane_t;
import jake2.game.cvar_t;
import jake2.qcommon.*;
import jake2.render.*;
-import jake2.util.Math3D;
-import jake2.util.Vargs;
+import jake2.util.*;
import java.nio.*;
import java.util.Arrays;
import java.util.Vector;
-import net.java.games.jogl.util.BufferUtils;
-
/**
* Model
*
@@ -1195,11 +1192,9 @@ public abstract class Model extends Surf {
*/
static final int MODEL_BUFFER_SIZE = 50000;
- static FloatBuffer globalModelTextureCoordBuf = BufferUtils
- .newFloatBuffer(MODEL_BUFFER_SIZE * 2);
+ static FloatBuffer globalModelTextureCoordBuf = Lib.newFloatBuffer(MODEL_BUFFER_SIZE * 2);
- static IntBuffer globalModelVertexIndexBuf = BufferUtils
- .newIntBuffer(MODEL_BUFFER_SIZE);
+ static IntBuffer globalModelVertexIndexBuf = Lib.newIntBuffer(MODEL_BUFFER_SIZE);
void precompileGLCmds(qfiles.dmdl_t model) {
model.textureCoordBuf = globalModelTextureCoordBuf.slice();
diff --git a/src/jake2/render/fastjogl/Surf.java b/src/jake2/render/fastjogl/Surf.java
index 5c90ed4..ed4065c 100644
--- a/src/jake2/render/fastjogl/Surf.java
+++ b/src/jake2/render/fastjogl/Surf.java
@@ -2,7 +2,7 @@
* Surf.java
* Copyright (C) 2003
*
- * $Id: Surf.java,v 1.10 2005-06-08 21:27:09 cawe Exp $
+ * $Id: Surf.java,v 1.10.4.1 2005-10-24 22:41:12 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -37,9 +37,6 @@ import jake2.util.Math3D;
import java.nio.*;
import java.util.Arrays;
-import net.java.games.jogl.GL;
-import net.java.games.jogl.util.BufferUtils;
-
/**
* Surf
*
@@ -68,7 +65,7 @@ public abstract class Surf extends Draw {
int c_visible_textures;
- static final int GL_LIGHTMAP_FORMAT = GL.GL_RGBA;
+ static final int GL_LIGHTMAP_FORMAT = GL_RGBA;
static class gllightmapstate_t {
int internal_format;
@@ -152,7 +149,7 @@ public abstract class Surf extends Draw {
* ================ DrawGLPoly ================
*/
void DrawGLPoly(glpoly_t p) {
- gl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts);
+ gl.glDrawArrays(GL_POLYGON, p.pos, p.numverts);
}
// ============
@@ -168,7 +165,7 @@ public abstract class Surf extends Draw {
scroll = -64.0f;
p.beginScrolling(scroll);
- gl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts);
+ gl.glDrawArrays(GL_POLYGON, p.pos, p.numverts);
p.endScrolling();
}
@@ -182,15 +179,15 @@ public abstract class Surf extends Draw {
if (gl_showtris.value == 0)
return;
- gl.glDisable(GL.GL_TEXTURE_2D);
- gl.glDisable(GL.GL_DEPTH_TEST);
+ gl.glDisable(GL_TEXTURE_2D);
+ gl.glDisable(GL_DEPTH_TEST);
gl.glColor4f(1, 1, 1, 1);
for (int i = 0; i < MAX_LIGHTMAPS; i++) {
for (msurface_t surf = gl_lms.lightmap_surfaces[i]; surf != null; surf = surf.lightmapchain) {
for (glpoly_t p = surf.polys; p != null; p = p.chain) {
for (int j = 2; j < p.numverts; j++) {
- gl.glBegin(GL.GL_LINE_STRIP);
+ gl.glBegin(GL_LINE_STRIP);
gl.glVertex3f(p.x(0), p.y(0), p.z(0));
gl.glVertex3f(p.x(j-1), p.y(j-1), p.z(j-1));
gl.glVertex3f(p.x(j), p.y(j), p.z(j));
@@ -201,8 +198,8 @@ public abstract class Surf extends Draw {
}
}
- gl.glEnable(GL.GL_DEPTH_TEST);
- gl.glEnable(GL.GL_TEXTURE_2D);
+ gl.glEnable(GL_DEPTH_TEST);
+ gl.glEnable(GL_TEXTURE_2D);
}
private IntBuffer temp2 = Lib
@@ -224,17 +221,17 @@ public abstract class Surf extends Draw {
GL_Bind(image.texnum);
// warp texture, no lightmaps
- GL_TexEnv(GL.GL_MODULATE);
+ GL_TexEnv(GL_MODULATE);
gl.glColor4f(gl_state.inverse_intensity,
gl_state.inverse_intensity, gl_state.inverse_intensity,
1.0F);
EmitWaterPolys(fa);
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
return;
} else {
GL_Bind(image.texnum);
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
}
// ======
@@ -288,8 +285,8 @@ public abstract class Surf extends Draw {
GL_Bind(gl_state.lightmap_textures + fa.lightmaptexturenum);
- gl.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, fa.light_s, fa.light_t,
- smax, tmax, GL_LIGHTMAP_FORMAT, GL.GL_UNSIGNED_BYTE,
+ gl.glTexSubImage2D(GL_TEXTURE_2D, 0, fa.light_s, fa.light_t,
+ smax, tmax, GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE,
temp2);
fa.lightmapchain = gl_lms.lightmap_surfaces[fa.lightmaptexturenum];
@@ -318,16 +315,16 @@ public abstract class Surf extends Draw {
//
// go back to the world matrix
//
- gl.glLoadMatrixf(r_world_matrix);
+ gl.glLoadMatrix(r_world_matrix);
- gl.glEnable(GL.GL_BLEND);
- GL_TexEnv(GL.GL_MODULATE);
+ gl.glEnable(GL_BLEND);
+ GL_TexEnv(GL_MODULATE);
// the textures are prescaled up for a better lighting range,
// so scale it back down
intens = gl_state.inverse_intensity;
- gl.glInterleavedArrays(GL.GL_T2F_V3F, Polygon.BYTE_STRIDE,
+ gl.glInterleavedArrays(GL_T2F_V3F, Polygon.BYTE_STRIDE,
globalPolygonInterleavedBuf);
for (s = r_alpha_surfaces; s != null; s = s.texturechain) {
@@ -348,9 +345,9 @@ public abstract class Surf extends Draw {
DrawGLPoly(s.polys);
}
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
gl.glColor4f(1, 1, 1, 1);
- gl.glDisable(GL.GL_BLEND);
+ gl.glDisable(GL_BLEND);
r_alpha_surfaces = null;
}
@@ -398,7 +395,7 @@ public abstract class Surf extends Draw {
image.texturechain = null;
}
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
}
// direct buffer
@@ -459,9 +456,9 @@ public abstract class Surf extends Draw {
lmtex = surf.lightmaptexturenum;
- gl.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, surf.light_s,
+ gl.glTexSubImage2D(GL_TEXTURE_2D, 0, surf.light_s,
surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT,
- GL.GL_UNSIGNED_BYTE, temp);
+ GL_UNSIGNED_BYTE, temp);
} else {
smax = (surf.extents[0] >> 4) + 1;
@@ -473,9 +470,9 @@ public abstract class Surf extends Draw {
lmtex = 0;
- gl.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, surf.light_s,
+ gl.glTexSubImage2D(GL_TEXTURE_2D, 0, surf.light_s,
surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT,
- GL.GL_UNSIGNED_BYTE, temp);
+ GL_UNSIGNED_BYTE, temp);
}
@@ -496,12 +493,12 @@ public abstract class Surf extends Draw {
for (p = surf.polys; p != null; p = p.chain) {
p.beginScrolling(scroll);
- gl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts);
+ gl.glDrawArrays(GL_POLYGON, p.pos, p.numverts);
p.endScrolling();
}
} else {
for (p = surf.polys; p != null; p = p.chain) {
- gl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts);
+ gl.glDrawArrays(GL_POLYGON, p.pos, p.numverts);
}
}
// PGM
@@ -524,14 +521,14 @@ public abstract class Surf extends Draw {
for (p = surf.polys; p != null; p = p.chain) {
p.beginScrolling(scroll);
- gl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts);
+ gl.glDrawArrays(GL_POLYGON, p.pos, p.numverts);
p.endScrolling();
}
} else {
// PGM
// ==========
for (p = surf.polys; p != null; p = p.chain) {
- gl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts);
+ gl.glDrawArrays(GL_POLYGON, p.pos, p.numverts);
}
// ==========
@@ -568,9 +565,9 @@ public abstract class Surf extends Draw {
//psurf = surfaces[psurfp];
if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) {
- gl.glEnable(GL.GL_BLEND);
+ gl.glEnable(GL_BLEND);
gl.glColor4f(1, 1, 1, 0.25f);
- GL_TexEnv(GL.GL_MODULATE);
+ GL_TexEnv(GL_MODULATE);
}
//
@@ -601,9 +598,9 @@ public abstract class Surf extends Draw {
}
if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) {
- gl.glDisable(GL.GL_BLEND);
+ gl.glDisable(GL_BLEND);
gl.glColor4f(1, 1, 1, 1);
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
}
}
@@ -673,19 +670,19 @@ public abstract class Surf extends Draw {
GL_EnableMultitexture(true);
GL_SelectTexture(GL_TEXTURE0);
- GL_TexEnv(GL.GL_REPLACE);
- gl.glInterleavedArrays(GL.GL_T2F_V3F, Polygon.BYTE_STRIDE,
+ GL_TexEnv(GL_REPLACE);
+ gl.glInterleavedArrays(GL_T2F_V3F, Polygon.BYTE_STRIDE,
globalPolygonInterleavedBuf);
GL_SelectTexture(GL_TEXTURE1);
- GL_TexEnv(GL.GL_MODULATE);
- gl.glTexCoordPointer(2, GL.GL_FLOAT, Polygon.BYTE_STRIDE,
+ GL_TexEnv(GL_MODULATE);
+ gl.glTexCoordPointer(2, Polygon.BYTE_STRIDE,
globalPolygonTexCoord1Buf);
- gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
+ gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY);
R_DrawInlineBModel();
gl.glClientActiveTextureARB(GL_TEXTURE1);
- gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY);
+ gl.glDisableClientState(GL_TEXTURE_COORD_ARRAY);
GL_EnableMultitexture(false);
@@ -850,23 +847,23 @@ public abstract class Surf extends Draw {
GL_EnableMultitexture(true);
GL_SelectTexture(GL_TEXTURE0);
- GL_TexEnv(GL.GL_REPLACE);
- gl.glInterleavedArrays(GL.GL_T2F_V3F, Polygon.BYTE_STRIDE,
+ GL_TexEnv(GL_REPLACE);
+ gl.glInterleavedArrays(GL_T2F_V3F, Polygon.BYTE_STRIDE,
globalPolygonInterleavedBuf);
GL_SelectTexture(GL_TEXTURE1);
- gl.glTexCoordPointer(2, GL.GL_FLOAT, Polygon.BYTE_STRIDE,
+ gl.glTexCoordPointer(2, Polygon.BYTE_STRIDE,
globalPolygonTexCoord1Buf);
- gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
+ gl.glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if (gl_lightmap.value != 0)
- GL_TexEnv(GL.GL_REPLACE);
+ GL_TexEnv(GL_REPLACE);
else
- GL_TexEnv(GL.GL_MODULATE);
+ GL_TexEnv(GL_MODULATE);
R_RecursiveWorldNode(r_worldmodel.nodes[0]); // root node
gl.glClientActiveTextureARB(GL_TEXTURE1);
- gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY);
+ gl.glDisableClientState(GL_TEXTURE_COORD_ARRAY);
GL_EnableMultitexture(false);
@@ -978,10 +975,10 @@ public abstract class Surf extends Draw {
}
GL_Bind(gl_state.lightmap_textures + texture);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER,
- GL.GL_LINEAR);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER,
- GL.GL_LINEAR);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ gl_lms.lightmap_buffer.rewind();
if (dynamic) {
int i;
@@ -991,18 +988,18 @@ public abstract class Surf extends Draw {
height = gl_lms.allocated[i];
}
- gl.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, BLOCK_WIDTH, height,
- GL_LIGHTMAP_FORMAT, GL.GL_UNSIGNED_BYTE,
+ gl.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, BLOCK_WIDTH, height,
+ GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE,
gl_lms.lightmap_buffer);
} else {
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, gl_lms.internal_format,
+ gl.glTexImage2D(GL_TEXTURE_2D, 0, gl_lms.internal_format,
BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_LIGHTMAP_FORMAT,
- GL.GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer);
+ GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer);
if (++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS)
Com.Error(Defines.ERR_DROP,
"LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n");
- //debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4);
+ // debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4);
}
}
@@ -1152,7 +1149,7 @@ public abstract class Surf extends Draw {
lightstyle_t[] lightstyles;
- IntBuffer dummy = BufferUtils.newIntBuffer(128 * 128);
+ IntBuffer dummy = Lib.newIntBuffer(128 * 128);
/*
* ================== GL_BeginBuildingLightmaps
@@ -1218,9 +1215,9 @@ public abstract class Surf extends Draw {
else if (format == 'C') {
gl_lms.internal_format = gl_tex_alpha_format;
} else if (format == 'I') {
- gl_lms.internal_format = GL.GL_INTENSITY8;
+ gl_lms.internal_format = GL_INTENSITY8;
} else if (format == 'L') {
- gl_lms.internal_format = GL.GL_LUMINANCE8;
+ gl_lms.internal_format = GL_LUMINANCE8;
} else {
gl_lms.internal_format = gl_tex_solid_format;
}
@@ -1229,13 +1226,13 @@ public abstract class Surf extends Draw {
* * initialize the dynamic lightmap texture
*/
GL_Bind(gl_state.lightmap_textures + 0);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER,
- GL.GL_LINEAR);
- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER,
- GL.GL_LINEAR);
- gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, gl_lms.internal_format,
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR);
+ gl.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
+ GL_LINEAR);
+ gl.glTexImage2D(GL_TEXTURE_2D, 0, gl_lms.internal_format,
BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_LIGHTMAP_FORMAT,
- GL.GL_UNSIGNED_BYTE, dummy);
+ GL_UNSIGNED_BYTE, dummy);
}
/*
diff --git a/src/jake2/render/fastjogl/Warp.java b/src/jake2/render/fastjogl/Warp.java
index d8687a4..e31db67 100644
--- a/src/jake2/render/fastjogl/Warp.java
+++ b/src/jake2/render/fastjogl/Warp.java
@@ -2,7 +2,7 @@
* Warp.java
* Copyright (C) 2003
*
- * $Id: Warp.java,v 1.7 2005-01-16 15:24:50 cawe Exp $
+ * $Id: Warp.java,v 1.7.6.1 2005-10-24 22:41:11 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -31,7 +31,6 @@ import jake2.qcommon.Com;
import jake2.render.*;
import jake2.util.Math3D;
import jake2.util.Vec3Cache;
-import net.java.games.jogl.GL;
/**
* Warp
@@ -294,7 +293,7 @@ public abstract class Warp extends Model {
for (bp = fa.polys; bp != null; bp = bp.next) {
p = bp;
- gl.glBegin(GL.GL_TRIANGLE_FAN);
+ gl.glBegin(GL_TRIANGLE_FAN);
for (int i = 0; i < p.numverts; i++) {
os = p.s1(i);
ot = p.t1(i);
@@ -608,7 +607,7 @@ public abstract class Warp extends Model {
GL_Bind(sky_images[skytexorder[i]].texnum);
- gl.glBegin(GL.GL_QUADS);
+ gl.glBegin(GL_QUADS);
MakeSkyVec(skymins[0][i], skymins[1][i], i);
MakeSkyVec(skymins[0][i], skymaxs[1][i], i);
MakeSkyVec(skymaxs[0][i], skymaxs[1][i], i);