diff options
Diffstat (limited to 'src/jake2/render')
-rw-r--r-- | src/jake2/render/fastjogl/Misc.java | 9 | ||||
-rw-r--r-- | src/jake2/render/jogl/Misc.java | 9 | ||||
-rw-r--r-- | src/jake2/render/lwjgl/Misc.java | 10 |
3 files changed, 25 insertions, 3 deletions
diff --git a/src/jake2/render/fastjogl/Misc.java b/src/jake2/render/fastjogl/Misc.java index 00d6839..e0e78ee 100644 --- a/src/jake2/render/fastjogl/Misc.java +++ b/src/jake2/render/fastjogl/Misc.java @@ -2,7 +2,7 @@ * Misc.java * Copyright (C) 2003 * - * $Id: Misc.java,v 1.6 2005-05-07 19:49:37 cawe Exp $ + * $Id: Misc.java,v 1.7 2005-05-11 21:44:55 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -163,6 +163,11 @@ public abstract class Misc extends Mesh { image.position(TGA_HEADER_SIZE); // jogl needs a sliced buffer ByteBuffer rgb = image.slice(); + + // 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 @@ -181,6 +186,8 @@ public abstract class Misc extends Mesh { 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) { diff --git a/src/jake2/render/jogl/Misc.java b/src/jake2/render/jogl/Misc.java index 147eb10..5ea9a8b 100644 --- a/src/jake2/render/jogl/Misc.java +++ b/src/jake2/render/jogl/Misc.java @@ -2,7 +2,7 @@ * Misc.java * Copyright (C) 2003 * - * $Id: Misc.java,v 1.6 2005-05-07 19:49:37 cawe Exp $ + * $Id: Misc.java,v 1.7 2005-05-11 21:44:49 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -176,6 +176,11 @@ public abstract class Misc extends Mesh { // jogl needs a sliced buffer ByteBuffer rgb = image.slice(); + // 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 @@ -193,6 +198,8 @@ public abstract class Misc extends Mesh { 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) { diff --git a/src/jake2/render/lwjgl/Misc.java b/src/jake2/render/lwjgl/Misc.java index c06cc6e..bdce767 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.7 2005-05-07 19:49:38 cawe Exp $ + * $Id: Misc.java,v 1.8 2005-05-11 21:45:02 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -159,6 +159,12 @@ public abstract class Misc extends Mesh { // 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 @@ -176,6 +182,8 @@ public abstract class Misc extends Mesh { 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) { |