summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/opengl')
-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(),