From 135b56ef1a37cc518947cb50d4d1f17080631d2f Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Fri, 10 Feb 2006 01:52:44 +0000 Subject: 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 --- src/classes/com/sun/opengl/util/texture/Texture.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/classes/com') 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(), -- cgit v1.2.3