From: Carsten W. <ca...@us...> - 2005-05-07 19:49:47
|
Update of /cvsroot/jake2/jake2/src/jake2/render/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15501/src/jake2/render/lwjgl Modified Files: Misc.java Log Message: better string handling and error messages Index: Misc.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Misc.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Misc.java 6 May 2005 23:22:04 -0000 1.6 --- Misc.java 7 May 2005 19:49:38 -0000 1.7 *************** *** 30,39 **** import jake2.qcommon.FS; ! import java.io.File; ! import java.io.RandomAccessFile; import java.nio.FloatBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.*; --- 30,40 ---- import jake2.qcommon.FS; ! 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.*; *************** *** 123,137 **** ================== */ ! void GL_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; } --- 124,140 ---- ================== */ ! 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; } *************** *** 160,169 **** // 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') ? GL12.GL_BGR : GL11.GL_RGB; ! // read the BGR/RGB values into the image buffer ! gl.glReadPixels(0, 0, vid.width, vid.height, colorFormat, ! GL11.GL_UNSIGNED_BYTE, image); ! ! if (colorFormat == GL11.GL_RGB) { // flip RGB to BGR byte tmp; --- 163,172 ---- // 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; *************** *** 176,182 **** // close the file channel ch.close(); ! } catch (Exception e) { ! // TODO Auto-generated catch block ! e.printStackTrace(); } --- 179,184 ---- // close the file channel ch.close(); ! } catch (IOException e) { ! VID.Printf(Defines.PRINT_ALL, e.getMessage() + '\n'); } |