From d5ff752fe9560d7d7e199baa5b05fc84c192c432 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 14 Feb 2005 20:52:25 +0000 Subject: Fixed performance issues with accelerated GLJPanel on ATI cards. Setting of the GL_PACK_LSB_FIRST property confused the drivers even though it didn't apply to the frame buffer readback (it applies only for bitmap data, and we were reading bytes.) git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@226 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/net/java/games/jogl/GLJPanel.java | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'src/net/java/games') diff --git a/src/net/java/games/jogl/GLJPanel.java b/src/net/java/games/jogl/GLJPanel.java index df7ffc7de..95e1161e1 100644 --- a/src/net/java/games/jogl/GLJPanel.java +++ b/src/net/java/games/jogl/GLJPanel.java @@ -67,17 +67,6 @@ import net.java.games.jogl.impl.*; them. */ public final class GLJPanel extends JPanel implements GLDrawable { - private static boolean isMacOSX; - - static { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - isMacOSX = System.getProperty("os.name").equals("Mac OS X"); - return null; - } - }); - } - private GLDrawableHelper drawableHelper = new GLDrawableHelper(); // Data used for either pbuffers or pixmap-based offscreen surfaces @@ -112,7 +101,6 @@ public final class GLJPanel extends JPanel implements GLDrawable { // For saving/restoring of OpenGL state during ReadPixels private int[] swapbytes = new int[1]; - private int[] lsbfirst = new int[1]; private int[] rowlength = new int[1]; private int[] skiprows = new int[1]; private int[] skippixels = new int[1]; @@ -478,12 +466,8 @@ public final class GLJPanel extends JPanel implements GLDrawable { awtFormat = BufferedImage.TYPE_INT_RGB; } - // Choose better pixel format on Mac OS X - if (isMacOSX) { - hwGLFormat = GL.GL_UNSIGNED_INT_8_8_8_8_REV; - } else { - hwGLFormat = GL.GL_UNSIGNED_BYTE; - } + // This seems to be a good choice on all platforms + hwGLFormat = GL.GL_UNSIGNED_INT_8_8_8_8_REV; } else { awtFormat = offscreenContext.getOffscreenContextBufferedImageType(); } @@ -521,18 +505,12 @@ public final class GLJPanel extends JPanel implements GLDrawable { GL gl = getGL(); // Save current modes gl.glGetIntegerv(GL.GL_PACK_SWAP_BYTES, swapbytes); - gl.glGetIntegerv(GL.GL_PACK_LSB_FIRST, lsbfirst); gl.glGetIntegerv(GL.GL_PACK_ROW_LENGTH, rowlength); gl.glGetIntegerv(GL.GL_PACK_SKIP_ROWS, skiprows); gl.glGetIntegerv(GL.GL_PACK_SKIP_PIXELS, skippixels); gl.glGetIntegerv(GL.GL_PACK_ALIGNMENT, alignment); - // Little endian machines (DEC Alpha, Intel X86, PPC (in LSB - // mode)... for example) could benefit from setting - // GL_PACK_LSB_FIRST to GL_TRUE instead of GL_FALSE, but this - // would require changing the generated bitmaps too. gl.glPixelStorei(GL.GL_PACK_SWAP_BYTES, GL.GL_FALSE); - gl.glPixelStorei(GL.GL_PACK_LSB_FIRST, GL.GL_TRUE); gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, offscreenImage.getWidth()); gl.glPixelStorei(GL.GL_PACK_SKIP_ROWS, 0); gl.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, 0); @@ -548,7 +526,6 @@ public final class GLJPanel extends JPanel implements GLDrawable { // Restore saved modes. gl.glPixelStorei(GL.GL_PACK_SWAP_BYTES, swapbytes[0]); - gl.glPixelStorei(GL.GL_PACK_LSB_FIRST, lsbfirst[0]); gl.glPixelStorei(GL.GL_PACK_ROW_LENGTH, rowlength[0]); gl.glPixelStorei(GL.GL_PACK_SKIP_ROWS, skiprows[0]); gl.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, skippixels[0]); -- cgit v1.2.3