summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/util
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2006-02-10 01:52:44 +0000
committerKenneth Russel <[email protected]>2006-02-10 01:52:44 +0000
commit135b56ef1a37cc518947cb50d4d1f17080631d2f (patch)
treec2b9f9659a76976565a1f913a840c7e76937e5a4 /src/classes/com/sun/opengl/util
parenta9e4c4d1b136ac13ab5f1aff33c81f4306636e2a (diff)
Fixed Issue 203: Missing setup of GL_UNPACK_ALIGNMENT for mipmapped
images in TextureIO Added missing set of GL_UNPACK_ALIGNMENT in mipmap case. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@593 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/util')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/Texture.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/classes/com/sun/opengl/util/texture/Texture.java b/src/classes/com/sun/opengl/util/texture/Texture.java
index 4daf5d141..0e56c9b42 100755
--- a/src/classes/com/sun/opengl/util/texture/Texture.java
+++ b/src/classes/com/sun/opengl/util/texture/Texture.java
@@ -347,10 +347,18 @@ public class Texture {
}
if (data.getMipmap()) {
- GLU glu = new GLU();
- glu.gluBuild2DMipmaps(newTarget, data.getInternalFormat(),
- data.getWidth(), data.getHeight(),
- data.getPixelFormat(), data.getPixelType(), data.getBuffer());
+ int[] align = new int[1];
+ gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, align, 0); // save alignment
+ gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, data.getAlignment());
+
+ try {
+ GLU glu = new GLU();
+ glu.gluBuild2DMipmaps(newTarget, data.getInternalFormat(),
+ data.getWidth(), data.getHeight(),
+ data.getPixelFormat(), data.getPixelType(), data.getBuffer());
+ } finally {
+ gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, align[0]); // restore align
+ }
} else {
gl.glTexImage2D(newTarget, 0, data.getInternalFormat(),
texWidth, texHeight, data.getBorder(),