From: Carsten W. <ca...@us...> - 2005-05-07 19:49:46
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15501/src/jake2/render/fastjogl Modified Files: Misc.java Log Message: better string handling and error messages Index: Misc.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Misc.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Misc.java 6 May 2005 17:47:10 -0000 1.5 --- Misc.java 7 May 2005 19:49:37 -0000 1.6 *************** *** 31,36 **** import jake2.qcommon.xcommand_t; ! import java.io.File; ! import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; --- 31,35 ---- import jake2.qcommon.xcommand_t; ! import java.io.*; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; *************** *** 129,141 **** private void screenshot_f() { ! FS.CreatePath(FS.Gamedir() + "/scrshot/jake00.tga"); ! File file = new File(FS.Gamedir() + "/scrshot/jake00.tga"); // find a valid file name ! int i = 0; while (file.exists() && i++ < 100) { ! file = new File(FS.Gamedir() + "/scrshot/jake" + (i/10) + (i%10) + ".tga"); } if (i == 100) { ! VID.Printf(Defines.PRINT_ALL, "Couldn't create a new screenshot file\n"); return; } --- 128,143 ---- private void 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; } *************** *** 166,175 **** // check the GL_VERSION to use the TARGA BGR order if possible // e.g.: 1.5.2 NVIDIA 66.29 ! int colorFormat = (gl_config.version_string.charAt(2) > '1') ? GL.GL_BGR : GL.GL_RGB; ! // read the BGR/RGB values into the image buffer ! gl.glReadPixels(0, 0, vid.width, vid.height, colorFormat, ! GL.GL_UNSIGNED_BYTE, rgb); ! ! if (colorFormat == GL.GL_RGB) { // flip RGB to BGR byte tmp; --- 168,177 ---- // 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, GL.GL_BGR, GL.GL_UNSIGNED_BYTE, rgb); ! } else { ! // read the RGB values into the image buffer ! gl.glReadPixels(0, 0, vid.width, vid.height, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, rgb); // flip RGB to BGR byte tmp; *************** *** 182,188 **** // close the file channel ch.close(); ! } catch (Exception e) { ! // TODO Auto-generated catch block ! e.printStackTrace(); } --- 184,189 ---- // close the file channel ch.close(); ! } catch (IOException e) { ! VID.Printf(Defines.PRINT_ALL, e.getMessage() + '\n'); } |