From: Rene S. <sa...@us...> - 2006-10-31 13:06:37
|
Update of /cvsroot/jake2/jake2/src/jake2/render/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15592/src/jake2/render/lwjgl Modified Files: Main.java Misc.java LWJGLBase.java Image.java Added Files: GLWrapLWJGL.java Removed Files: Base.java Draw.java Surf.java Model.java Anorms.java Light.java Warp.java Mesh.java Polygon.java Log Message: major refactoring of the render module --- Base.java DELETED --- Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Image.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Image.java 7 May 2005 17:31:37 -0000 1.3 --- Image.java 31 Oct 2006 13:06:33 -0000 1.4 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...1813 lines suppressed...] ! /** ! * GL_ShutdownImages. ! */ ! protected void GL_ShutdownImages() { image_t image; ! ! for (int i = 0; i < numgltextures; i++) { image = gltextures[i]; ! if (image.registration_sequence == 0) ! continue; // free image_t slot // free it // TODO jogl bug texnumBuffer.clear(); ! texnumBuffer.put(0, image.texnum); gl.glDeleteTextures(texnumBuffer); ! image.clear(); } } } --- Surf.java DELETED --- --- Light.java DELETED --- --- NEW FILE: GLWrapLWJGL.java --- /* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 28.10.2006 by RST. // $Id: GLWrapLWJGL.java,v 1.1 2006/10/31 13:06:33 salomo Exp $ package jake2.render.lwjgl; import java.nio.*; import org.lwjgl.opengl.GL11; import org.lwjgl.util.GLImpl; import net.java.games.jogl.GL; import jake2.*; import jake2.client.*; import jake2.game.*; import jake2.qcommon.*; import jake2.render.*; import jake2.render.common.GenericGL; import jake2.server.*; import net.java.games.jogl.*; public class GLWrapLWJGL implements GenericGL{ protected GLImpl gl; public GLWrapLWJGL(GLImpl gl) { this.gl = gl; } public final void glTexParameterf(int gl_texture_2d, int gl_texture_min_filter, int gl_nearest) { gl.glTexParameterf(gl_texture_2d, gl_texture_min_filter, gl_nearest); } public final void glBegin(int gl_triangle_fan2) { gl.glBegin(gl_triangle_fan2); } public final void glTexCoord2f(float s, float t) { gl.glTexCoord2f(s, t); } public final void glVertex3f(float f, float g, float h) { gl.glVertex3f(f, g, h); } public final void glEnd() { gl.glEnd(); } public final void glPushMatrix() { gl.glPushMatrix(); } public final void glTranslatef(float f, float g, float h) { gl.glTranslatef(f, g, h); } public final void glRotatef(float f, float g, float h, float i) { gl.glRotatef(f, g, h, i); } public final void glPopMatrix() { gl.glPopMatrix(); } public final void glColor3f(float f, float g, float h) { gl.glColor3f(f, g, h); } public final void glDepthMask(boolean b) { gl.glDepthMask(b); } public final void glDisable(int gl_texture_2d2) { gl.glDisable(gl_texture_2d2); } public final void glBlendFunc(int gl_src_alpha2, int gl_one_minus_src_alpha2) { gl.glBlendFunc(gl_src_alpha2, gl_one_minus_src_alpha2); } public final void glShadeModel(int gl_smooth2) { gl.glShadeModel(gl_smooth2); } public final void glDrawArrays(int gl_polygon2, int pos, int numverts) { gl.glDrawArrays(gl_polygon2, pos, numverts); } public final void glBindTexture(int gl_texture_2d2, int texnum) { gl.glBindTexture(gl_texture_2d2, texnum); } public final void glActiveTextureARB(int texture) { gl.glActiveTextureARB( texture); } public final void glClientActiveTextureARB(int texture) { gl.glClientActiveTextureARB(texture); } public final void glTexEnvi(int gl_texture_env2, int gl_texture_env_mode2, int mode) { gl.glTexEnvi(gl_texture_env2, gl_texture_env_mode2, mode); } public final void glVertex2f(int x, int y) { gl.glVertex2f(x, y); } public final void glEnable(int gl_alpha_test2) { gl.glEnable(gl_alpha_test2); } public final void glColor3ub(byte b, byte c, byte d) { gl.glColor3ub(b, c, d); } public final void glColor4f(int i, int j, int k, float f) { gl.glColor4f(i, j, k, f); } public final void glTexImage2D(int gl_texture_2d2, int i, int gl_tex_solid_format, int j, int k, int l, int gl_rgba3, int gl_unsigned_byte2, IntBuffer image32) { gl.glTexImage2D(gl_texture_2d2, i, gl_tex_solid_format, j, k, l, gl_rgba3, gl_unsigned_byte2, image32); } public final void glTexImage2D(int gl_texture_2d2, int i, int gl_color_index8_ext, int j, int k, int l, int gl_color_index2, int gl_unsigned_byte2, ByteBuffer image8) { gl.glTexImage2D(gl_texture_2d2, i, gl_color_index8_ext, j, k, l, gl_color_index2, gl_unsigned_byte2, image8); } public final void glColor4ub(byte b, byte c, byte d, byte e) { gl.glColor4ub(b, c, d, e); } public final void glTexParameteri(int gl_texture_2d2, int gl_texture_min_filter2, int gl_filter_min) { gl.glTexParameteri(gl_texture_2d2, gl_texture_min_filter2, gl_filter_min); } public final void glTexSubImage2D(int gl_texture_2d2, int i, int j, int k, int lm_block_width, int height, int gl_lightmap_format, int gl_unsigned_byte2, IntBuffer lightmap_buffer) { gl.glTexSubImage2D(gl_texture_2d2, i, j, k, lm_block_width, height, gl_lightmap_format, gl_unsigned_byte2, lightmap_buffer); } public final void glColor4f(float intens, float intens2, float intens3, float f) { gl.glColor4f(intens, intens2, intens3, f); } public final void glLoadMatrixf(float[] r_world_matrix) { gl.glLoadMatrix(FloatBuffer.wrap(r_world_matrix)); } public final void glInterleavedArrays(int gl_t2f_v3f2, int byte_stride, FloatBuffer globalPolygonInterleavedBuf) { gl.glInterleavedArrays(gl_t2f_v3f2, byte_stride, globalPolygonInterleavedBuf); } public void glDrawElements(int mode, int count, int gl_unsigned_int2, IntBuffer srcIndexBuf) { gl.glDrawElements(mode, srcIndexBuf); } public void glDisableClientState(int gl_color_array2) { gl.glDisableClientState(gl_color_array2); } public void glVertexPointer(int i, int gl_float2, int j, FloatBuffer vertexArrayBuf) { gl.glVertexPointer(i, j, vertexArrayBuf); } public void glEnableClientState(int gl_color_array2) { gl.glEnableClientState(gl_color_array2); } public void glColorPointer(int i, int gl_float2, int j, FloatBuffer colorArrayBuf) { gl.glColorPointer(i, j, colorArrayBuf); } public final void glTexCoordPointer(int i, int gl_float2, int j, FloatBuffer textureArrayBuf) { gl.glTexCoordPointer(i, j, textureArrayBuf); } public final void glDepthRange(float gldepthmin, double d) { gl.glDepthRange(gldepthmin, d); } public final void glMatrixMode(int gl_projection2) { gl.glMatrixMode(gl_projection2); } public final void glLoadIdentity() { gl.glLoadIdentity(); } public final void glScalef(int i, int j, int k) { gl.glScalef(i, j, k); } public final void glCullFace(int gl_back2) { gl.glCullFace(gl_back2); } public final void glClear(int gl_color_buffer_bit2) { gl.glClear(gl_color_buffer_bit2); } public final void glDepthFunc(int gl_lequal2) { gl.glDepthFunc(gl_lequal2); } public final void glFrustum(double xmin, double xmax, double ymin, double ymax, double near, double far) { gl.glFrustum(xmin, xmax, ymin, ymax, near, far); } public final void glViewport(int i, int j, int width, int height) { gl.glViewport(i, j, width, height); } public final void glOrtho(int i, int width, int height, int j, int k, int l) { gl.glOrtho(i, width, height, j, k, l); } public void glColorPointer(int i, int gl_unsigned_byte2, int j, ByteBuffer bb) { gl.glColorPointer(i, true, j, bb); } public void glPointSize(float value) { gl.glPointSize(value); } public void glClearColor(float f, float g, float h, float i) { gl.glClearColor(f, g, h, i); } } --- Mesh.java DELETED --- --- Model.java DELETED --- Index: Main.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Main.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Main.java 7 May 2005 18:23:25 -0000 1.7 --- Main.java 31 Oct 2006 13:06:32 -0000 1.8 *************** *** 28,47 **** 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; [...1372 lines suppressed...] - - for (int i = 0; i < NUM_BEAM_SEGS; i++) { - v = start_points[i]; - gl.glVertex3f(v[0], v[1], v[2]); - v = end_points[i]; - gl.glVertex3f(v[0], v[1], v[2]); - v = start_points[(i + 1) % NUM_BEAM_SEGS]; - gl.glVertex3f(v[0], v[1], v[2]); - v = end_points[(i + 1) % NUM_BEAM_SEGS]; - gl.glVertex3f(v[0], v[1], v[2]); - } - gl.glEnd(); - - gl.glEnable(GL11.GL_TEXTURE_2D); - gl.glDisable(GL11.GL_BLEND); - gl.glDepthMask(true); - } } \ No newline at end of file --- 470,472 ---- --- Polygon.java DELETED --- Index: LWJGLBase.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/LWJGLBase.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LWJGLBase.java 26 Oct 2006 22:02:56 -0000 1.3 --- LWJGLBase.java 31 Oct 2006 13:06:33 -0000 1.4 *************** *** 37,42 **** import org.lwjgl.LWJGLException; ! import org.lwjgl.opengl.Display; ! import org.lwjgl.opengl.DisplayMode; import org.lwjgl.util.GLImpl; --- 37,41 ---- import org.lwjgl.LWJGLException; ! import org.lwjgl.opengl.*; import org.lwjgl.util.GLImpl; *************** *** 46,70 **** * @author dsanders/cwei */ ! public abstract class LWJGLBase { // 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) { --- 45,59 ---- * @author dsanders/cwei */ ! public abstract class LWJGLBase extends jake2.render.common.Misc { ! // IMPORTED FUNCTIONS protected DisplayMode oldDisplayMode; protected GLImpl gl = new GLImpl(); // handles the post initialization with LWJGLRenderer protected abstract boolean R_Init2(); ! private java.awt.DisplayMode toAwtDisplayMode(DisplayMode m) { *************** *** 328,331 **** --- 317,324 ---- } + protected void GLimp_Finish() { + gl.glFinish(); + } + /** * this is a hack for jogl renderers. --- Warp.java DELETED --- --- Anorms.java DELETED --- --- Draw.java DELETED --- Index: Misc.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Misc.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Misc.java 11 May 2005 21:45:02 -0000 1.8 --- Misc.java 31 Oct 2006 13:06:32 -0000 1.9 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render.lwjgl; --- 6,27 ---- */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render.lwjgl; *************** *** 42,214 **** /** * Misc ! * * @author cwei */ ! public abstract class Misc extends Mesh { /* ! ================== ! R_InitParticleTexture ! ================== ! */ ! byte[][] dottexture = ! { ! {0,0,0,0,0,0,0,0}, ! {0,0,1,1,0,0,0,0}, ! {0,1,1,1,1,0,0,0}, ! {0,1,1,1,1,0,0,0}, ! {0,0,1,1,0,0,0,0}, ! {0,0,0,0,0,0,0,0}, ! {0,0,0,0,0,0,0,0}, ! {0,0,0,0,0,0,0,0}, ! }; ! void R_InitParticleTexture() ! { ! int x,y; ! byte[] data = new byte[8 * 8 * 4]; ! // ! // particle texture ! // ! for (x=0 ; x<8 ; x++) ! { ! for (y=0 ; y<8 ; y++) ! { ! data[y * 32 + x * 4 + 0] = (byte)255; ! data[y * 32 + x * 4 + 1] = (byte)255; ! data[y * 32 + x * 4 + 2] = (byte)255; ! data[y * 32 + x * 4 + 3] = (byte)(dottexture[x][y]*255); } - } - r_particletexture = GL_LoadPic("***particle***", data, 8, 8, it_sprite, 32); ! // ! // also use this for bad textures, but without alpha ! // ! for (x=0 ; x<8 ; x++) ! { ! for (y=0 ; y<8 ; y++) ! { ! data[y * 32 + x * 4 + 0] = (byte)(dottexture[x&3][y&3]*255); ! data[y * 32 + x * 4 + 1] = 0; // dottexture[x&3][y&3]*255; ! data[y * 32 + x * 4 + 2] = 0; //dottexture[x&3][y&3]*255; ! data[y * 32 + x * 4 + 3] = (byte)255; } } - r_notexture = GL_LoadPic("***r_notexture***", data, 8, 8, it_wall, 32); - } - - // /* - // ============================================================================== - // - // SCREEN SHOTS - // - // ============================================================================== - // */ - // - // typedef struct _TargaHeader { - // unsigned char id_length, colormap_type, image_type; - // unsigned short colormap_index, colormap_length; - // unsigned char colormap_size; - // unsigned short x_origin, y_origin, width, height; - // unsigned char pixel_size, attributes; - // } TargaHeader; - - private final static int TGA_HEADER_SIZE = 18; - - /* - ================== - GL_ScreenShot_f - ================== - */ - void GL_ScreenShot_f() { - StringBuffer sb = new StringBuffer(FS.Gamedir() + "/scrshot/jake00.tga"); - FS.CreatePath(sb.toString()); - File file = new File(sb.toString()); - // find a valid file name - int i = 0; int offset = sb.length() - 6; - while (file.exists() && i++ < 100) { - sb.setCharAt(offset, (char) ((i/10) + '0')); - sb.setCharAt(offset + 1, (char) ((i%10) + '0')); - file = new File(sb.toString()); - } - if (i == 100) { - VID.Printf(Defines.PRINT_ALL, "Clean up your screenshots\n"); - return; - } - - try { - RandomAccessFile out = new RandomAccessFile(file, "rw"); - FileChannel ch = out.getChannel(); - int fileLength = TGA_HEADER_SIZE + vid.width * vid.height * 3; - out.setLength(fileLength); - MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, - fileLength); - - // write the TGA header - image.put(0, (byte) 0).put(1, (byte) 0); - image.put(2, (byte) 2); // uncompressed type - image.put(12, (byte) (vid.width & 0xFF)); // vid.width - image.put(13, (byte) (vid.width >> 8)); // vid.width - image.put(14, (byte) (vid.height & 0xFF)); // vid.height - image.put(15, (byte) (vid.height >> 8)); // vid.height - image.put(16, (byte) 24); // pixel size - - // go to image data position - image.position(TGA_HEADER_SIZE); - - - // change pixel alignment for reading - if (vid.width % 4 != 0) { - gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); - } - - // OpenGL 1.2+ supports the GL_BGR color format - // check the GL_VERSION to use the TARGA BGR order if possible - // 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); - } 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); - // flip RGB to BGR - byte tmp; - for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) { - tmp = image.get(i); - image.put(i, image.get(i + 2)); - image.put(i + 2, tmp); - } - } - // reset to default alignment - gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4); - // close the file channel - ch.close(); - } catch (IOException e) { - VID.Printf(Defines.PRINT_ALL, e.getMessage() + '\n'); - } ! VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); ! } ! ! /* ! ** GL_Strings_f ! */ ! void GL_Strings_f() { ! VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); ! VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); ! VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); ! VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); } /* ! ** GL_SetDefaultState ! */ ! void GL_SetDefaultState() ! { ! gl.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); --- 42,149 ---- /** * Misc ! * * @author cwei */ ! public abstract class Misc extends Image { ! ! // /* ! // ============================================================================== ! // ! // SCREEN SHOTS ! // ! // ============================================================================== ! // */ ! // ! // typedef struct _TargaHeader { ! // unsigned char id_length, colormap_type, image_type; ! // unsigned short colormap_index, colormap_length; ! // unsigned char colormap_size; ! // unsigned short x_origin, y_origin, width, height; ! // unsigned char pixel_size, attributes; ! // } TargaHeader; ! ! private final static int TGA_HEADER_SIZE = 18; /* ! * ================== GL_ScreenShot_f ================== ! */ ! protected void GL_ScreenShot_f() { ! StringBuffer sb = new StringBuffer(FS.Gamedir() + "/scrshot/jake00.tga"); ! FS.CreatePath(sb.toString()); ! File file = new File(sb.toString()); ! // find a valid file name ! int i = 0; ! int offset = sb.length() - 6; ! while (file.exists() && i++ < 100) { ! sb.setCharAt(offset, (char) ((i / 10) + '0')); ! sb.setCharAt(offset + 1, (char) ((i % 10) + '0')); ! file = new File(sb.toString()); ! } ! if (i == 100) { ! VID.Printf(Defines.PRINT_ALL, "Clean up your screenshots\n"); ! return; ! } ! try { ! RandomAccessFile out = new RandomAccessFile(file, "rw"); ! FileChannel ch = out.getChannel(); ! int fileLength = TGA_HEADER_SIZE + vid.width * vid.height * 3; ! out.setLength(fileLength); ! MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, ! fileLength); ! // write the TGA header ! image.put(0, (byte) 0).put(1, (byte) 0); ! image.put(2, (byte) 2); // uncompressed type ! image.put(12, (byte) (vid.width & 0xFF)); // vid.width ! image.put(13, (byte) (vid.width >> 8)); // vid.width ! image.put(14, (byte) (vid.height & 0xFF)); // vid.height ! image.put(15, (byte) (vid.height >> 8)); // vid.height ! image.put(16, (byte) 24); // pixel size ! ! // go to image data position ! image.position(TGA_HEADER_SIZE); + // change pixel alignment for reading + if (vid.width % 4 != 0) { + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); } ! // OpenGL 1.2+ supports the GL_BGR color format ! // check the GL_VERSION to use the TARGA BGR order if possible ! // 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); ! } 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); ! // flip RGB to BGR ! byte tmp; ! for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) { ! tmp = image.get(i); ! image.put(i, image.get(i + 2)); ! image.put(i + 2, tmp); ! } } + // reset to default alignment + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4); + // close the file channel + ch.close(); + } catch (IOException e) { + VID.Printf(Defines.PRINT_ALL, e.getMessage() + '\n'); } ! VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); } /* ! * * GL_SetDefaultState ! */ ! protected void GL_SetDefaultState() { ! gl.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); *************** *** 217,266 **** gl.glAlphaFunc(GL11.GL_GREATER, 0.666f); ! gl.glDisable (GL11.GL_DEPTH_TEST); ! gl.glDisable (GL11.GL_CULL_FACE); ! gl.glDisable (GL11.GL_BLEND); ! gl.glColor4f (1,1,1,1); ! gl.glPolygonMode (GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); ! gl.glShadeModel (GL11.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); ! 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); ! gl.glBlendFunc (GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ! GL_TexEnv( GL11.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); ! 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 ); } ! if ( qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f ) ! { ! gl.glEnable( EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT ); ! GL_SetTexturePalette( d_8to24table ); } GL_UpdateSwapInterval(); ! /* * vertex array extension --- 152,207 ---- gl.glAlphaFunc(GL11.GL_GREATER, 0.666f); ! gl.glDisable(GL11.GL_DEPTH_TEST); ! gl.glDisable(GL11.GL_CULL_FACE); ! gl.glDisable(GL11.GL_BLEND); ! gl.glColor4f(1, 1, 1, 1); ! gl.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); ! gl.glShadeModel(GL11.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); ! 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); ! gl.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ! GL_TexEnv(GL11.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); ! 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); } ! if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) { ! gl.glEnable(EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT); ! GL_SetTexturePalette(d_8to24table); } GL_UpdateSwapInterval(); ! /* * vertex array extension *************** *** 271,281 **** } ! void GL_UpdateSwapInterval() ! { ! if ( gl_swapinterval.modified ) ! { gl_swapinterval.modified = false; ! if ( !gl_state.stereo_enabled ) ! { if (qwglSwapIntervalEXT) { // ((WGL)gl).wglSwapIntervalEXT((int)gl_swapinterval.value); --- 212,219 ---- } ! protected void GL_UpdateSwapInterval() { ! if (gl_swapinterval.modified) { gl_swapinterval.modified = false; ! if (!gl_state.stereo_enabled) { if (qwglSwapIntervalEXT) { // ((WGL)gl).wglSwapIntervalEXT((int)gl_swapinterval.value); |