aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/render')
-rw-r--r--src/jake2/render/jogl/Base.java112
-rw-r--r--src/jake2/render/jogl/Draw.java78
-rw-r--r--src/jake2/render/jogl/Image.java166
-rw-r--r--src/jake2/render/jogl/Light.java32
-rw-r--r--src/jake2/render/jogl/Main.java196
-rw-r--r--src/jake2/render/jogl/Mesh.java70
-rw-r--r--src/jake2/render/jogl/Misc.java76
-rw-r--r--src/jake2/render/jogl/Surf.java142
-rw-r--r--src/jake2/render/jogl/Warp.java7
9 files changed, 419 insertions, 460 deletions
diff --git a/src/jake2/render/jogl/Base.java b/src/jake2/render/jogl/Base.java
index 5a4e9ea..85fe17c 100644
--- a/src/jake2/render/jogl/Base.java
+++ b/src/jake2/render/jogl/Base.java
@@ -2,7 +2,7 @@
* Base.java
* Copyright (C) 2003
*
- * $Id: Base.java,v 1.2 2004-07-15 14:37:34 hzi Exp $
+ * $Id: Base.java,v 1.2.12.1 2005-07-16 18:25:37 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -25,17 +25,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package jake2.render.jogl;
-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";
// up / down
@@ -229,67 +232,44 @@ public abstract class Base extends JoglBase {
static final int GL_RENDERER_MCD = 0x01000000;
static final int GL_RENDERER_OTHER = 0x80000000;
+ /*
+ * base members
+ */
-// typedef struct
-// {
-// int renderer;
-// const char *renderer_string;
-// const char *vendor_string;
-// const char *version_string;
-// const char *extensions_string;
-//
-// qboolean allow_cds;
-// } glconfig_t;
-//
-// typedef struct
-// {
-// float inverse_intensity;
-// qboolean fullscreen;
-//
-// int prev_mode;
-//
-// unsigned char *d_16to8table;
-//
-// int lightmap_textures;
-//
-// int currenttextures[2];
-// int currenttmu;
-//
-// float camera_separation;
-// qboolean stereo_enabled;
-//
-// unsigned char originalRedGammaTable[256];
-// unsigned char originalGreenGammaTable[256];
-// unsigned char originalBlueGammaTable[256];
-// } glstate_t;
-//
-// /*
-// ====================================================================
-//
-// IMPORTED FUNCTIONS
-//
-// ====================================================================
-// */
-//
-// extern refimport_t ri;
-//
-//
-// /*
-// ====================================================================
-//
-// IMPLEMENTATION SPECIFIC FUNCTIONS
-//
-// ====================================================================
-// */
-//
-// void GLimp_BeginFrame( float camera_separation );
-// void GLimp_EndFrame( void );
-// int GLimp_Init( void *hinstance, void *hWnd );
-// void GLimp_Shutdown( void );
-// int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen );
-// void GLimp_AppActivate( qboolean active );
-// void GLimp_EnableLogging( qboolean enable );
-// void GLimp_LogNewFrame( void );
-//
+ protected viddef_t vid = new viddef_t();
+
+ protected cvar_t vid_fullscreen;
+
+ 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
+ }
}
diff --git a/src/jake2/render/jogl/Draw.java b/src/jake2/render/jogl/Draw.java
index 5047ddb..082f424 100644
--- a/src/jake2/render/jogl/Draw.java
+++ b/src/jake2/render/jogl/Draw.java
@@ -2,7 +2,7 @@
* Draw.java
* Copyright (C) 2003
*
- * $Id: Draw.java,v 1.5 2004-07-16 10:11:35 cawe Exp $
+ * $Id: Draw.java,v 1.5.12.1 2005-07-16 18:25:37 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,13 @@ 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,8 +334,8 @@ public abstract class Draw extends Image {
if ( !qglColorTableEXT )
{
- int[] image32 = new int[256*256];
- int destIndex = 0;
+ image32.clear();
+ int destIndex = 0;
for (i=0 ; i<trows ; i++)
{
@@ -346,15 +348,15 @@ 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];
+ image8.clear();
int destIndex = 0;;
for (i=0 ; i<trows ; i++)
@@ -368,27 +370,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 +402,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/jogl/Image.java b/src/jake2/render/jogl/Image.java
index 1edb8fe..3b91050 100644
--- a/src/jake2/render/jogl/Image.java
+++ b/src/jake2/render/jogl/Image.java
@@ -2,7 +2,7 @@
* Image.java
* Copyright (C) 2003
*
- * $Id: Image.java,v 1.6 2004-09-22 19:22:16 salomo Exp $
+ * $Id: Image.java,v 1.6.12.1 2005-07-16 18:25:37 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -42,12 +42,9 @@ import java.awt.Dimension;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.IntBuffer;
+import java.nio.*;
import java.util.Arrays;
-import net.java.games.jogl.GL;
/**
* Image
@@ -86,9 +83,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
@@ -102,18 +99,15 @@ 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);
}
}
@@ -123,15 +117,15 @@ public abstract class Image extends Main {
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 /* GLenum */) {
@@ -154,7 +148,7 @@ public abstract class Image extends Main {
if (qglSelectTextureSGIS) {
// TODO handle this: gl.glSelectTextureSGIS(texture);
- gl.glActiveTexture(texture);
+ gl.glActiveTextureARB(texture);
} else if (qglActiveTextureARB) {
gl.glActiveTextureARB(texture);
gl.glClientActiveTextureARB(texture);
@@ -167,7 +161,7 @@ public abstract class Image extends Main {
) {
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;
}
}
@@ -182,7 +176,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 /* GLenum */
@@ -212,16 +206,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;
@@ -238,23 +232,20 @@ 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),
- // #ifdef GL_RGB2_EXT
- new gltmode_t("GL_RGB2", GL.GL_RGB2_EXT)
- // #endif
+ 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),
};
static final int NUM_GL_SOLID_MODES = gl_solid_modes.length;
@@ -287,9 +278,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);
}
}
@@ -1038,7 +1029,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;
@@ -1052,7 +1043,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]);
}
}
@@ -1067,7 +1058,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);
@@ -1078,8 +1069,9 @@ 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;
for (scaled_width = 1; scaled_width < width; scaled_width <<= 1)
@@ -1145,16 +1137,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);
- 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).flip();
+ gl.glTexImage2D(GL_TEXTURE_2D, 0, comp,
+ scaled_width, scaled_height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, tex);
}
//goto done;
throw new longjmpException();
@@ -1173,14 +1165,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);
- 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).flip();
+ gl.glTexImage2D(GL_TEXTURE_2D, 0, comp, scaled_width,
+ scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex);
}
if (mipmap) {
@@ -1202,16 +1194,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);
- 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).flip();
+ gl.glTexImage2D(GL_TEXTURE_2D, miplevel, comp,
+ scaled_width, scaled_height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, tex);
}
}
}
@@ -1221,14 +1213,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);
}
@@ -1254,12 +1246,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);
// TODO check this
@@ -1532,6 +1524,8 @@ public abstract class Image extends Main {
return GL_FindImage(name, it_skin);
}
+ private IntBuffer texnum = Lib.newIntBuffer(1);
+
/*
* ================ GL_FreeUnusedImages
*
@@ -1559,8 +1553,8 @@ public abstract class Image extends Main {
continue;
// free it
- // TODO jogl bug
- gl.glDeleteTextures(1, new int[] { image.texnum });
+ texnum.put(0, image.texnum);
+ gl.glDeleteTextures(texnum);
image.clear();
}
}
@@ -1661,8 +1655,8 @@ public abstract class Image extends Main {
if (image.registration_sequence == 0)
continue; // free image_t slot
// free it
- // TODO jogl bug
- gl.glDeleteTextures(1, new int[] { image.texnum });
+ texnum.put(0, image.texnum);
+ gl.glDeleteTextures(texnum);
image.clear();
}
}
diff --git a/src/jake2/render/jogl/Light.java b/src/jake2/render/jogl/Light.java
index f6b8e10..68c9839 100644
--- a/src/jake2/render/jogl/Light.java
+++ b/src/jake2/render/jogl/Light.java
@@ -2,7 +2,7 @@
* Light.java
* Copyright (C) 2003
*
- * $Id: Light.java,v 1.7 2004-09-22 19:22:16 salomo Exp $
+ * $Id: Light.java,v 1.7.12.1 2005-07-16 18:25:37 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -41,8 +41,6 @@ import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.Arrays;
-import net.java.games.jogl.GL;
-
/**
* Light
*
@@ -73,7 +71,7 @@ public abstract class Light extends Warp {
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 (i = 0; i < 3; i++)
@@ -103,10 +101,10 @@ 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 (i = 0; i < r_newrefdef.num_dlights; i++) {
l = r_newrefdef.dlights[i];
@@ -114,9 +112,9 @@ public abstract class Light extends Warp {
}
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);
}
@@ -592,9 +590,7 @@ 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++) {
+ for (j = 0; j < smax; j++, destp++) {
r = (int) bl[blp++];
g = (int) bl[blp++];
@@ -641,15 +637,13 @@ public abstract class Light extends Warp {
g &= 0xFF;
b &= 0xFF;
a &= 0xFF;
- dest.put(destp++, (a << 24) | (b << 16) | (g << 8)
+ dest.put(destp, (a << 24) | (b << 16) | (g << 8)
| (r << 0));
}
}
} else {
for (i = 0; i < tmax; i++, destp += stride) {
- dest.position(destp);
-
- for (j = 0; j < smax; j++) {
+ for (j = 0; j < smax; j++, destp++) {
r = (int) bl[blp++];
g = (int) bl[blp++];
@@ -721,7 +715,7 @@ public abstract class Light extends Warp {
g &= 0xFF;
b &= 0xFF;
a &= 0xFF;
- dest.put(destp++, (a << 24) | (b << 16) | (g << 8)
+ dest.put(destp, (a << 24) | (b << 16) | (g << 8)
| (r << 0));
}
}
diff --git a/src/jake2/render/jogl/Main.java b/src/jake2/render/jogl/Main.java
index 7d2523a..31ded6c 100644
--- a/src/jake2/render/jogl/Main.java
+++ b/src/jake2/render/jogl/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-07-16 18:25:37 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -29,20 +29,14 @@ import jake2.Defines;
import jake2.Globals;
import jake2.client.*;
import jake2.game.*;
-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.awt.Dimension;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
-import net.java.games.jogl.GL;
-import net.java.games.jogl.Version;
-
/**
* Main
*
@@ -113,9 +107,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 +137,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 +279,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 +316,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 +348,14 @@ 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);
+// // this replaces the TRIANGLE_FAN
+// 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 +363,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 +471,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;
@@ -519,10 +510,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);
}
/*
@@ -534,25 +525,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 {
@@ -572,10 +563,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();
@@ -585,7 +576,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);
@@ -593,9 +584,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 +674,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);
}
}
@@ -737,13 +728,13 @@ public abstract class Main extends Base {
// set up projection matrix
//
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
@@ -753,19 +744,20 @@ 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);
+ r_world_matrix.clear();
//
// 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);
}
/*
@@ -779,30 +771,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);
}
@@ -874,15 +866,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);
}
@@ -1105,18 +1097,18 @@ public abstract class Main extends Base {
protected boolean R_Init2() {
VID.MenuInit();
-
+
/*
** get our various GL strings
*/
- VID.Printf(Defines.PRINT_ALL, "JOGL_VERSION: " + Version.getVersion() + '\n');
- gl_config.vendor_string = gl.glGetString(GL.GL_VENDOR);
+// VID.Printf(Defines.PRINT_ALL, "JOGL_VERSION: " + Version.getVersion() + '\n');
+ 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();
@@ -1279,8 +1271,8 @@ public abstract class Main extends Base {
// qglClientActiveTextureARB = ( void * ) qwglGetProcAddress( "glClientActiveTextureARB" );
qglActiveTextureARB = true;
qglMTexCoord2fSGIS = true;
- GL_TEXTURE0 = GL.GL_TEXTURE0_ARB;
- GL_TEXTURE1 = GL.GL_TEXTURE1_ARB;
+// GL_TEXTURE0 = GL_TEXTURE0_ARB;
+// GL_TEXTURE1 = GL_TEXTURE1_ARB;
Cvar.SetValue("r_fullbright", 1);
}
else {
@@ -1304,8 +1296,8 @@ public abstract class Main extends Base {
qglSelectTextureSGIS = true;
qglMTexCoord2fSGIS = true;
Cvar.SetValue("r_fullbright", 1);
- // //GL_TEXTURE0 = GL.GL_TEXTURE0_SGIS;
- // //GL_TEXTURE1 = GL.GL_TEXTURE1_SGIS;
+ // //GL_TEXTURE0 = GL_TEXTURE0_SGIS;
+ // //GL_TEXTURE1 = GL_TEXTURE1_SGIS;
} else {
VID.Printf(Defines.PRINT_ALL, "...ignoring GL_SGIS_multitexture\n");
Cvar.SetValue("r_fullbright", 0);
@@ -1325,7 +1317,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",
@@ -1371,7 +1363,7 @@ public abstract class Main extends Base {
// FIXME: only restart if CDS is required
cvar_t ref;
- ref = Cvar.Get("vid_ref", "jogl", 0);
+ ref = Cvar.Get("vid_ref", "lwjgl", 0);
ref.modified = true;
}
@@ -1414,15 +1406,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);
/*
@@ -1433,9 +1425,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);
}
}
@@ -1499,7 +1491,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);
}
@@ -1552,8 +1544,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;
@@ -1566,7 +1558,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;
@@ -1582,8 +1574,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/jogl/Mesh.java b/src/jake2/render/jogl/Mesh.java
index 4e1ad74..117448d 100644
--- a/src/jake2/render/jogl/Mesh.java
+++ b/src/jake2/render/jogl/Mesh.java
@@ -2,7 +2,7 @@
* Mesh.java
* Copyright (C) 2003
*
- * $Id: Mesh.java,v 1.10 2005-05-08 00:42:22 cawe Exp $
+ * $Id: Mesh.java,v 1.10.6.1 2005-07-16 18:25:37 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -30,13 +30,11 @@ import jake2.client.VID;
import jake2.client.entity_t;
import jake2.qcommon.qfiles;
import jake2.render.image_t;
+import jake2.util.Lib;
import jake2.util.Math3D;
import java.nio.FloatBuffer;
-import net.java.games.jogl.GL;
-import net.java.games.jogl.util.BufferUtils;
-
/**
* Mesh
*
@@ -153,11 +151,9 @@ 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);
boolean isFilled = false;
@@ -212,7 +208,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);
frontlerp = 1.0f - backlerp;
@@ -237,19 +233,19 @@ public abstract class Mesh extends Light {
if (gl_vertex_arrays.value != 0.0f) {
GL_LerpVerts(paliashdr.num_xyz, ov, v, move, frontv, 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
| Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE
| Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) {
- gl.glDisableClientState(GL.GL_COLOR_ARRAY);
+ gl.glDisableClientState(GL_COLOR_ARRAY);
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
@@ -276,9 +272,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);
}
// PMM - added double damage shell
@@ -328,9 +324,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);
}
if ((currententity.flags & (Defines.RF_SHELL_RED
@@ -374,7 +370,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.glEnable(GL.GL_TEXTURE_2D);
+ gl.glEnable(GL_TEXTURE_2D);
}
/*
@@ -403,9 +399,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 {
// normals and vertexes come from the frame list
@@ -725,15 +721,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();
@@ -759,11 +755,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)
@@ -788,21 +784,21 @@ public abstract class Mesh extends Light {
currententity.backlerp = 0;
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)
@@ -812,12 +808,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/jogl/Misc.java b/src/jake2/render/jogl/Misc.java
index 5ea9a8b..b559104 100644
--- a/src/jake2/render/jogl/Misc.java
+++ b/src/jake2/render/jogl/Misc.java
@@ -2,7 +2,7 @@
* Misc.java
* Copyright (C) 2003
*
- * $Id: Misc.java,v 1.7 2005-05-11 21:44:49 cawe Exp $
+ * $Id: Misc.java,v 1.7.6.1 2005-07-16 18:25:37 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -29,15 +29,14 @@ 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.*;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
-import net.java.games.jogl.GL;
-import net.java.games.jogl.WGL;
-
/**
* Misc
*
@@ -125,11 +124,12 @@ public abstract class Misc extends Mesh {
* GL_ScreenShot_f
*/
void GL_ScreenShot_f() {
- if (contextInUse) {
- screenshot_f();
- } else {
- updateScreen(screenshotCall);
- }
+ // TODO don't forget
+// if (contextInUse) {
+// screenshot_f();
+// } else {
+// updateScreen(screenshotCall);
+// }
}
private xcommand_t screenshotCall = new xcommand_t() {
@@ -178,7 +178,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
@@ -186,10 +186,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) {
@@ -199,7 +199,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) {
@@ -226,48 +226,52 @@ public abstract class Misc extends Mesh {
{
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 attenuations = Lib.newFloatBuffer(4);
+ attenuations.put(0,gl_particle_att_a.value);
+ attenuations.put(1,gl_particle_att_b.value);
+ attenuations.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, attenuations );
}
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 );
}
@@ -283,7 +287,7 @@ public abstract class Misc extends Mesh {
if ( !gl_state.stereo_enabled )
{
if (qwglSwapIntervalEXT) {
- ((WGL)gl).wglSwapIntervalEXT((int)gl_swapinterval.value);
+// TODO ((WGL)gl).wglSwapIntervalEXT((int)gl_swapinterval.value);
}
}
}
diff --git a/src/jake2/render/jogl/Surf.java b/src/jake2/render/jogl/Surf.java
index 7b5e221..ecd262f 100644
--- a/src/jake2/render/jogl/Surf.java
+++ b/src/jake2/render/jogl/Surf.java
@@ -2,7 +2,7 @@
* Surf.java
* Copyright (C) 2003
*
- * $Id: Surf.java,v 1.6 2005-01-09 22:34:21 cawe Exp $
+ * $Id: Surf.java,v 1.6.6.1 2005-07-16 18:25:37 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -37,8 +37,6 @@ import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.Arrays;
-import net.java.games.jogl.GL;
-
/**
* Surf
*
@@ -64,7 +62,7 @@ public abstract class Surf extends Draw {
int c_visible_lightmaps;
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
{
@@ -154,7 +152,7 @@ public abstract class Surf extends Draw {
*/
void DrawGLPoly(glpoly_t p)
{
- gl.glBegin(GL.GL_POLYGON);
+ gl.glBegin(GL_POLYGON);
for (int i=0 ; i<p.numverts ; i++)
{
gl.glTexCoord2f(p.s1(i), p.t1(i));
@@ -176,7 +174,7 @@ public abstract class Surf extends Draw {
if(scroll == 0.0f)
scroll = -64.0f;
- gl.glBegin (GL.GL_POLYGON);
+ gl.glBegin (GL_POLYGON);
glpoly_t p = fa.polys;
for (int i=0 ; i<p.numverts ; i++)
{
@@ -196,8 +194,8 @@ 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++)
@@ -211,7 +209,7 @@ public abstract class Surf extends Draw {
{
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));
@@ -221,8 +219,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);
}
/*
@@ -234,7 +232,7 @@ public abstract class Surf extends Draw {
{
for ( ; p != null; p = p.chain )
{
- gl.glBegin(GL.GL_POLYGON);
+ gl.glBegin(GL_POLYGON);
for (int j=0 ; j<p.numverts ; j++)
{
gl.glTexCoord2f (p.s2(j), p.t2(j));
@@ -247,7 +245,7 @@ public abstract class Surf extends Draw {
{
for ( ; p != null; p = p.chain )
{
- gl.glBegin(GL.GL_POLYGON);
+ gl.glBegin(GL_POLYGON);
for (int j=0 ; j<p.numverts ; j++)
{
gl.glTexCoord2f (p.s2(j) - soffset, p.t2(j) - toffset);
@@ -285,11 +283,11 @@ public abstract class Surf extends Draw {
*/
if (gl_lightmap.value == 0)
{
- gl.glEnable(GL.GL_BLEND);
+ gl.glEnable(GL_BLEND);
if ( gl_saturatelighting.value != 0)
{
- gl.glBlendFunc( GL.GL_ONE, GL.GL_ONE );
+ gl.glBlendFunc( GL_ONE, GL_ONE );
}
else
{
@@ -299,20 +297,20 @@ public abstract class Surf extends Draw {
switch ( format )
{
case 'I':
- gl.glBlendFunc(GL.GL_ZERO, GL.GL_SRC_COLOR );
+ gl.glBlendFunc(GL_ZERO, GL_SRC_COLOR );
break;
case 'L':
- gl.glBlendFunc(GL.GL_ZERO, GL.GL_SRC_COLOR );
+ gl.glBlendFunc(GL_ZERO, GL_SRC_COLOR );
break;
case 'A':
default:
- gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA );
+ gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
break;
}
}
else
{
- gl.glBlendFunc(GL.GL_ZERO, GL.GL_SRC_COLOR );
+ gl.glBlendFunc(GL_ZERO, GL_SRC_COLOR );
}
}
}
@@ -432,8 +430,8 @@ public abstract class Surf extends Draw {
/*
** restore state
*/
- gl.glDisable(GL.GL_BLEND);
- gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
+ gl.glDisable(GL_BLEND);
+ gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl.glDepthMask( true );
}
@@ -459,20 +457,20 @@ 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 );
}
// ======
@@ -528,11 +526,11 @@ public abstract class Surf extends Draw {
GL_Bind( gl_state.lightmap_textures + fa.lightmaptexturenum );
- gl.glTexSubImage2D( GL.GL_TEXTURE_2D, 0,
+ gl.glTexSubImage2D( GL_TEXTURE_2D, 0,
fa.light_s, fa.light_t,
smax, tmax,
GL_LIGHTMAP_FORMAT,
- GL.GL_UNSIGNED_BYTE, temp2 );
+ GL_UNSIGNED_BYTE, temp2 );
fa.lightmapchain = gl_lms.lightmap_surfaces[fa.lightmaptexturenum];
gl_lms.lightmap_surfaces[fa.lightmaptexturenum] = fa;
@@ -568,10 +566,11 @@ public abstract class Surf extends Draw {
//
// go back to the world matrix
//
- gl.glLoadMatrixf(r_world_matrix);
+ r_world_matrix.clear();
+ 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
@@ -595,9 +594,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;
}
@@ -674,7 +673,7 @@ public abstract class Surf extends Draw {
}
}
- GL_TexEnv( GL.GL_REPLACE );
+ GL_TexEnv( GL_REPLACE );
}
// direct buffer
@@ -734,11 +733,11 @@ public abstract class Surf extends Draw {
lmtex = surf.lightmaptexturenum;
- gl.glTexSubImage2D( GL.GL_TEXTURE_2D, 0,
+ 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
@@ -752,11 +751,11 @@ public abstract class Surf extends Draw {
lmtex = 0;
- gl.glTexSubImage2D( GL.GL_TEXTURE_2D, 0,
+ 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 );
}
@@ -777,11 +776,11 @@ public abstract class Surf extends Draw {
for ( p = surf.polys; p != null; p = p.chain )
{
- gl.glBegin (GL.GL_POLYGON);
+ gl.glBegin (GL_POLYGON);
for (i=0 ; i< nv; i++)
{
- gl.glMultiTexCoord2fARB(GL_TEXTURE0, p.s1(i) + scroll, p.t1(i));
- gl.glMultiTexCoord2fARB(GL_TEXTURE1, p.s2(i), p.t2(i));
+ gl.glMultiTexCoord2f(GL_TEXTURE0, p.s1(i) + scroll, p.t1(i));
+ gl.glMultiTexCoord2f(GL_TEXTURE1, p.s2(i), p.t2(i));
//gglMTexCoord2fSGIS( GL_TEXTURE0, v[3] + scroll, v[4]);
//gglMTexCoord2fSGIS( GL_TEXTURE1, v[5], v[6]);
gl.glVertex3f(p.x(i), p.y(i), p.z(i));
@@ -793,11 +792,11 @@ public abstract class Surf extends Draw {
{
for ( p = surf.polys; p != null; p = p.chain )
{
- gl.glBegin (GL.GL_POLYGON);
+ gl.glBegin (GL_POLYGON);
for (i=0 ; i< nv; i++)
{
- gl.glMultiTexCoord2fARB(GL_TEXTURE0, p.s1(i), p.t1(i));
- gl.glMultiTexCoord2fARB(GL_TEXTURE1, p.s2(i), p.t2(i));
+ gl.glMultiTexCoord2f(GL_TEXTURE0, p.s1(i), p.t1(i));
+ gl.glMultiTexCoord2f(GL_TEXTURE1, p.s2(i), p.t2(i));
//gglMTexCoord2fSGIS( GL_TEXTURE0, v[3], v[4]);
//gglMTexCoord2fSGIS( GL_TEXTURE1, v[5], v[6]);
gl.glVertex3f(p.x(i), p.y(i), p.z(i));
@@ -827,11 +826,11 @@ public abstract class Surf extends Draw {
for ( p = surf.polys; p != null; p = p.chain )
{
- gl.glBegin(GL.GL_POLYGON);
+ gl.glBegin(GL_POLYGON);
for (i=0 ; i< nv; i++)
{
- gl.glMultiTexCoord2fARB(GL_TEXTURE0, p.s1(i) + scroll, p.t1(i));
- gl.glMultiTexCoord2fARB(GL_TEXTURE1, p.s2(i), p.t2(i));
+ gl.glMultiTexCoord2f(GL_TEXTURE0, p.s1(i) + scroll, p.t1(i));
+ gl.glMultiTexCoord2f(GL_TEXTURE1, p.s2(i), p.t2(i));
//gglMTexCoord2fSGIS( GL_TEXTURE0, v[3] + scroll, v[4]);
//gglMTexCoord2fSGIS( GL_TEXTURE1, v[5], v[6]);
gl.glVertex3f(p.x(i), p.y(i), p.z(i));
@@ -845,11 +844,11 @@ public abstract class Surf extends Draw {
// ==========
for ( p = surf.polys; p != null; p = p.chain )
{
- gl.glBegin (GL.GL_POLYGON);
+ gl.glBegin (GL_POLYGON);
for (i=0 ; i< nv; i++)
{
- gl.glMultiTexCoord2fARB(GL_TEXTURE0, p.s1(i), p.t1(i));
- gl.glMultiTexCoord2fARB(GL_TEXTURE1, p.s2(i), p.t2(i));
+ gl.glMultiTexCoord2f(GL_TEXTURE0, p.s1(i), p.t1(i));
+ gl.glMultiTexCoord2f(GL_TEXTURE1, p.s2(i), p.t2(i));
//gglMTexCoord2fSGIS( GL_TEXTURE0, v[3], v[4]);
//gglMTexCoord2fSGIS( GL_TEXTURE1, v[5], v[6]);
gl.glVertex3f(p.x(i), p.y(i), p.z(i));
@@ -895,9 +894,9 @@ public abstract class Surf extends Draw {
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 );
}
//
@@ -940,9 +939,9 @@ public abstract class Surf extends Draw {
}
else
{
- gl.glDisable (GL.GL_BLEND);
+ gl.glDisable (GL_BLEND);
gl.glColor4f (1,1,1,1);
- GL_TexEnv( GL.GL_REPLACE );
+ GL_TexEnv( GL_REPLACE );
}
}
@@ -1017,9 +1016,9 @@ public abstract class Surf extends Draw {
GL_EnableMultitexture( true );
GL_SelectTexture(GL_TEXTURE0);
- GL_TexEnv( GL.GL_REPLACE );
+ GL_TexEnv( GL_REPLACE );
GL_SelectTexture(GL_TEXTURE1);
- GL_TexEnv( GL.GL_MODULATE );
+ GL_TexEnv( GL_MODULATE );
R_DrawInlineBModel();
GL_EnableMultitexture( false );
@@ -1201,13 +1200,13 @@ public abstract class Surf extends Draw {
GL_EnableMultitexture( true );
GL_SelectTexture( GL_TEXTURE0);
- GL_TexEnv( GL.GL_REPLACE );
+ GL_TexEnv( GL_REPLACE );
GL_SelectTexture( GL_TEXTURE1);
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
@@ -1343,9 +1342,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;
@@ -1356,23 +1356,23 @@ public abstract class Surf extends Draw {
height = gl_lms.allocated[i];
}
- gl.glTexSubImage2D( GL.GL_TEXTURE_2D,
+ gl.glTexSubImage2D( GL_TEXTURE_2D,
0,
0, 0,
BLOCK_WIDTH, height,
GL_LIGHTMAP_FORMAT,
- GL.GL_UNSIGNED_BYTE,
+ GL_UNSIGNED_BYTE,
gl_lms.lightmap_buffer );
}
else
{
- gl.glTexImage2D( GL.GL_TEXTURE_2D,
+ gl.glTexImage2D( GL_TEXTURE_2D,
0,
gl_lms.internal_format,
BLOCK_WIDTH, BLOCK_HEIGHT,
0,
GL_LIGHTMAP_FORMAT,
- GL.GL_UNSIGNED_BYTE,
+ 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" );
@@ -1549,7 +1549,7 @@ public abstract class Surf extends Draw {
}
lightstyle_t[] lightstyles;
-
+ private final IntBuffer dummy = Lib.newIntBuffer(128*128);
/*
==================
GL_BeginBuildingLightmaps
@@ -1560,8 +1560,6 @@ public abstract class Surf extends Draw {
{
// static lightstyle_t lightstyles[MAX_LIGHTSTYLES];
int i;
- int[] dummy = new int[128*128];
-
// init lightstyles
if ( lightstyles == null ) {
lightstyles = new lightstyle_t[Defines.MAX_LIGHTSTYLES];
@@ -1628,11 +1626,11 @@ public abstract class Surf extends Draw {
}
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
{
@@ -1643,15 +1641,15 @@ 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,
+ 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,
+ GL_UNSIGNED_BYTE,
dummy );
}
diff --git a/src/jake2/render/jogl/Warp.java b/src/jake2/render/jogl/Warp.java
index 7ad3b64..7ea3d39 100644
--- a/src/jake2/render/jogl/Warp.java
+++ b/src/jake2/render/jogl/Warp.java
@@ -2,7 +2,7 @@
* Warp.java
* Copyright (C) 2003
*
- * $Id: Warp.java,v 1.9 2005-01-10 00:05:23 cawe Exp $
+ * $Id: Warp.java,v 1.9.6.1 2005-07-16 18:25:37 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -30,7 +30,6 @@ import jake2.Globals;
import jake2.qcommon.Com;
import jake2.render.*;
import jake2.util.Math3D;
-import net.java.games.jogl.GL;
/**
* Warp
@@ -293,7 +292,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 (i = 0; i < p.numverts; i++) {
os = p.s1(i);
ot = p.t1(i);
@@ -605,7 +604,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);