aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2')
-rw-r--r--src/jake2/render/lwjgl/Base.java155
-rw-r--r--src/jake2/render/lwjgl/Draw.java192
-rw-r--r--src/jake2/render/lwjgl/Image.java146
-rw-r--r--src/jake2/render/lwjgl/LWJGLBase.java44
-rw-r--r--src/jake2/render/lwjgl/Light.java36
-rw-r--r--src/jake2/render/lwjgl/Main.java382
-rw-r--r--src/jake2/render/lwjgl/Mesh.java104
-rw-r--r--src/jake2/render/lwjgl/Misc.java68
-rw-r--r--src/jake2/render/lwjgl/Model.java11
-rw-r--r--src/jake2/render/lwjgl/Surf.java181
-rw-r--r--src/jake2/render/lwjgl/Warp.java28
11 files changed, 662 insertions, 685 deletions
diff --git a/src/jake2/render/lwjgl/Base.java b/src/jake2/render/lwjgl/Base.java
index b536298..016c66f 100644
--- a/src/jake2/render/lwjgl/Base.java
+++ b/src/jake2/render/lwjgl/Base.java
@@ -2,7 +2,7 @@
* Base.java
* Copyright (C) 2003
*
- * $Id: Base.java,v 1.4 2005-06-08 21:24:52 cawe Exp $
+ * $Id: Base.java,v 1.4.4.1 2005-07-10 17:55:51 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -25,28 +25,32 @@
*/
package jake2.render.lwjgl;
-import org.lwjgl.opengl.GL11;
+import jake2.client.viddef_t;
+import jake2.game.cvar_t;
+import jake2.render.QGL;
+
+import java.awt.Dimension;
/**
* Base
*
* @author dsanders/cwei
*/
-public abstract class Base extends LWJGLBase {
-
- static final int GL_COLOR_INDEX8_EXT = GL11.GL_COLOR_INDEX;
-
+public abstract class Base extends QGL {
+
+ static final int GL_COLOR_INDEX8_EXT = GL_COLOR_INDEX;
+
static final String REF_VERSION = "GL 0.01";
-
+
// up / down
static final int PITCH = 0;
-
+
// left / right
static final int YAW = 1;
-
+
// fall over
static final int ROLL = 2;
-
+
/*
* skins will be outline flood filled and mip mapped pics and sprites with
* alpha will be outline flood filled pic won't be mip mapped
@@ -55,100 +59,139 @@ public abstract class Base extends LWJGLBase {
*/
// enum imagetype_t
static final int it_skin = 0;
-
+
static final int it_sprite = 1;
-
+
static final int it_wall = 2;
-
+
static final int it_pic = 3;
-
+
static final int it_sky = 4;
-
+
// enum modtype_t
static final int mod_bad = 0;
-
+
static final int mod_brush = 1;
-
+
static final int mod_sprite = 2;
-
+
static final int mod_alias = 3;
-
+
static final int TEXNUM_LIGHTMAPS = 1024;
-
+
static final int TEXNUM_SCRAPS = 1152;
-
+
static final int TEXNUM_IMAGES = 1153;
-
+
static final int MAX_GLTEXTURES = 1024;
-
+
static final int MAX_LBM_HEIGHT = 480;
-
+
static final float BACKFACE_EPSILON = 0.01f;
-
+
/*
* * GL config stuff
*/
static final int GL_RENDERER_VOODOO = 0x00000001;
-
+
static final int GL_RENDERER_VOODOO2 = 0x00000002;
-
+
static final int GL_RENDERER_VOODOO_RUSH = 0x00000004;
-
+
static final int GL_RENDERER_BANSHEE = 0x00000008;
-
+
static final int GL_RENDERER_3DFX = 0x0000000F;
-
+
static final int GL_RENDERER_PCX1 = 0x00000010;
-
+
static final int GL_RENDERER_PCX2 = 0x00000020;
-
+
static final int GL_RENDERER_PMX = 0x00000040;
-
+
static final int GL_RENDERER_POWERVR = 0x00000070;
-
+
static final int GL_RENDERER_PERMEDIA2 = 0x00000100;
-
+
static final int GL_RENDERER_GLINT_MX = 0x00000200;
-
+
static final int GL_RENDERER_GLINT_TX = 0x00000400;
-
+
static final int GL_RENDERER_3DLABS_MISC = 0x00000800;
-
+
static final int GL_RENDERER_3DLABS = 0x00000F00;
-
+
static final int GL_RENDERER_REALIZM = 0x00001000;
-
+
static final int GL_RENDERER_REALIZM2 = 0x00002000;
-
+
static final int GL_RENDERER_INTERGRAPH = 0x00003000;
-
+
static final int GL_RENDERER_3DPRO = 0x00004000;
-
+
static final int GL_RENDERER_REAL3D = 0x00008000;
-
+
static final int GL_RENDERER_RIVA128 = 0x00010000;
-
+
static final int GL_RENDERER_DYPIC = 0x00020000;
-
+
static final int GL_RENDERER_V1000 = 0x00040000;
-
+
static final int GL_RENDERER_V2100 = 0x00080000;
-
+
static final int GL_RENDERER_V2200 = 0x00100000;
-
+
static final int GL_RENDERER_RENDITION = 0x001C0000;
-
+
static final int GL_RENDERER_O2 = 0x00100000;
-
+
static final int GL_RENDERER_IMPACT = 0x00200000;
-
+
static final int GL_RENDERER_RE = 0x00400000;
-
+
static final int GL_RENDERER_IR = 0x00800000;
-
+
static final int GL_RENDERER_SGI = 0x00F00000;
-
+
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;
+
+ // 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/lwjgl/Draw.java b/src/jake2/render/lwjgl/Draw.java
index 7329191..707dd09 100644
--- a/src/jake2/render/lwjgl/Draw.java
+++ b/src/jake2/render/lwjgl/Draw.java
@@ -2,7 +2,7 @@
* Draw.java
* Copyright (C) 2003
*
- * $Id: Draw.java,v 1.2 2004-12-14 12:56:59 cawe Exp $
+ * $Id: Draw.java,v 1.2.8.1 2005-07-10 17:55:50 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -29,14 +29,12 @@ 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 java.nio.ByteBuffer;
import java.nio.IntBuffer;
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.GL11;
-
/**
* Draw
* (gl_draw.c)
@@ -54,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(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
/*
@@ -84,16 +82,16 @@ public abstract class Draw extends Image {
GL_Bind(draw_chars.texnum);
- gl.glBegin (GL11.GL_QUADS);
- gl.glTexCoord2f (fcol, frow);
- gl.glVertex2f (x, y);
- gl.glTexCoord2f (fcol + size, frow);
- gl.glVertex2f (x+8, y);
- gl.glTexCoord2f (fcol + size, frow + size);
- gl.glVertex2f (x+8, y+8);
- gl.glTexCoord2f (fcol, frow + size);
- gl.glVertex2f (x, y+8);
- gl.glEnd ();
+ glBegin (GL_QUADS);
+ glTexCoord2f (fcol, frow);
+ glVertex2f (x, y);
+ glTexCoord2f (fcol + size, frow);
+ glVertex2f (x+8, y);
+ glTexCoord2f (fcol + size, frow + size);
+ glVertex2f (x+8, y+8);
+ glTexCoord2f (fcol, frow + size);
+ glVertex2f (x, y+8);
+ glEnd ();
}
@@ -149,22 +147,22 @@ 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(GL11.GL_ALPHA_TEST);
+ glDisable(GL_ALPHA_TEST);
GL_Bind(image.texnum);
- gl.glBegin (GL11.GL_QUADS);
- gl.glTexCoord2f (image.sl, image.tl);
- gl.glVertex2f (x, y);
- gl.glTexCoord2f (image.sh, image.tl);
- gl.glVertex2f (x+w, y);
- gl.glTexCoord2f (image.sh, image.th);
- gl.glVertex2f (x+w, y+h);
- gl.glTexCoord2f (image.sl, image.th);
- gl.glVertex2f (x, y+h);
- gl.glEnd ();
+ glBegin (GL_QUADS);
+ glTexCoord2f (image.sl, image.tl);
+ glVertex2f (x, y);
+ glTexCoord2f (image.sh, image.tl);
+ glVertex2f (x+w, y);
+ glTexCoord2f (image.sh, image.th);
+ glVertex2f (x+w, y+h);
+ glTexCoord2f (image.sl, image.th);
+ glVertex2f (x, y+h);
+ glEnd ();
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) !=0 ) ) && !image.has_alpha)
- gl.glEnable(GL11.GL_ALPHA_TEST);
+ glEnable(GL_ALPHA_TEST);
}
@@ -187,23 +185,23 @@ 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 (GL11.GL_ALPHA_TEST);
+ glDisable (GL_ALPHA_TEST);
GL_Bind(image.texnum);
- gl.glBegin (GL11.GL_QUADS);
- gl.glTexCoord2f (image.sl, image.tl);
- gl.glVertex2f (x, y);
- gl.glTexCoord2f (image.sh, image.tl);
- gl.glVertex2f (x+image.width, y);
- gl.glTexCoord2f (image.sh, image.th);
- gl.glVertex2f (x+image.width, y+image.height);
- gl.glTexCoord2f (image.sl, image.th);
- gl.glVertex2f (x, y+image.height);
- gl.glEnd ();
+ glBegin (GL_QUADS);
+ glTexCoord2f (image.sl, image.tl);
+ glVertex2f (x, y);
+ glTexCoord2f (image.sh, image.tl);
+ glVertex2f (x+image.width, y);
+ glTexCoord2f (image.sh, image.th);
+ glVertex2f (x+image.width, y+image.height);
+ glTexCoord2f (image.sl, image.th);
+ glVertex2f (x, y+image.height);
+ glEnd ();
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha)
- gl.glEnable (GL11.GL_ALPHA_TEST);
+ glEnable (GL_ALPHA_TEST);
}
/*
@@ -225,22 +223,22 @@ 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(GL11.GL_ALPHA_TEST);
+ glDisable(GL_ALPHA_TEST);
GL_Bind(image.texnum);
- gl.glBegin (GL11.GL_QUADS);
- gl.glTexCoord2f(x/64.0f, y/64.0f);
- gl.glVertex2f (x, y);
- gl.glTexCoord2f( (x+w)/64.0f, y/64.0f);
- gl.glVertex2f(x+w, y);
- gl.glTexCoord2f( (x+w)/64.0f, (y+h)/64.0f);
- gl.glVertex2f(x+w, y+h);
- gl.glTexCoord2f( x/64.0f, (y+h)/64.0f );
- gl.glVertex2f (x, y+h);
- gl.glEnd ();
+ glBegin (GL_QUADS);
+ glTexCoord2f(x/64.0f, y/64.0f);
+ glVertex2f (x, y);
+ glTexCoord2f( (x+w)/64.0f, y/64.0f);
+ glVertex2f(x+w, y);
+ glTexCoord2f( (x+w)/64.0f, (y+h)/64.0f);
+ glVertex2f(x+w, y+h);
+ glTexCoord2f( x/64.0f, (y+h)/64.0f );
+ glVertex2f (x, y+h);
+ glEnd ();
if ( ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) ) && !image.has_alpha)
- gl.glEnable(GL11.GL_ALPHA_TEST);
+ glEnable(GL_ALPHA_TEST);
}
@@ -256,26 +254,26 @@ public abstract class Draw extends Image {
if ( colorIndex > 255)
Com.Error(Defines.ERR_FATAL, "Draw_Fill: bad color");
- gl.glDisable(GL11.GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_2D);
int color = d_8to24table[colorIndex];
- gl.glColor3ub(
+ glColor3ub(
(byte)((color >> 0) & 0xff), // r
(byte)((color >> 8) & 0xff), // g
(byte)((color >> 16) & 0xff) // b
);
- gl.glBegin (GL11.GL_QUADS);
+ glBegin (GL_QUADS);
- gl.glVertex2f(x,y);
- gl.glVertex2f(x+w, y);
- gl.glVertex2f(x+w, y+h);
- gl.glVertex2f(x, y+h);
+ glVertex2f(x,y);
+ glVertex2f(x+w, y);
+ glVertex2f(x+w, y+h);
+ glVertex2f(x, y+h);
- gl.glEnd();
- gl.glColor3f(1,1,1);
- gl.glEnable(GL11.GL_TEXTURE_2D);
+ glEnd();
+ glColor3f(1,1,1);
+ glEnable(GL_TEXTURE_2D);
}
//=============================================================================
@@ -286,26 +284,26 @@ public abstract class Draw extends Image {
================
*/
protected void Draw_FadeScreen() {
- gl.glEnable(GL11.GL_BLEND);
- gl.glDisable(GL11.GL_TEXTURE_2D);
- gl.glColor4f(0, 0, 0, 0.8f);
- gl.glBegin(GL11.GL_QUADS);
-
- gl.glVertex2f(0,0);
- gl.glVertex2f(vid.width, 0);
- gl.glVertex2f(vid.width, vid.height);
- gl.glVertex2f(0, vid.height);
-
- gl.glEnd();
- gl.glColor4f(1,1,1,1);
- gl.glEnable(GL11.GL_TEXTURE_2D);
- gl.glDisable(GL11.GL_BLEND);
+ glEnable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glColor4f(0, 0, 0, 0.8f);
+ glBegin(GL_QUADS);
+
+ glVertex2f(0,0);
+ glVertex2f(vid.width, 0);
+ glVertex2f(vid.width, vid.height);
+ glVertex2f(0, vid.height);
+
+ glEnd();
+ glColor4f(1,1,1,1);
+ glEnable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
}
// ====================================================================
- IntBuffer image32=BufferUtils.createIntBuffer(256*256);
- ByteBuffer image8=BufferUtils.createByteBuffer(256*256);
+ IntBuffer image32=Lib.newIntBuffer(256*256);
+ ByteBuffer image8=Lib.newByteBuffer(256*256);
/*
@@ -357,7 +355,7 @@ public abstract class Draw extends Image {
frac += fracstep;
}
}
- gl.glTexImage2D (GL11.GL_TEXTURE_2D, 0, gl_tex_solid_format, 256, 256, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, image32);
+ glTexImage2D (GL_TEXTURE_2D, 0, gl_tex_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, image32);
}
else
{
@@ -381,34 +379,34 @@ public abstract class Draw extends Image {
}
}
- gl.glTexImage2D( GL11.GL_TEXTURE_2D,
+ glTexImage2D( GL_TEXTURE_2D,
0,
GL_COLOR_INDEX8_EXT,
256, 256,
0,
- GL11.GL_COLOR_INDEX,
- GL11.GL_UNSIGNED_BYTE,
+ GL_COLOR_INDEX,
+ GL_UNSIGNED_BYTE,
image8 );
}
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ 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 (GL11.GL_ALPHA_TEST);
-
- gl.glBegin (GL11.GL_QUADS);
- gl.glTexCoord2f (0, 0);
- gl.glVertex2f (x, y);
- gl.glTexCoord2f (1, 0);
- gl.glVertex2f (x+w, y);
- gl.glTexCoord2f (1, t);
- gl.glVertex2f (x+w, y+h);
- gl.glTexCoord2f (0, t);
- gl.glVertex2f (x, y+h);
- gl.glEnd ();
+ glDisable (GL_ALPHA_TEST);
+
+ glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (x, y);
+ glTexCoord2f (1, 0);
+ glVertex2f (x+w, y);
+ glTexCoord2f (1, t);
+ glVertex2f (x+w, y+h);
+ glTexCoord2f (0, t);
+ glVertex2f (x, y+h);
+ glEnd ();
if ( ( gl_config.renderer == GL_RENDERER_MCD ) || ( (gl_config.renderer & GL_RENDERER_RENDITION) != 0 ) )
- gl.glEnable (GL11.GL_ALPHA_TEST);
+ glEnable (GL_ALPHA_TEST);
}
}
diff --git a/src/jake2/render/lwjgl/Image.java b/src/jake2/render/lwjgl/Image.java
index 0642f96..6bbb328 100644
--- a/src/jake2/render/lwjgl/Image.java
+++ b/src/jake2/render/lwjgl/Image.java
@@ -2,7 +2,7 @@
* Image.java
* Copyright (C) 2003
*
- * $Id: Image.java,v 1.3 2005-05-07 17:31:37 cawe Exp $
+ * $Id: Image.java,v 1.3.6.1 2005-07-10 17:55:51 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -41,10 +41,6 @@ import java.awt.image.BufferedImage;
import java.nio.*;
import java.util.Arrays;
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.EXTSharedTexturePalette;
-import org.lwjgl.opengl.GL11;
-
/**
* Image
*
@@ -75,8 +71,8 @@ public abstract class Image extends Main {
int gl_tex_solid_format = 3;
int gl_tex_alpha_format = 4;
- int gl_filter_min = GL11.GL_LINEAR_MIPMAP_NEAREST;
- int gl_filter_max = GL11.GL_LINEAR;
+ int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
+ int gl_filter_max = GL_LINEAR;
Image() {
// init the texture cache
@@ -96,36 +92,36 @@ public abstract class Image extends Main {
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f)
{
- ByteBuffer temptable=BufferUtils.createByteBuffer(768);
+ ByteBuffer temptable = Lib.newByteBuffer(768);
for (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.glColorTable(EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT, GL11.GL_RGB, 256, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, temptable);
+ 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(GL11.GL_TEXTURE_2D);
- GL_TexEnv(GL11.GL_REPLACE);
+ GL_SelectTexture(TEXTURE1);
+ glEnable(GL_TEXTURE_2D);
+ GL_TexEnv(GL_REPLACE);
}
else {
- GL_SelectTexture(GL_TEXTURE1);
- gl.glDisable(GL11.GL_TEXTURE_2D);
- GL_TexEnv(GL11.GL_REPLACE);
+ GL_SelectTexture(TEXTURE1);
+ glDisable(GL_TEXTURE_2D);
+ GL_TexEnv(GL_REPLACE);
}
- GL_SelectTexture(GL_TEXTURE0);
- GL_TexEnv(GL11.GL_REPLACE);
+ GL_SelectTexture(TEXTURE0);
+ GL_TexEnv(GL_REPLACE);
}
void GL_SelectTexture(int texture /* GLenum */) {
int tmu;
- tmu = (texture == GL_TEXTURE0) ? 0 : 1;
+ tmu = (texture == TEXTURE0) ? 0 : 1;
if (tmu == gl_state.currenttmu) {
return;
@@ -133,8 +129,8 @@ public abstract class Image extends Main {
gl_state.currenttmu = tmu;
- gl.glActiveTextureARB(texture);
- gl.glClientActiveTextureARB(texture);
+ glActiveTextureARB(texture);
+ glClientActiveTextureARB(texture);
}
int[] lastmodes = { -1, -1 };
@@ -143,7 +139,7 @@ public abstract class Image extends Main {
) {
if (mode != lastmodes[gl_state.currenttmu]) {
- gl.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, mode);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode);
lastmodes[gl_state.currenttmu] = mode;
}
}
@@ -158,12 +154,12 @@ public abstract class Image extends Main {
return;
gl_state.currenttextures[gl_state.currenttmu] = texnum;
- gl.glBindTexture(GL11.GL_TEXTURE_2D, texnum);
+ glBindTexture(GL_TEXTURE_2D, texnum);
}
void GL_MBind(int target /* GLenum */, int texnum) {
GL_SelectTexture(target);
- if (target == GL_TEXTURE0) {
+ if (target == TEXTURE0) {
if (gl_state.currenttextures[0] == texnum)
return;
}
@@ -188,12 +184,12 @@ public abstract class Image extends Main {
static final glmode_t modes[] =
{
- new glmode_t("GL_NEAREST", GL11.GL_NEAREST, GL11.GL_NEAREST),
- new glmode_t("GL_LINEAR", GL11.GL_LINEAR, GL11.GL_LINEAR),
- new glmode_t("GL_NEAREST_MIPMAP_NEAREST", GL11.GL_NEAREST_MIPMAP_NEAREST, GL11.GL_NEAREST),
- new glmode_t("GL_LINEAR_MIPMAP_NEAREST", GL11.GL_LINEAR_MIPMAP_NEAREST, GL11.GL_LINEAR),
- new glmode_t("GL_NEAREST_MIPMAP_LINEAR", GL11.GL_NEAREST_MIPMAP_LINEAR, GL11.GL_NEAREST),
- new glmode_t("GL_LINEAR_MIPMAP_LINEAR", GL11.GL_LINEAR_MIPMAP_LINEAR, GL11.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_NEAREST_MIPMAP_NEAREST, GL_NEAREST),
+ new glmode_t("GL_LINEAR_MIPMAP_NEAREST", GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR),
+ new glmode_t("GL_NEAREST_MIPMAP_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;
@@ -211,11 +207,11 @@ public abstract class Image extends Main {
static final gltmode_t[] gl_alpha_modes =
{
new gltmode_t("default", 4),
- new gltmode_t("GL_RGBA", GL11.GL_RGBA),
- new gltmode_t("GL_RGBA8", GL11.GL_RGBA8),
- new gltmode_t("GL_RGB5_A1", GL11.GL_RGB5_A1),
- new gltmode_t("GL_RGBA4", GL11.GL_RGBA4),
- new gltmode_t("GL_RGBA2", GL11.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;
@@ -223,11 +219,11 @@ public abstract class Image extends Main {
static final gltmode_t[] gl_solid_modes =
{
new gltmode_t("default", 3),
- new gltmode_t("GL_RGB", GL11.GL_RGB),
- new gltmode_t("GL_RGB8", GL11.GL_RGB8),
- new gltmode_t("GL_RGB5", GL11.GL_RGB5),
- new gltmode_t("GL_RGB4", GL11.GL_RGB4),
- new gltmode_t("GL_R3_G3_B2", GL11.GL_R3_G3_B2),
+ 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),
// #ifdef GL_RGB2_EXT
//new gltmode_t("GL_RGB2", GL.GL_RGB2_EXT)
// #endif
@@ -263,8 +259,8 @@ public abstract class Image extends Main {
if (glt.type != it_pic && glt.type != it_sky) {
GL_Bind(glt.texnum);
- gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min);
- gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
}
}
@@ -1054,7 +1050,7 @@ public abstract class Image extends Main {
*/
int[] scaled = new int[256 * 256];
//byte[] paletted_texture = new byte[256 * 256];
- ByteBuffer paletted_texture=BufferUtils.createByteBuffer(256*256);
+ ByteBuffer paletted_texture = Lib.newByteBuffer(256*256);
IntBuffer tex = Lib.newIntBuffer(512 * 256, ByteOrder.LITTLE_ENDIAN);
boolean GL_Upload32(int[] data, int width, int height, boolean mipmap) {
@@ -1127,28 +1123,28 @@ public abstract class Image extends Main {
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && samples == gl_solid_format) {
uploaded_paletted = true;
GL_BuildPalettedTexture(paletted_texture, data, scaled_width, scaled_height);
- gl.glTexImage2D(
- GL11.GL_TEXTURE_2D,
+ glTexImage2D(
+ GL_TEXTURE_2D,
0,
GL_COLOR_INDEX8_EXT,
scaled_width,
scaled_height,
0,
- GL11.GL_COLOR_INDEX,
- GL11.GL_UNSIGNED_BYTE,
+ GL_COLOR_INDEX,
+ GL_UNSIGNED_BYTE,
paletted_texture);
}
else {
tex.rewind(); tex.put(data); tex.rewind();
- gl.glTexImage2D(
- GL11.GL_TEXTURE_2D,
+ glTexImage2D(
+ GL_TEXTURE_2D,
0,
comp,
scaled_width,
scaled_height,
0,
- GL11.GL_RGBA,
- GL11.GL_UNSIGNED_BYTE,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
tex);
}
//goto done;
@@ -1165,20 +1161,20 @@ public abstract class Image extends Main {
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && (samples == gl_solid_format)) {
uploaded_paletted = true;
GL_BuildPalettedTexture(paletted_texture, scaled, scaled_width, scaled_height);
- gl.glTexImage2D(
- GL11.GL_TEXTURE_2D,
+ glTexImage2D(
+ GL_TEXTURE_2D,
0,
GL_COLOR_INDEX8_EXT,
scaled_width,
scaled_height,
0,
- GL11.GL_COLOR_INDEX,
- GL11.GL_UNSIGNED_BYTE,
+ GL_COLOR_INDEX,
+ GL_UNSIGNED_BYTE,
paletted_texture);
}
else {
tex.rewind(); tex.put(scaled); tex.rewind();
- gl.glTexImage2D(GL11.GL_TEXTURE_2D, 0, comp, scaled_width, scaled_height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, comp, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex);
}
if (mipmap) {
@@ -1197,28 +1193,28 @@ public abstract class Image extends Main {
if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && samples == gl_solid_format) {
uploaded_paletted = true;
GL_BuildPalettedTexture(paletted_texture, scaled, scaled_width, scaled_height);
- gl.glTexImage2D(
- GL11.GL_TEXTURE_2D,
+ glTexImage2D(
+ GL_TEXTURE_2D,
miplevel,
GL_COLOR_INDEX8_EXT,
scaled_width,
scaled_height,
0,
- GL11.GL_COLOR_INDEX,
- GL11.GL_UNSIGNED_BYTE,
+ GL_COLOR_INDEX,
+ GL_UNSIGNED_BYTE,
paletted_texture);
}
else {
tex.rewind(); tex.put(scaled); tex.rewind();
- gl.glTexImage2D(
- GL11.GL_TEXTURE_2D,
+ glTexImage2D(
+ GL_TEXTURE_2D,
miplevel,
comp,
scaled_width,
scaled_height,
0,
- GL11.GL_RGBA,
- GL11.GL_UNSIGNED_BYTE,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
tex);
}
}
@@ -1230,12 +1226,12 @@ public abstract class Image extends Main {
}
if (mipmap) {
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
else {
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_max);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
return (samples == gl_alpha_format);
@@ -1261,10 +1257,10 @@ 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(GL11.GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL11.GL_COLOR_INDEX, GL11.GL_UNSIGNED_BYTE, ByteBuffer.wrap(data));
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, ByteBuffer.wrap(data));
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_max);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
// TODO check this
return false;
@@ -1539,7 +1535,7 @@ public abstract class Image extends Main {
return GL_FindImage(name, it_skin);
}
- IntBuffer texnumBuffer=BufferUtils.createIntBuffer(1);
+ IntBuffer texnumBuffer=Lib.newIntBuffer(1);
/*
================
@@ -1573,7 +1569,7 @@ public abstract class Image extends Main {
// TODO jogl bug
texnumBuffer.clear();
texnumBuffer.put(0,image.texnum);
- gl.glDeleteTextures(texnumBuffer);
+ glDeleteTextures(texnumBuffer);
image.clear();
}
}
@@ -1585,13 +1581,11 @@ public abstract class Image extends Main {
*/
protected void Draw_GetPalette() {
int r, g, b;
- Dimension dim;
- byte[] pic;
byte[][] palette = new byte[1][]; //new byte[768];
// get the palette
- pic = LoadPCX("pics/colormap.pcx", palette, dim = new Dimension());
+ LoadPCX("pics/colormap.pcx", palette, null);
if (palette[0] == null || palette[0].length != 768)
Com.Error(Defines.ERR_FATAL, "Couldn't load pics/colormap.pcx");
@@ -1685,7 +1679,7 @@ public abstract class Image extends Main {
// TODO jogl bug
texnumBuffer.clear();
texnumBuffer.put(0,image.texnum);
- gl.glDeleteTextures(texnumBuffer);
+ glDeleteTextures(texnumBuffer);
image.clear();
}
}
diff --git a/src/jake2/render/lwjgl/LWJGLBase.java b/src/jake2/render/lwjgl/LWJGLBase.java
index 0767453..a4e6ebe 100644
--- a/src/jake2/render/lwjgl/LWJGLBase.java
+++ b/src/jake2/render/lwjgl/LWJGLBase.java
@@ -2,7 +2,7 @@
* LWJGLBase.java
* Copyright (C) 2004
*
- * $Id: LWJGLBase.java,v 1.2 2004-12-20 21:51:18 cawe Exp $
+ * $Id: LWJGLBase.java,v 1.2.6.1 2005-07-10 17:55:51 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -27,8 +27,6 @@ package jake2.render.lwjgl;
import jake2.Defines;
import jake2.client.VID;
-import jake2.client.viddef_t;
-import jake2.game.cvar_t;
import jake2.qcommon.xcommand_t;
import java.awt.Dimension;
@@ -37,35 +35,21 @@ import java.util.LinkedList;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.util.GLImpl;
+
/**
* LWJGLBase
*
* @author dsanders/cwei
*/
-public abstract class LWJGLBase {
+public abstract class LWJGLBase extends Misc {
// IMPORTED FUNCTIONS
protected DisplayMode oldDisplayMode;
- protected GLImpl gl = new GLImpl();
-
// window position on the screen
int window_xpos, window_ypos;
- protected viddef_t vid = new viddef_t();
- // handles the post initialization with LWJGLRenderer
- protected abstract boolean R_Init2();
-
- protected cvar_t vid_fullscreen;
-
- // 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;
-
- private java.awt.DisplayMode toAwtDisplayMode(DisplayMode m)
+ private java.awt.DisplayMode toAwtDisplayMode(DisplayMode m)
{
return new java.awt.DisplayMode(m.getWidth(),m.getHeight(),m.getBitsPerPixel(),m.getFrequency());
}
@@ -293,26 +277,11 @@ public abstract class LWJGLBase {
}
protected void GLimp_EndFrame() {
- gl.glFlush();
+ glFlush();
// swap buffers
Display.update();
}
- 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
- }
/**
* this is a hack for jogl renderers.
@@ -320,5 +289,6 @@ public abstract class LWJGLBase {
*/
public final void updateScreen(xcommand_t callback) {
callback.execute();
- }
+ }
+
}
diff --git a/src/jake2/render/lwjgl/Light.java b/src/jake2/render/lwjgl/Light.java
index 9ffcd0b..7094370 100644
--- a/src/jake2/render/lwjgl/Light.java
+++ b/src/jake2/render/lwjgl/Light.java
@@ -2,7 +2,7 @@
* Light.java
* Copyright (C) 2003
*
- * $Id: Light.java,v 1.4 2005-05-07 17:21:42 cawe Exp $
+ * $Id: Light.java,v 1.4.6.1 2005-07-10 17:55:50 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 org.lwjgl.opengl.GL11;
-
/**
* Light
*
@@ -71,14 +69,14 @@ public abstract class Light extends Warp {
Math3D.VectorSubtract (light.origin, r_origin, v);
- gl.glBegin (GL11.GL_TRIANGLE_FAN);
- gl.glColor3f (light.color[0]*0.2f, light.color[1]*0.2f, light.color[2]*0.2f);
+ glBegin (GL_TRIANGLE_FAN);
+ glColor3f (light.color[0]*0.2f, light.color[1]*0.2f, light.color[2]*0.2f);
int i;
for (i=0 ; i<3 ; i++)
v[i] = light.origin[i] - vpn[i]*rad;
- gl.glVertex3f(v[0], v[1], v[2]);
- gl.glColor3f (0,0,0);
+ glVertex3f(v[0], v[1], v[2]);
+ glColor3f (0,0,0);
int j;
float a;
@@ -88,9 +86,9 @@ public abstract class Light extends Warp {
for (j=0 ; j<3 ; j++)
v[j] = (float)(light.origin[j] + vright[j]*Math.cos(a)*rad
+ vup[j]*Math.sin(a)*rad);
- gl.glVertex3f(v[0], v[1], v[2]);
+ glVertex3f(v[0], v[1], v[2]);
}
- gl.glEnd ();
+ glEnd ();
}
/**
@@ -103,22 +101,22 @@ 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(GL11.GL_TEXTURE_2D);
- gl.glShadeModel (GL11.GL_SMOOTH);
- gl.glEnable (GL11.GL_BLEND);
- gl.glBlendFunc (GL11.GL_ONE, GL11.GL_ONE);
+ glDepthMask(false);
+ glDisable(GL_TEXTURE_2D);
+ glShadeModel (GL_SMOOTH);
+ glEnable (GL_BLEND);
+ 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(GL11.GL_BLEND);
- gl.glEnable(GL11.GL_TEXTURE_2D);
- gl.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gl.glDepthMask(true);
+ glColor3f (1,1,1);
+ glDisable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glDepthMask(true);
}
diff --git a/src/jake2/render/lwjgl/Main.java b/src/jake2/render/lwjgl/Main.java
index 4d1bd73..243ac8c 100644
--- a/src/jake2/render/lwjgl/Main.java
+++ b/src/jake2/render/lwjgl/Main.java
@@ -2,7 +2,7 @@
* Main.java
* Copyright (C) 2003
*
- * $Id: Main.java,v 1.7 2005-05-07 18:23:25 cawe Exp $
+ * $Id: Main.java,v 1.7.6.1 2005-07-10 17:55:50 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -27,34 +27,16 @@ package jake2.render.lwjgl;
import jake2.Defines;
import jake2.Globals;
-import jake2.client.VID;
-import jake2.client.entity_t;
-import jake2.client.particle_t;
-import jake2.client.refdef_t;
-import jake2.game.Cmd;
-import jake2.game.cplane_t;
-import jake2.game.cvar_t;
-import jake2.qcommon.Com;
-import jake2.qcommon.Cvar;
-import jake2.qcommon.qfiles;
-import jake2.qcommon.xcommand_t;
-import jake2.render.glconfig_t;
-import jake2.render.glstate_t;
-import jake2.render.image_t;
-import jake2.render.mleaf_t;
-import jake2.render.model_t;
-import jake2.util.Math3D;
-import jake2.util.Vargs;
+import jake2.client.*;
+import jake2.game.*;
+import jake2.qcommon.*;
+import jake2.render.*;
+import jake2.util.*;
import java.awt.Dimension;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.ARBMultitexture;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL13;
-
/**
* Main
*
@@ -123,8 +105,8 @@ public abstract class Main extends Base {
====================================================================
*/
- int GL_TEXTURE0 = GL13.GL_TEXTURE0;
- int GL_TEXTURE1 = GL13.GL_TEXTURE1;
+ int TEXTURE0 = GL_TEXTURE0;
+ int TEXTURE1 = GL_TEXTURE1;
model_t r_worldmodel;
@@ -157,7 +139,7 @@ public abstract class Main extends Base {
float[] r_origin = { 0, 0, 0 };
//float r_world_matrix[] = new float[16];
- FloatBuffer r_world_matrix=BufferUtils.createFloatBuffer(16);
+ FloatBuffer r_world_matrix = Lib.newFloatBuffer(16);
float r_base_world_matrix[] = new float[16];
@@ -258,11 +240,11 @@ public abstract class Main extends Base {
* R_RotateForEntity
*/
final void R_RotateForEntity(entity_t e) {
- gl.glTranslatef(e.origin[0], e.origin[1], e.origin[2]);
+ glTranslatef(e.origin[0], e.origin[1], e.origin[2]);
- gl.glRotatef(e.angles[1], 0, 0, 1);
- gl.glRotatef(-e.angles[0], 0, 1, 0);
- gl.glRotatef(-e.angles[2], 1, 0, 0);
+ glRotatef(e.angles[1], 0, 0, 1);
+ glRotatef(-e.angles[0], 0, 1, 0);
+ glRotatef(-e.angles[2], 1, 0, 0);
}
/*
@@ -297,50 +279,50 @@ public abstract class Main extends Base {
alpha = e.alpha;
if (alpha != 1.0F)
- gl.glEnable(GL11.GL_BLEND);
+ glEnable(GL_BLEND);
- gl.glColor4f(1, 1, 1, alpha);
+ glColor4f(1, 1, 1, alpha);
GL_Bind(currentmodel.skins[e.frame].texnum);
- GL_TexEnv(GL11.GL_MODULATE);
+ GL_TexEnv(GL_MODULATE);
if (alpha == 1.0)
- gl.glEnable(GL11.GL_ALPHA_TEST);
+ glEnable(GL_ALPHA_TEST);
else
- gl.glDisable(GL11.GL_ALPHA_TEST);
+ glDisable(GL_ALPHA_TEST);
- gl.glBegin(GL11.GL_QUADS);
+ glBegin(GL_QUADS);
- gl.glTexCoord2f(0, 1);
+ glTexCoord2f(0, 1);
Math3D.VectorMA(e.origin, -frame.origin_y, vup, point);
Math3D.VectorMA(point, -frame.origin_x, vright, point);
- gl.glVertex3f(point[0], point[1], point[2]);
+ glVertex3f(point[0], point[1], point[2]);
- gl.glTexCoord2f(0, 0);
+ glTexCoord2f(0, 0);
Math3D.VectorMA(e.origin, frame.height - frame.origin_y, vup, point);
Math3D.VectorMA(point, -frame.origin_x, vright, point);
- gl.glVertex3f(point[0], point[1], point[2]);
+ glVertex3f(point[0], point[1], point[2]);
- gl.glTexCoord2f(1, 0);
+ glTexCoord2f(1, 0);
Math3D.VectorMA(e.origin, frame.height - frame.origin_y, vup, point);
Math3D.VectorMA(point, frame.width - frame.origin_x, vright, point);
- gl.glVertex3f(point[0], point[1], point[2]);
+ glVertex3f(point[0], point[1], point[2]);
- gl.glTexCoord2f(1, 1);
+ glTexCoord2f(1, 1);
Math3D.VectorMA(e.origin, -frame.origin_y, vup, point);
Math3D.VectorMA(point, frame.width - frame.origin_x, vright, point);
- gl.glVertex3f(point[0], point[1], point[2]);
+ glVertex3f(point[0], point[1], point[2]);
- gl.glEnd();
+ glEnd();
- gl.glDisable(GL11.GL_ALPHA_TEST);
- GL_TexEnv(GL11.GL_REPLACE);
+ glDisable(GL_ALPHA_TEST);
+ GL_TexEnv(GL_REPLACE);
if (alpha != 1.0F)
- gl.glDisable(GL11.GL_BLEND);
+ glDisable(GL_BLEND);
- gl.glColor4f(1, 1, 1, 1);
+ glColor4f(1, 1, 1, 1);
}
// ==================================================================================
@@ -360,34 +342,34 @@ public abstract class Main extends Base {
R_LightPoint(currententity.origin, shadelight);
}
- gl.glPushMatrix();
+ glPushMatrix();
R_RotateForEntity(currententity);
- gl.glDisable(GL11.GL_TEXTURE_2D);
- gl.glColor3f(shadelight[0], shadelight[1], shadelight[2]);
+ glDisable(GL_TEXTURE_2D);
+ glColor3f(shadelight[0], shadelight[1], shadelight[2]);
// this replaces the TRIANGLE_FAN
//glut.glutWireCube(gl, 20);
- gl.glBegin(GL11.GL_TRIANGLE_FAN);
- gl.glVertex3f(0, 0, -16);
+ glBegin(GL_TRIANGLE_FAN);
+ glVertex3f(0, 0, -16);
int i;
for (i=0 ; i<=4 ; i++) {
- gl.glVertex3f((float)(16.0f * Math.cos(i * Math.PI / 2)), (float)(16.0f * Math.sin(i * Math.PI / 2)), 0.0f);
+ glVertex3f((float)(16.0f * Math.cos(i * Math.PI / 2)), (float)(16.0f * Math.sin(i * Math.PI / 2)), 0.0f);
}
- gl.glEnd();
+ glEnd();
- gl.glBegin(GL11.GL_TRIANGLE_FAN);
- gl.glVertex3f (0, 0, 16);
+ glBegin(GL_TRIANGLE_FAN);
+ 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);
+ glVertex3f((float)(16.0f * Math.cos(i * Math.PI / 2)), (float)(16.0f * Math.sin(i * Math.PI / 2)), 0.0f);
}
- gl.glEnd();
+ glEnd();
- gl.glColor3f(1, 1, 1);
- gl.glPopMatrix();
- gl.glEnable(GL11.GL_TEXTURE_2D);
+ glColor3f(1, 1, 1);
+ glPopMatrix();
+ glEnable(GL_TEXTURE_2D);
}
/**
@@ -431,7 +413,7 @@ public abstract class Main extends Base {
}
// draw transparent entities
// we could sort these if it ever becomes a problem...
- gl.glDepthMask(false); // no z writes
+ glDepthMask(false); // no z writes
for (i = 0; i < r_newrefdef.num_entities; i++) {
currententity = r_newrefdef.entities[i];
if ((currententity.flags & Defines.RF_TRANSLUCENT) == 0)
@@ -463,7 +445,7 @@ public abstract class Main extends Base {
}
}
}
- gl.glDepthMask(true); // back to writing
+ glDepthMask(true); // back to writing
}
// stack variable
@@ -479,11 +461,11 @@ public abstract class Main extends Base {
Math3D.VectorScale(vright, 1.5f, right);
GL_Bind(r_particletexture.texnum);
- gl.glDepthMask(false); // no z buffering
- gl.glEnable(GL11.GL_BLEND);
- GL_TexEnv(GL11.GL_MODULATE);
+ glDepthMask(false); // no z buffering
+ glEnable(GL_BLEND);
+ GL_TexEnv(GL_MODULATE);
- gl.glBegin(GL11.GL_TRIANGLES);
+ glBegin(GL_TRIANGLES);
FloatBuffer sourceVertices = particle_t.vertexArray;
IntBuffer sourceColors = particle_t.colorArray;
@@ -504,28 +486,28 @@ public abstract class Main extends Base {
color = sourceColors.get(i);
- gl.glColor4ub(
+ glColor4ub(
(byte)((color) & 0xFF),
(byte)((color >> 8) & 0xFF),
(byte)((color >> 16) & 0xFF),
(byte)((color >>> 24))
);
// first vertex
- gl.glTexCoord2f(0.0625f, 0.0625f);
- gl.glVertex3f(origin_x, origin_y, origin_z);
+ glTexCoord2f(0.0625f, 0.0625f);
+ glVertex3f(origin_x, origin_y, origin_z);
// second vertex
- gl.glTexCoord2f(1.0625f, 0.0625f);
- gl.glVertex3f(origin_x + up[0] * scale, origin_y + up[1] * scale, origin_z + up[2] * scale);
+ glTexCoord2f(1.0625f, 0.0625f);
+ glVertex3f(origin_x + up[0] * scale, origin_y + up[1] * scale, origin_z + up[2] * scale);
// third vertex
- gl.glTexCoord2f(0.0625f, 1.0625f);
- gl.glVertex3f(origin_x + right[0] * scale, origin_y + right[1] * scale, origin_z + right[2] * scale);
+ glTexCoord2f(0.0625f, 1.0625f);
+ glVertex3f(origin_x + right[0] * scale, origin_y + right[1] * scale, origin_z + right[2] * scale);
}
- gl.glEnd();
+ glEnd();
- gl.glDisable(GL11.GL_BLEND);
- gl.glColor4f(1, 1, 1, 1);
- gl.glDepthMask(true); // back to normal Z buffering
- GL_TexEnv(GL11.GL_REPLACE);
+ glDisable(GL_BLEND);
+ glColor4f(1, 1, 1, 1);
+ glDepthMask(true); // back to normal Z buffering
+ GL_TexEnv(GL_REPLACE);
}
/**
@@ -535,25 +517,25 @@ public abstract class Main extends Base {
if (gl_ext_pointparameters.value != 0.0f && qglPointParameterfEXT) {
- //gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
- gl.glVertexPointer(3, 0, particle_t.vertexArray);
- gl.glEnableClientState(GL11.GL_COLOR_ARRAY);
- gl.glColorPointer(4, true, 0, particle_t.getColorAsByteBuffer());
+ //gl.glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, 0, particle_t.vertexArray);
+ glEnableClientState(GL_COLOR_ARRAY);
+ glColorPointer(4, true, 0, particle_t.getColorAsByteBuffer());
- gl.glDepthMask(false);
- gl.glEnable(GL11.GL_BLEND);
- gl.glDisable(GL11.GL_TEXTURE_2D);
- gl.glPointSize(gl_particle_size.value);
+ glDepthMask(false);
+ glEnable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ glPointSize(gl_particle_size.value);
- gl.glDrawArrays(GL11.GL_POINTS, 0, r_newrefdef.num_particles);
+ glDrawArrays(GL_POINTS, 0, r_newrefdef.num_particles);
- gl.glDisableClientState(GL11.GL_COLOR_ARRAY);
- //gl.glDisableClientState(GL11.GL_VERTEX_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+ //gl.glDisableClientState(GL_VERTEX_ARRAY);
- gl.glDisable(GL11.GL_BLEND);
- gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- gl.glDepthMask(true);
- gl.glEnable(GL11.GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ glDepthMask(true);
+ glEnable(GL_TEXTURE_2D);
}
else {
@@ -571,32 +553,32 @@ public abstract class Main extends Base {
if (v_blend[3] == 0.0f)
return;
- gl.glDisable(GL11.GL_ALPHA_TEST);
- gl.glEnable(GL11.GL_BLEND);
- gl.glDisable(GL11.GL_DEPTH_TEST);
- gl.glDisable(GL11.GL_TEXTURE_2D);
+ glDisable(GL_ALPHA_TEST);
+ glEnable(GL_BLEND);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_TEXTURE_2D);
- gl.glLoadIdentity();
+ glLoadIdentity();
// FIXME: get rid of these
- gl.glRotatef(-90, 1, 0, 0); // put Z going up
- gl.glRotatef(90, 0, 0, 1); // put Z going up
+ glRotatef(-90, 1, 0, 0); // put Z going up
+ glRotatef(90, 0, 0, 1); // put Z going up
- gl.glColor4f(v_blend[0], v_blend[1], v_blend[2], v_blend[3]);
+ glColor4f(v_blend[0], v_blend[1], v_blend[2], v_blend[3]);
- gl.glBegin(GL11.GL_QUADS);
+ glBegin(GL_QUADS);
- gl.glVertex3f(10, 100, 100);
- gl.glVertex3f(10, -100, 100);
- gl.glVertex3f(10, -100, -100);
- gl.glVertex3f(10, 100, -100);
- gl.glEnd();
+ glVertex3f(10, 100, 100);
+ glVertex3f(10, -100, 100);
+ glVertex3f(10, -100, -100);
+ glVertex3f(10, 100, -100);
+ glEnd();
- gl.glDisable(GL11.GL_BLEND);
- gl.glEnable(GL11.GL_TEXTURE_2D);
- gl.glEnable(GL11.GL_ALPHA_TEST);
+ glDisable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_ALPHA_TEST);
- gl.glColor4f(1, 1, 1, 1);
+ glColor4f(1, 1, 1, 1);
}
// =======================================================================
@@ -682,16 +664,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(GL11.GL_SCISSOR_TEST);
- gl.glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
- gl.glScissor(
+ glEnable(GL_SCISSOR_TEST);
+ glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
+ glScissor(
r_newrefdef.x,
vid.height - r_newrefdef.height - r_newrefdef.y,
r_newrefdef.width,
r_newrefdef.height);
- gl.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
- gl.glClearColor(1.0f, 0.0f, 0.5f, 0.5f);
- gl.glDisable(GL11.GL_SCISSOR_TEST);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glClearColor(1.0f, 0.0f, 0.5f, 0.5f);
+ glDisable(GL_SCISSOR_TEST);
}
}
@@ -713,7 +695,7 @@ public abstract class Main extends Base {
xmin += - (2 * gl_state.camera_separation) / zNear;
xmax += - (2 * gl_state.camera_separation) / zNear;
- gl.glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
+ glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
}
/**
@@ -736,42 +718,42 @@ public abstract class Main extends Base {
int w = x2 - x;
int h = y - y2;
- gl.glViewport(x, y2, w, h);
+ glViewport(x, y2, w, h);
//
// set up projection matrix
//
float screenaspect = (float) r_newrefdef.width / r_newrefdef.height;
- gl.glMatrixMode(GL11.GL_PROJECTION);
- gl.glLoadIdentity();
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
MYgluPerspective(r_newrefdef.fov_y, screenaspect, 4, 4096);
- gl.glCullFace(GL11.GL_FRONT);
+ glCullFace(GL_FRONT);
- gl.glMatrixMode(GL11.GL_MODELVIEW);
- gl.glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
- gl.glRotatef(-90, 1, 0, 0); // put Z going up
- gl.glRotatef(90, 0, 0, 1); // put Z going up
- gl.glRotatef(-r_newrefdef.viewangles[2], 1, 0, 0);
- gl.glRotatef(-r_newrefdef.viewangles[0], 0, 1, 0);
- gl.glRotatef(-r_newrefdef.viewangles[1], 0, 0, 1);
- gl.glTranslatef(-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]);
+ glRotatef(-90, 1, 0, 0); // put Z going up
+ glRotatef(90, 0, 0, 1); // put Z going up
+ glRotatef(-r_newrefdef.viewangles[2], 1, 0, 0);
+ glRotatef(-r_newrefdef.viewangles[0], 0, 1, 0);
+ glRotatef(-r_newrefdef.viewangles[1], 0, 0, 1);
+ glTranslatef(-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]);
- gl.glGetFloat(GL11.GL_MODELVIEW_MATRIX, r_world_matrix);
+ glGetFloat(GL_MODELVIEW_MATRIX, r_world_matrix);
r_world_matrix.clear();
//
// set drawing parms
//
if (gl_cull.value != 0.0f)
- gl.glEnable(GL11.GL_CULL_FACE);
+ glEnable(GL_CULL_FACE);
else
- gl.glDisable(GL11.GL_CULL_FACE);
+ glDisable(GL_CULL_FACE);
- gl.glDisable(GL11.GL_BLEND);
- gl.glDisable(GL11.GL_ALPHA_TEST);
- gl.glEnable(GL11.GL_DEPTH_TEST);
+ glDisable(GL_BLEND);
+ glDisable(GL_ALPHA_TEST);
+ glEnable(GL_DEPTH_TEST);
}
int trickframe = 0;
@@ -783,32 +765,32 @@ public abstract class Main extends Base {
if (gl_ztrick.value != 0.0f) {
if (gl_clear.value != 0.0f) {
- gl.glClear(GL11.GL_COLOR_BUFFER_BIT);
+ glClear(GL_COLOR_BUFFER_BIT);
}
trickframe++;
if ((trickframe & 1) != 0) {
gldepthmin = 0;
gldepthmax = 0.49999f;
- gl.glDepthFunc(GL11.GL_LEQUAL);
+ glDepthFunc(GL_LEQUAL);
}
else {
gldepthmin = 1;
gldepthmax = 0.5f;
- gl.glDepthFunc(GL11.GL_GEQUAL);
+ glDepthFunc(GL_GEQUAL);
}
}
else {
if (gl_clear.value != 0.0f)
- gl.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
else
- gl.glClear(GL11.GL_DEPTH_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT);
gldepthmin = 0;
gldepthmax = 1;
- gl.glDepthFunc(GL11.GL_LEQUAL);
+ glDepthFunc(GL_LEQUAL);
}
- gl.glDepthRange(gldepthmin, gldepthmax);
+ glDepthRange(gldepthmin, gldepthmax);
}
/**
@@ -845,7 +827,7 @@ public abstract class Main extends Base {
R_PushDlights();
if (gl_finish.value != 0.0f)
- gl.glFinish();
+ glFinish();
R_SetupFrame();
@@ -880,17 +862,17 @@ public abstract class Main extends Base {
*/
void R_SetGL2D() {
// set 2D virtual screen size
- gl.glViewport(0, 0, vid.width, vid.height);
- gl.glMatrixMode(GL11.GL_PROJECTION);
- gl.glLoadIdentity();
- gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
- gl.glMatrixMode(GL11.GL_MODELVIEW);
- gl.glLoadIdentity();
- gl.glDisable(GL11.GL_DEPTH_TEST);
- gl.glDisable(GL11.GL_CULL_FACE);
- gl.glDisable(GL11.GL_BLEND);
- gl.glEnable(GL11.GL_ALPHA_TEST);
- gl.glColor4f(1, 1, 1, 1);
+ glViewport(0, 0, vid.width, vid.height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glEnable(GL_ALPHA_TEST);
+ glColor4f(1, 1, 1, 1);
}
// stack variable
@@ -1065,6 +1047,12 @@ public abstract class Main extends Base {
float[] r_turbsin = new float[256];
+ /**
+ * R_Init
+ */
+ protected boolean R_Init() {
+ return R_Init(0, 0);
+ }
/**
* R_Init
*/
@@ -1103,13 +1091,13 @@ public abstract class Main extends Base {
/*
** get our various GL strings
*/
- gl_config.vendor_string = gl.glGetString(GL11.GL_VENDOR);
+ gl_config.vendor_string = glGetString(GL_VENDOR);
VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n');
- gl_config.renderer_string = gl.glGetString(GL11.GL_RENDERER);
+ gl_config.renderer_string = glGetString(GL_RENDERER);
VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n');
- gl_config.version_string = gl.glGetString(GL11.GL_VERSION);
+ gl_config.version_string = glGetString(GL_VERSION);
VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n');
- gl_config.extensions_string = gl.glGetString(GL11.GL_EXTENSIONS);
+ gl_config.extensions_string = glGetString(GL_EXTENSIONS);
VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n');
gl_config.parseOpenGLVersion();
@@ -1264,8 +1252,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 = ARBMultitexture.GL_TEXTURE0_ARB;
- GL_TEXTURE1 = ARBMultitexture.GL_TEXTURE1_ARB;
+ TEXTURE0 = GL_TEXTURE0_ARB;
+ TEXTURE1 = GL_TEXTURE1_ARB;
}
else {
VID.Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n");
@@ -1281,12 +1269,12 @@ public abstract class Main extends Base {
R_InitParticleTexture();
Draw_InitLocal();
- int err = gl.glGetError();
- if (err != GL11.GL_NO_ERROR)
+ int err = glGetError();
+ if (err != GL_NO_ERROR)
VID.Printf(
Defines.PRINT_ALL,
"glGetError() = 0x%x\n\t%s\n",
- new Vargs(2).add(err).add("" + gl.glGetString(err)));
+ new Vargs(2).add(err).add("" + glGetString(err)));
return true;
}
@@ -1366,17 +1354,17 @@ public abstract class Main extends Base {
/*
** go into 2D mode
*/
- gl.glViewport(0, 0, vid.width, vid.height);
- gl.glMatrixMode(GL11.GL_PROJECTION);
- gl.glLoadIdentity();
- gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
- gl.glMatrixMode(GL11.GL_MODELVIEW);
- gl.glLoadIdentity();
- gl.glDisable(GL11.GL_DEPTH_TEST);
- gl.glDisable(GL11.GL_CULL_FACE);
- gl.glDisable(GL11.GL_BLEND);
- gl.glEnable(GL11.GL_ALPHA_TEST);
- gl.glColor4f(1, 1, 1, 1);
+ glViewport(0, 0, vid.width, vid.height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glEnable(GL_ALPHA_TEST);
+ glColor4f(1, 1, 1, 1);
/*
** draw buffer stuff
@@ -1386,9 +1374,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(GL11.GL_FRONT);
+ glDrawBuffer(GL_FRONT);
else
- gl.glDrawBuffer(GL11.GL_BACK);
+ glDrawBuffer(GL_BACK);
}
}
@@ -1449,9 +1437,9 @@ public abstract class Main extends Base {
}
GL_SetTexturePalette(r_rawpalette);
- gl.glClearColor(0, 0, 0, 0);
- gl.glClear(GL11.GL_COLOR_BUFFER_BIT);
- gl.glClearColor(1f, 0f, 0.5f, 0.5f);
+ glClearColor(0, 0, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glClearColor(1f, 0f, 0.5f, 0.5f);
}
static final int NUM_BEAM_SEGS = 6;
@@ -1498,9 +1486,9 @@ public abstract class Main extends Base {
Math3D.VectorAdd(start_points[i], direction, end_points[i]);
}
- gl.glDisable(GL11.GL_TEXTURE_2D);
- gl.glEnable(GL11.GL_BLEND);
- gl.glDepthMask(false);
+ glDisable(GL_TEXTURE_2D);
+ glEnable(GL_BLEND);
+ glDepthMask(false);
float r = (d_8to24table[e.skinnum & 0xFF]) & 0xFF;
float g = (d_8to24table[e.skinnum & 0xFF] >> 8) & 0xFF;
@@ -1510,26 +1498,26 @@ public abstract class Main extends Base {
g *= 1 / 255.0f;
b *= 1 / 255.0f;
- gl.glColor4f(r, g, b, e.alpha);
+ glColor4f(r, g, b, e.alpha);
- gl.glBegin(GL11.GL_TRIANGLE_STRIP);
+ glBegin(GL_TRIANGLE_STRIP);
float[] v;
for (int i = 0; i < NUM_BEAM_SEGS; i++) {
v = start_points[i];
- gl.glVertex3f(v[0], v[1], v[2]);
+ glVertex3f(v[0], v[1], v[2]);
v = end_points[i];
- gl.glVertex3f(v[0], v[1], v[2]);
+ glVertex3f(v[0], v[1], v[2]);
v = start_points[(i + 1) % NUM_BEAM_SEGS];
- gl.glVertex3f(v[0], v[1], v[2]);
+ glVertex3f(v[0], v[1], v[2]);
v = end_points[(i + 1) % NUM_BEAM_SEGS];
- gl.glVertex3f(v[0], v[1], v[2]);
+ glVertex3f(v[0], v[1], v[2]);
}
- gl.glEnd();
+ glEnd();
- gl.glEnable(GL11.GL_TEXTURE_2D);
- gl.glDisable(GL11.GL_BLEND);
- gl.glDepthMask(true);
+ glEnable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
+ glDepthMask(true);
}
} \ No newline at end of file
diff --git a/src/jake2/render/lwjgl/Mesh.java b/src/jake2/render/lwjgl/Mesh.java
index ab5e409..beb745f 100644
--- a/src/jake2/render/lwjgl/Mesh.java
+++ b/src/jake2/render/lwjgl/Mesh.java
@@ -2,7 +2,7 @@
* Mesh.java
* Copyright (C) 2003
*
- * $Id: Mesh.java,v 1.8 2005-06-08 21:27:10 cawe Exp $
+ * $Id: Mesh.java,v 1.8.4.1 2005-07-10 17:55:51 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -30,14 +30,12 @@ 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 java.nio.IntBuffer;
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.GL11;
-
/**
* Mesh
*
@@ -114,9 +112,9 @@ public abstract class Mesh extends Light {
}
}
- FloatBuffer colorArrayBuf = BufferUtils.createFloatBuffer(qfiles.MAX_VERTS * 4);
- FloatBuffer vertexArrayBuf = BufferUtils.createFloatBuffer(qfiles.MAX_VERTS * 3);
- FloatBuffer textureArrayBuf = BufferUtils.createFloatBuffer(qfiles.MAX_VERTS * 2);
+ FloatBuffer colorArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 4);
+ FloatBuffer vertexArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 3);
+ FloatBuffer textureArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 2);
boolean isFilled = false;
float[] tmpVec = {0, 0, 0};
float[][] vectors = {
@@ -151,7 +149,7 @@ public abstract class Mesh extends Light {
// PMM - added double 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.glDisable( GL11.GL_TEXTURE_2D );
+ glDisable( GL_TEXTURE_2D );
float frontlerp = 1.0f - backlerp;
@@ -176,18 +174,18 @@ public abstract class Mesh extends Light {
GL_LerpVerts( paliashdr.num_xyz, ov, verts, move, frontv, backv );
- //gl.glEnableClientState( GL11.GL_VERTEX_ARRAY );
- gl.glVertexPointer( 3, 0, vertexArrayBuf );
+ //gl.glEnableClientState( GL_VERTEX_ARRAY );
+ 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.glColor4f( shadelight[0], shadelight[1], shadelight[2], alpha );
+ glColor4f( shadelight[0], shadelight[1], shadelight[2], alpha );
}
else
{
- gl.glEnableClientState( GL11.GL_COLOR_ARRAY );
- gl.glColorPointer( 4, 0, colorArrayBuf );
+ glEnableClientState( GL_COLOR_ARRAY );
+ glColorPointer( 4, 0, colorArrayBuf );
//
// pre light everything
@@ -207,9 +205,9 @@ public abstract class Mesh extends Light {
}
}
- gl.glClientActiveTextureARB(GL_TEXTURE0);
- gl.glTexCoordPointer( 2, 0, textureArrayBuf);
- //gl.glEnableClientState( GL11.GL_TEXTURE_COORD_ARRAY);
+ glClientActiveTextureARB(TEXTURE0);
+ glTexCoordPointer( 2, 0, textureArrayBuf);
+ //gl.glEnableClientState( GL_TEXTURE_COORD_ARRAY);
int pos = 0;
int[] counts = paliashdr.counts;
@@ -233,9 +231,9 @@ public abstract class Mesh extends Light {
srcIndexBuf = paliashdr.indexElements[j];
- mode = GL11.GL_TRIANGLE_STRIP;
+ mode = GL_TRIANGLE_STRIP;
if (count < 0) {
- mode = GL11.GL_TRIANGLE_FAN;
+ mode = GL_TRIANGLE_FAN;
count = -count;
}
srcIndex = pos << 1;
@@ -246,15 +244,15 @@ public abstract class Mesh extends Light {
dstTextureCoords.put(++dstIndex, srcTextureCoords.get(++srcIndex));
}
- gl.glDrawElements(mode, srcIndexBuf);
+ glDrawElements(mode, srcIndexBuf);
pos += count;
}
// 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.glEnable( GL11.GL_TEXTURE_2D );
+ glEnable( GL_TEXTURE_2D );
- gl.glDisableClientState( GL11.GL_COLOR_ARRAY );
+ glDisableClientState( GL_COLOR_ARRAY );
}
private final float[] point = {0, 0, 0};
@@ -283,10 +281,10 @@ public abstract class Mesh extends Light {
if (count < 0)
{
count = -count;
- gl.glBegin (GL11.GL_TRIANGLE_FAN);
+ glBegin (GL_TRIANGLE_FAN);
}
else
- gl.glBegin (GL11.GL_TRIANGLE_STRIP);
+ glBegin (GL_TRIANGLE_STRIP);
do
{
@@ -298,13 +296,13 @@ public abstract class Mesh extends Light {
point[0] -= shadevector[0]*(point[2]+lheight);
point[1] -= shadevector[1]*(point[2]+lheight);
point[2] = height;
- gl.glVertex3f(point[0], point[1], point[2]);
+ glVertex3f(point[0], point[1], point[2]);
orderIndex += 3;
} while (--count != 0);
- gl.glEnd ();
+ glEnd ();
}
}
@@ -580,21 +578,21 @@ public abstract class Mesh extends Light {
// draw all the triangles
//
if ( (currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls
- gl.glDepthRange(gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
+ glDepthRange(gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
if ( (currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f) )
{
- gl.glMatrixMode( GL11.GL_PROJECTION );
- gl.glPushMatrix();
- gl.glLoadIdentity();
- gl.glScalef( -1, 1, 1 );
+ glMatrixMode( GL_PROJECTION );
+ glPushMatrix();
+ glLoadIdentity();
+ glScalef( -1, 1, 1 );
MYgluPerspective( r_newrefdef.fov_y, ( float ) r_newrefdef.width / r_newrefdef.height, 4, 4096);
- gl.glMatrixMode( GL11.GL_MODELVIEW );
+ glMatrixMode( GL_MODELVIEW );
- gl.glCullFace( GL11.GL_BACK );
+ glCullFace( GL_BACK );
}
- gl.glPushMatrix ();
+ glPushMatrix ();
e.angles[PITCH] = -e.angles[PITCH]; // sigh.
R_RotateForEntity (e);
e.angles[PITCH] = -e.angles[PITCH]; // sigh.
@@ -622,12 +620,12 @@ public abstract class Mesh extends Light {
// draw it
- gl.glShadeModel (GL11.GL_SMOOTH);
+ glShadeModel (GL_SMOOTH);
- GL_TexEnv( GL11.GL_MODULATE );
+ GL_TexEnv( GL_MODULATE );
if ( (currententity.flags & Defines.RF_TRANSLUCENT) != 0 )
{
- gl.glEnable (GL11.GL_BLEND);
+ glEnable (GL_BLEND);
}
@@ -652,39 +650,39 @@ public abstract class Mesh extends Light {
GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp);
- GL_TexEnv( GL11.GL_REPLACE );
- gl.glShadeModel (GL11.GL_FLAT);
+ GL_TexEnv( GL_REPLACE );
+ glShadeModel (GL_FLAT);
- gl.glPopMatrix ();
+ glPopMatrix ();
if ( ( currententity.flags & Defines.RF_WEAPONMODEL ) != 0 && ( r_lefthand.value == 1.0F ) )
{
- gl.glMatrixMode( GL11.GL_PROJECTION );
- gl.glPopMatrix();
- gl.glMatrixMode( GL11.GL_MODELVIEW );
- gl.glCullFace( GL11.GL_FRONT );
+ glMatrixMode( GL_PROJECTION );
+ glPopMatrix();
+ glMatrixMode( GL_MODELVIEW );
+ glCullFace( GL_FRONT );
}
if ( (currententity.flags & Defines.RF_TRANSLUCENT) != 0 )
{
- gl.glDisable (GL11.GL_BLEND);
+ glDisable (GL_BLEND);
}
if ( (currententity.flags & Defines.RF_DEPTHHACK) != 0)
- gl.glDepthRange (gldepthmin, gldepthmax);
+ glDepthRange (gldepthmin, gldepthmax);
if ( gl_shadows.value != 0.0f && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0)
{
- gl.glPushMatrix ();
+ glPushMatrix ();
R_RotateForEntity (e);
- gl.glDisable (GL11.GL_TEXTURE_2D);
- gl.glEnable (GL11.GL_BLEND);
- gl.glColor4f (0,0,0,0.5f);
+ glDisable (GL_TEXTURE_2D);
+ glEnable (GL_BLEND);
+ glColor4f (0,0,0,0.5f);
GL_DrawAliasShadow (paliashdr, currententity.frame );
- gl.glEnable (GL11.GL_TEXTURE_2D);
- gl.glDisable (GL11.GL_BLEND);
- gl.glPopMatrix ();
+ glEnable (GL_TEXTURE_2D);
+ glDisable (GL_BLEND);
+ glPopMatrix ();
}
- gl.glColor4f (1,1,1,1);
+ glColor4f (1,1,1,1);
}
} \ No newline at end of file
diff --git a/src/jake2/render/lwjgl/Misc.java b/src/jake2/render/lwjgl/Misc.java
index bdce767..09c26e7 100644
--- a/src/jake2/render/lwjgl/Misc.java
+++ b/src/jake2/render/lwjgl/Misc.java
@@ -2,7 +2,7 @@
* Misc.java
* Copyright (C) 2003
*
- * $Id: Misc.java,v 1.8 2005-05-11 21:45:02 cawe Exp $
+ * $Id: Misc.java,v 1.8.6.1 2005-07-10 17:55:50 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -28,17 +28,13 @@ package jake2.render.lwjgl;
import jake2.Defines;
import jake2.client.VID;
import jake2.qcommon.FS;
+import jake2.util.Lib;
import java.io.*;
import java.nio.FloatBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
-import net.java.games.jogl.GL;
-
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.*;
-
/**
* Misc
*
@@ -162,7 +158,7 @@ public abstract class Misc extends Mesh {
// change pixel alignment for reading
if (vid.width % 4 != 0) {
- gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1);
+ glPixelStorei(GL_PACK_ALIGNMENT, 1);
}
// OpenGL 1.2+ supports the GL_BGR color format
@@ -170,10 +166,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, GL12.GL_BGR, GL.GL_UNSIGNED_BYTE, image);
+ glReadPixels(0, 0, vid.width, vid.height, GL_BGR, GL_UNSIGNED_BYTE, image);
} else {
// read the RGB values into the image buffer
- gl.glReadPixels(0, 0, vid.width, vid.height, GL11.GL_RGB, GL.GL_UNSIGNED_BYTE, image);
+ glReadPixels(0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, image);
// flip RGB to BGR
byte tmp;
for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) {
@@ -183,7 +179,7 @@ public abstract class Misc extends Mesh {
}
}
// reset to default alignment
- gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4);
+ glPixelStorei(GL_PACK_ALIGNMENT, 4);
// close the file channel
ch.close();
} catch (IOException e) {
@@ -208,54 +204,54 @@ public abstract class Misc extends Mesh {
*/
void GL_SetDefaultState()
{
- gl.glClearColor(1f,0f, 0.5f , 0.5f); // original quake2
+ glClearColor(1f,0f, 0.5f , 0.5f); // original quake2
//gl.glClearColor(0, 0, 0, 0); // replaced with black
- gl.glCullFace(GL11.GL_FRONT);
- gl.glEnable(GL11.GL_TEXTURE_2D);
+ glCullFace(GL_FRONT);
+ glEnable(GL_TEXTURE_2D);
- gl.glEnable(GL11.GL_ALPHA_TEST);
- gl.glAlphaFunc(GL11.GL_GREATER, 0.666f);
+ glEnable(GL_ALPHA_TEST);
+ glAlphaFunc(GL_GREATER, 0.666f);
- gl.glDisable (GL11.GL_DEPTH_TEST);
- gl.glDisable (GL11.GL_CULL_FACE);
- gl.glDisable (GL11.GL_BLEND);
+ glDisable (GL_DEPTH_TEST);
+ glDisable (GL_CULL_FACE);
+ glDisable (GL_BLEND);
- gl.glColor4f (1,1,1,1);
+ glColor4f (1,1,1,1);
- gl.glPolygonMode (GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
- gl.glShadeModel (GL11.GL_FLAT);
+ glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
+ glShadeModel (GL_FLAT);
GL_TextureMode( gl_texturemode.string );
GL_TextureAlphaMode( gl_texturealphamode.string );
GL_TextureSolidMode( gl_texturesolidmode.string );
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- gl.glBlendFunc (GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- GL_TexEnv( GL11.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 };
- FloatBuffer att_buffer=BufferUtils.createFloatBuffer(4);
+ 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( GL11.GL_POINT_SMOOTH );
- gl.glPointParameterfEXT( EXTPointParameters.GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value );
- gl.glPointParameterfEXT( EXTPointParameters.GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value );
- gl.glPointParameterEXT( EXTPointParameters.GL_DISTANCE_ATTENUATION_EXT, att_buffer );
+ glEnable( GL_POINT_SMOOTH );
+ glPointParameterfEXT(GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value );
+ glPointParameterfEXT(GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value );
+ glPointParameterEXT(GL_DISTANCE_ATTENUATION_EXT, att_buffer );
}
if ( qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f )
{
- gl.glEnable( EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT );
+ glEnable(GL_SHARED_TEXTURE_PALETTE_EXT );
GL_SetTexturePalette( d_8to24table );
}
@@ -265,9 +261,9 @@ public abstract class Misc extends Mesh {
/*
* vertex array extension
*/
- gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
- gl.glClientActiveTextureARB(GL_TEXTURE0);
- gl.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glClientActiveTextureARB(TEXTURE0);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
void GL_UpdateSwapInterval()
diff --git a/src/jake2/render/lwjgl/Model.java b/src/jake2/render/lwjgl/Model.java
index 38b566d..6c5fbed 100644
--- a/src/jake2/render/lwjgl/Model.java
+++ b/src/jake2/render/lwjgl/Model.java
@@ -2,7 +2,7 @@
* Model.java
* Copyright (C) 2003
*
- * $Id: Model.java,v 1.10 2005-05-15 15:59:57 cawe Exp $
+ * $Id: Model.java,v 1.10.6.1 2005-07-10 17:55:50 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 org.lwjgl.BufferUtils;
-
/**
* Model
*
@@ -1291,8 +1288,8 @@ public abstract class Model extends Surf {
* new functions for vertex array handling
*/
static final int MODEL_BUFFER_SIZE = 50000;
- static FloatBuffer globalModelTextureCoordBuf = BufferUtils.createFloatBuffer(MODEL_BUFFER_SIZE * 2);
- static IntBuffer globalModelVertexIndexBuf = BufferUtils.createIntBuffer(MODEL_BUFFER_SIZE);
+ static FloatBuffer globalModelTextureCoordBuf = Lib.newFloatBuffer(MODEL_BUFFER_SIZE * 2);
+ static IntBuffer globalModelVertexIndexBuf = Lib.newIntBuffer(MODEL_BUFFER_SIZE);
void precompileGLCmds(qfiles.dmdl_t model) {
model.textureCoordBuf = globalModelTextureCoordBuf.slice();
diff --git a/src/jake2/render/lwjgl/Surf.java b/src/jake2/render/lwjgl/Surf.java
index 3ab5ae7..d27680d 100644
--- a/src/jake2/render/lwjgl/Surf.java
+++ b/src/jake2/render/lwjgl/Surf.java
@@ -2,7 +2,7 @@
* Surf.java
* Copyright (C) 2003
*
- * $Id: Surf.java,v 1.9 2005-06-08 21:27:10 cawe Exp $
+ * $Id: Surf.java,v 1.9.4.1 2005-07-10 17:55:50 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -36,9 +36,6 @@ import jake2.util.Math3D;
import java.nio.*;
import java.util.Arrays;
-import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.GL11;
-
/**
* Surf
*
@@ -64,7 +61,7 @@ public abstract class Surf extends Draw {
int c_visible_lightmaps;
int c_visible_textures;
- static final int GL_LIGHTMAP_FORMAT = GL11.GL_RGBA;
+ static final int GL_LIGHTMAP_FORMAT = GL_RGBA;
static class gllightmapstate_t
{
@@ -138,7 +135,7 @@ public abstract class Surf extends Draw {
*/
void DrawGLPoly(glpoly_t p)
{
- gl.glDrawArrays(GL11.GL_POLYGON, p.pos, p.numverts);
+ glDrawArrays(GL_POLYGON, p.pos, p.numverts);
}
/**
@@ -151,7 +148,7 @@ public abstract class Surf extends Draw {
if(scroll == 0.0f)
scroll = -64.0f;
p.beginScrolling(scroll);
- gl.glDrawArrays(GL11.GL_POLYGON, p.pos, p.numverts);
+ glDrawArrays(GL_POLYGON, p.pos, p.numverts);
p.endScrolling();
}
@@ -163,9 +160,9 @@ public abstract class Surf extends Draw {
if (gl_showtris.value == 0)
return;
- gl.glDisable(GL11.GL_TEXTURE_2D);
- gl.glDisable(GL11.GL_DEPTH_TEST);
- gl.glColor4f(1, 1, 1, 1);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_DEPTH_TEST);
+ glColor4f(1, 1, 1, 1);
msurface_t surf;
glpoly_t p;
@@ -174,19 +171,19 @@ public abstract class Surf extends Draw {
for (surf = gl_lms.lightmap_surfaces[i]; surf != null; surf = surf.lightmapchain) {
for (p = surf.polys; p != null; p = p.chain) {
for (j = 2; j < p.numverts; j++) {
- gl.glBegin(GL11.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));
- gl.glVertex3f(p.x(0), p.y(0), p.z(0));
- gl.glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(p.x(0), p.y(0), p.z(0));
+ glVertex3f(p.x(j-1), p.y(j-1), p.z(j-1));
+ glVertex3f(p.x(j), p.y(j), p.z(j));
+ glVertex3f(p.x(0), p.y(0), p.z(0));
+ glEnd();
}
}
}
}
- gl.glEnable(GL11.GL_DEPTH_TEST);
- gl.glEnable(GL11.GL_TEXTURE_2D);
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_TEXTURE_2D);
}
private final IntBuffer temp2 = Lib.newIntBuffer(34 * 34, ByteOrder.LITTLE_ENDIAN);
@@ -205,20 +202,20 @@ public abstract class Surf extends Draw {
GL_Bind( image.texnum );
// warp texture, no lightmaps
- GL_TexEnv( GL11.GL_MODULATE );
- gl.glColor4f( gl_state.inverse_intensity,
+ GL_TexEnv( GL_MODULATE );
+ glColor4f( gl_state.inverse_intensity,
gl_state.inverse_intensity,
gl_state.inverse_intensity,
1.0F );
EmitWaterPolys (fa);
- GL_TexEnv( GL11.GL_REPLACE );
+ GL_TexEnv( GL_REPLACE );
return;
}
else
{
GL_Bind( image.texnum );
- GL_TexEnv( GL11.GL_REPLACE );
+ GL_TexEnv( GL_REPLACE );
}
// ======
@@ -276,11 +273,11 @@ public abstract class Surf extends Draw {
GL_Bind( gl_state.lightmap_textures + fa.lightmaptexturenum );
- gl.glTexSubImage2D( GL11.GL_TEXTURE_2D, 0,
+ glTexSubImage2D( GL_TEXTURE_2D, 0,
fa.light_s, fa.light_t,
smax, tmax,
GL_LIGHTMAP_FORMAT,
- GL11.GL_UNSIGNED_BYTE, temp2 );
+ GL_UNSIGNED_BYTE, temp2 );
fa.lightmapchain = gl_lms.lightmap_surfaces[fa.lightmaptexturenum];
gl_lms.lightmap_surfaces[fa.lightmaptexturenum] = fa;
@@ -311,28 +308,28 @@ public abstract class Surf extends Draw {
//
// go back to the world matrix
//
- gl.glLoadMatrix(r_world_matrix);
+ glLoadMatrix(r_world_matrix);
- gl.glEnable (GL11.GL_BLEND);
- GL_TexEnv(GL11.GL_MODULATE );
+ glEnable (GL_BLEND);
+ GL_TexEnv(GL_MODULATE );
// the textures are prescaled up for a better lighting range,
// so scale it back down
float intens = gl_state.inverse_intensity;
- gl.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
+ glInterleavedArrays(GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
for (msurface_t s = r_alpha_surfaces ; s != null ; s=s.texturechain)
{
GL_Bind(s.texinfo.image.texnum);
c_brush_polys++;
if ((s.texinfo.flags & Defines.SURF_TRANS33) != 0)
- gl.glColor4f (intens, intens, intens, 0.33f);
+ glColor4f (intens, intens, intens, 0.33f);
else if ((s.texinfo.flags & Defines.SURF_TRANS66) != 0)
- gl.glColor4f (intens, intens, intens, 0.66f);
+ glColor4f (intens, intens, intens, 0.66f);
else
- gl.glColor4f (intens,intens,intens,1);
+ glColor4f (intens,intens,intens,1);
if ((s.flags & Defines.SURF_DRAWTURB) != 0)
EmitWaterPolys(s);
else if((s.texinfo.flags & Defines.SURF_FLOWING) != 0) // PGM 9/16/98
@@ -341,9 +338,9 @@ public abstract class Surf extends Draw {
DrawGLPoly(s.polys);
}
- GL_TexEnv( GL11.GL_REPLACE );
- gl.glColor4f (1,1,1,1);
- gl.glDisable (GL11.GL_BLEND);
+ GL_TexEnv( GL_REPLACE );
+ glColor4f (1,1,1,1);
+ glDisable (GL_BLEND);
r_alpha_surfaces = null;
}
@@ -395,7 +392,7 @@ public abstract class Surf extends Draw {
image.texturechain = null;
}
- GL_TexEnv( GL11.GL_REPLACE );
+ GL_TexEnv( GL_REPLACE );
}
// direct buffer
@@ -454,15 +451,15 @@ public abstract class Surf extends Draw {
R_BuildLightMap( surf, temp, smax);
R_SetCacheState( surf );
- GL_MBind( GL_TEXTURE1, gl_state.lightmap_textures + surf.lightmaptexturenum );
+ GL_MBind(TEXTURE1, gl_state.lightmap_textures + surf.lightmaptexturenum );
lmtex = surf.lightmaptexturenum;
- gl.glTexSubImage2D( GL11.GL_TEXTURE_2D, 0,
+ glTexSubImage2D( GL_TEXTURE_2D, 0,
surf.light_s, surf.light_t,
smax, tmax,
GL_LIGHTMAP_FORMAT,
- GL11.GL_UNSIGNED_BYTE, temp );
+ GL_UNSIGNED_BYTE, temp );
}
else
@@ -472,22 +469,22 @@ public abstract class Surf extends Draw {
R_BuildLightMap( surf, temp, smax);
- GL_MBind( GL_TEXTURE1, gl_state.lightmap_textures + 0 );
+ GL_MBind(TEXTURE1, gl_state.lightmap_textures + 0 );
lmtex = 0;
- gl.glTexSubImage2D( GL11.GL_TEXTURE_2D, 0,
+ glTexSubImage2D( GL_TEXTURE_2D, 0,
surf.light_s, surf.light_t,
smax, tmax,
GL_LIGHTMAP_FORMAT,
- GL11.GL_UNSIGNED_BYTE, temp );
+ GL_UNSIGNED_BYTE, temp );
}
c_brush_polys++;
- GL_MBind( GL_TEXTURE0, image.texnum );
- GL_MBind( GL_TEXTURE1, gl_state.lightmap_textures + lmtex );
+ GL_MBind(TEXTURE0, image.texnum );
+ GL_MBind(TEXTURE1, gl_state.lightmap_textures + lmtex );
// ==========
// PGM
@@ -502,7 +499,7 @@ public abstract class Surf extends Draw {
for ( p = surf.polys; p != null; p = p.chain )
{
p.beginScrolling(scroll);
- gl.glDrawArrays(GL11.GL_POLYGON, p.pos, p.numverts);
+ glDrawArrays(GL_POLYGON, p.pos, p.numverts);
p.endScrolling();
}
}
@@ -510,7 +507,7 @@ public abstract class Surf extends Draw {
{
for ( p = surf.polys; p != null; p = p.chain )
{
- gl.glDrawArrays(GL11.GL_POLYGON, p.pos, p.numverts);
+ glDrawArrays(GL_POLYGON, p.pos, p.numverts);
}
}
// PGM
@@ -520,8 +517,8 @@ public abstract class Surf extends Draw {
{
c_brush_polys++;
- GL_MBind( GL_TEXTURE0, image.texnum );
- GL_MBind( GL_TEXTURE1, gl_state.lightmap_textures + lmtex);
+ GL_MBind(TEXTURE0, image.texnum );
+ GL_MBind(TEXTURE1, gl_state.lightmap_textures + lmtex);
// ==========
// PGM
@@ -536,7 +533,7 @@ public abstract class Surf extends Draw {
for ( p = surf.polys; p != null; p = p.chain )
{
p.beginScrolling(scroll);
- gl.glDrawArrays(GL11.GL_POLYGON, p.pos, p.numverts);
+ glDrawArrays(GL_POLYGON, p.pos, p.numverts);
p.endScrolling();
}
}
@@ -546,7 +543,7 @@ public abstract class Surf extends Draw {
// ==========
for ( p = surf.polys; p != null; p = p.chain )
{
- gl.glDrawArrays(GL11.GL_POLYGON, p.pos, p.numverts);
+ glDrawArrays(GL_POLYGON, p.pos, p.numverts);
}
// ==========
@@ -580,9 +577,9 @@ public abstract class Surf extends Draw {
if ( (currententity.flags & Defines.RF_TRANSLUCENT) != 0 )
{
- gl.glEnable (GL11.GL_BLEND);
- gl.glColor4f (1,1,1,0.25f);
- GL_TexEnv( GL11.GL_MODULATE );
+ glEnable (GL_BLEND);
+ glColor4f (1,1,1,0.25f);
+ GL_TexEnv( GL_MODULATE );
}
//
@@ -622,9 +619,9 @@ public abstract class Surf extends Draw {
}
if ( (currententity.flags & Defines.RF_TRANSLUCENT) != 0 ) {
- gl.glDisable (GL11.GL_BLEND);
- gl.glColor4f (1,1,1,1);
- GL_TexEnv( GL11.GL_REPLACE );
+ glDisable (GL_BLEND);
+ glColor4f (1,1,1,1);
+ GL_TexEnv( GL_REPLACE );
}
}
@@ -665,7 +662,7 @@ public abstract class Surf extends Draw {
if (R_CullBox(mins, maxs)) return;
- gl.glColor3f (1,1,1);
+ glColor3f (1,1,1);
// memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
@@ -682,7 +679,7 @@ public abstract class Surf extends Draw {
modelorg[2] = Math3D.DotProduct (org, up);
}
- gl.glPushMatrix();
+ glPushMatrix();
e.angles[0] = -e.angles[0]; // stupid quake bug
e.angles[2] = -e.angles[2]; // stupid quake bug
@@ -691,22 +688,22 @@ public abstract class Surf extends Draw {
e.angles[2] = -e.angles[2]; // stupid quake bug
GL_EnableMultitexture( true );
- GL_SelectTexture(GL_TEXTURE0);
- GL_TexEnv( GL11.GL_REPLACE );
- gl.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
- GL_SelectTexture(GL_TEXTURE1);
- GL_TexEnv( GL11.GL_MODULATE );
- gl.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
- gl.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
+ GL_SelectTexture(TEXTURE0);
+ GL_TexEnv( GL_REPLACE );
+ glInterleavedArrays(GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
+ GL_SelectTexture(TEXTURE1);
+ GL_TexEnv( GL_MODULATE );
+ glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
R_DrawInlineBModel();
- gl.glClientActiveTextureARB(GL_TEXTURE1);
- gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
+ glClientActiveTextureARB(TEXTURE1);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
GL_EnableMultitexture( false );
- gl.glPopMatrix();
+ glPopMatrix();
}
/*
@@ -866,7 +863,7 @@ public abstract class Surf extends Draw {
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;
- gl.glColor3f (1,1,1);
+ glColor3f (1,1,1);
// memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
// TODO wird bei multitexture nicht gebraucht
//gl_lms.clearLightmapSurfaces();
@@ -875,22 +872,22 @@ public abstract class Surf extends Draw {
GL_EnableMultitexture( true );
- GL_SelectTexture( GL_TEXTURE0);
- GL_TexEnv( GL11.GL_REPLACE );
- gl.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
- GL_SelectTexture( GL_TEXTURE1);
- gl.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
- gl.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
+ GL_SelectTexture(TEXTURE0);
+ GL_TexEnv( GL_REPLACE );
+ glInterleavedArrays(GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
+ GL_SelectTexture(TEXTURE1);
+ glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if ( gl_lightmap.value != 0)
- GL_TexEnv( GL11.GL_REPLACE );
+ GL_TexEnv( GL_REPLACE );
else
- GL_TexEnv( GL11.GL_MODULATE );
+ GL_TexEnv( GL_MODULATE );
R_RecursiveWorldNode(r_worldmodel.nodes[0]); // root node
- gl.glClientActiveTextureARB(GL_TEXTURE1);
- gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
+ glClientActiveTextureARB(TEXTURE1);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
GL_EnableMultitexture( false );
@@ -999,8 +996,8 @@ public abstract class Surf extends Draw {
int texture = ( dynamic ) ? 0 : gl_lms.current_lightmap_texture;
GL_Bind( gl_state.lightmap_textures + texture );
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl_lms.lightmap_buffer.rewind();
if ( dynamic )
@@ -1012,23 +1009,23 @@ public abstract class Surf extends Draw {
height = gl_lms.allocated[i];
}
- gl.glTexSubImage2D( GL11.GL_TEXTURE_2D,
+ glTexSubImage2D( GL_TEXTURE_2D,
0,
0, 0,
BLOCK_WIDTH, height,
GL_LIGHTMAP_FORMAT,
- GL11.GL_UNSIGNED_BYTE,
+ GL_UNSIGNED_BYTE,
gl_lms.lightmap_buffer );
}
else
{
- gl.glTexImage2D( GL11.GL_TEXTURE_2D,
+ glTexImage2D( GL_TEXTURE_2D,
0,
gl_lms.internal_format,
BLOCK_WIDTH, BLOCK_HEIGHT,
0,
GL_LIGHTMAP_FORMAT,
- GL11.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" );
@@ -1187,7 +1184,7 @@ public abstract class Surf extends Draw {
}
lightstyle_t[] lightstyles;
- private final IntBuffer dummy = BufferUtils.createIntBuffer(128*128);
+ private final IntBuffer dummy = Lib.newIntBuffer(128*128);
/**
* GL_BeginBuildingLightmaps
@@ -1212,7 +1209,7 @@ public abstract class Surf extends Draw {
r_framecount = 1; // no dlightcache
GL_EnableMultitexture( true );
- GL_SelectTexture( GL_TEXTURE1);
+ GL_SelectTexture(TEXTURE1);
/*
** setup the base lightstyles so the lightmaps won't have to be regenerated
@@ -1263,11 +1260,11 @@ public abstract class Surf extends Draw {
}
else if ( format == 'I' )
{
- gl_lms.internal_format = GL11.GL_INTENSITY8;
+ gl_lms.internal_format = GL_INTENSITY8;
}
else if ( format == 'L' )
{
- gl_lms.internal_format = GL11.GL_LUMINANCE8;
+ gl_lms.internal_format = GL_LUMINANCE8;
}
else
{
@@ -1278,15 +1275,15 @@ public abstract class Surf extends Draw {
** initialize the dynamic lightmap texture
*/
GL_Bind( gl_state.lightmap_textures + 0 );
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
- gl.glTexImage2D( GL11.GL_TEXTURE_2D,
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexImage2D( GL_TEXTURE_2D,
0,
gl_lms.internal_format,
BLOCK_WIDTH, BLOCK_HEIGHT,
0,
GL_LIGHTMAP_FORMAT,
- GL11.GL_UNSIGNED_BYTE,
+ GL_UNSIGNED_BYTE,
dummy );
}
diff --git a/src/jake2/render/lwjgl/Warp.java b/src/jake2/render/lwjgl/Warp.java
index ee869a8..60490f4 100644
--- a/src/jake2/render/lwjgl/Warp.java
+++ b/src/jake2/render/lwjgl/Warp.java
@@ -2,7 +2,7 @@
* Warp.java
* Copyright (C) 2003
*
- * $Id: Warp.java,v 1.5 2005-01-17 15:42:29 cawe Exp $
+ * $Id: Warp.java,v 1.5.6.1 2005-07-10 17:55:50 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -32,8 +32,6 @@ import jake2.render.*;
import jake2.util.Math3D;
import jake2.util.Vec3Cache;
-import org.lwjgl.opengl.GL11;
-
/**
* Warp
*
@@ -290,7 +288,7 @@ public abstract class Warp extends Model {
for (bp = fa.polys; bp != null; bp = bp.next) {
p = bp;
- gl.glBegin(GL11.GL_TRIANGLE_FAN);
+ glBegin(GL_TRIANGLE_FAN);
for (i = 0; i < p.numverts; i++) {
os = p.s1(i);
ot = p.t1(i);
@@ -304,10 +302,10 @@ public abstract class Warp extends Model {
+ Warp.SIN[(int) ((os * 0.125f + rdt) * TURBSCALE) & 255];
t *= (1.0f / 64);
- gl.glTexCoord2f(s, t);
- gl.glVertex3f(p.x(i), p.y(i), p.z(i));
+ glTexCoord2f(s, t);
+ glVertex3f(p.x(i), p.y(i), p.z(i));
}
- gl.glEnd();
+ glEnd();
}
}
@@ -612,8 +610,8 @@ public abstract class Warp extends Model {
t = sky_max;
t = 1.0f - t;
- gl.glTexCoord2f (s, t);
- gl.glVertex3f(v1[0], v1[1], v1[2]);
+ glTexCoord2f (s, t);
+ glVertex3f(v1[0], v1[1], v1[2]);
}
int[] skytexorder = {0,2,1,3,4,5};
@@ -635,9 +633,9 @@ public abstract class Warp extends Model {
return; // nothing visible
}
- gl.glPushMatrix ();
- gl.glTranslatef (r_origin[0], r_origin[1], r_origin[2]);
- gl.glRotatef (r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
+ glPushMatrix ();
+ glTranslatef (r_origin[0], r_origin[1], r_origin[2]);
+ glRotatef (r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
for (i=0 ; i<6 ; i++)
{
@@ -655,14 +653,14 @@ public abstract class Warp extends Model {
GL_Bind(sky_images[skytexorder[i]].texnum);
- gl.glBegin(GL11.GL_QUADS);
+ 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);
MakeSkyVec(skymaxs[0][i], skymins[1][i], i);
- gl.glEnd ();
+ glEnd ();
}
- gl.glPopMatrix ();
+ glPopMatrix ();
}
// 3dstudio environment map names