summaryrefslogtreecommitdiffstats
path: root/src/jake2/render/jogl
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2005-05-11 21:45:02 +0000
committerCarsten Weisse <[email protected]>2005-05-11 21:45:02 +0000
commit3b306d7e1b911c59908a62f4a30fa605a8dd3f06 (patch)
tree3344fb4da09314e9a5fff1eb4e2a9b059ac3c923 /src/jake2/render/jogl
parentfaf6ce9bdbfc0ba8daa10933f6bc51fdee37c4d8 (diff)
the default pixel alignment in OpenGL is 4.
to store images correctly with an vid.width e.g 713 (713 isn't a multiple of 4) the alignment has to be 1 byte. see also: http://www.javagaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1115392413
Diffstat (limited to 'src/jake2/render/jogl')
-rw-r--r--src/jake2/render/jogl/Misc.java9
1 files changed, 8 insertions, 1 deletions
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) {