OSDN Git Service

[fixed] All warnings. No more checking in warnings or you'll get a severe talking to!
authornathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sat, 13 Nov 2010 22:34:38 +0000 (22:34 +0000)
committernathan.sweet <nathan.sweet@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sat, 13 Nov 2010 22:34:38 +0000 (22:34 +0000)
[added] TextureData, for loading custom image data for managed textures.

20 files changed:
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphics.java
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidPixmap.java
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidTexture.java
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/surfaceview/GLBaseSurfaceView.java
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/surfaceview/GLLogWrapper.java
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/surfaceview/GLSurfaceView20.java
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/surfaceview/GLSurfaceViewCupcake.java
backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglAnimator.java
backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglApplication.java
backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglGraphicsBase.java
backends/gdx-backend-jogl/src/com/badlogic/gdx/backends/jogl/JoglTexture.java
backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglGraphics.java
backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglTexture.java
gdx/src/com/badlogic/gdx/Graphics.java
gdx/src/com/badlogic/gdx/graphics/TextureData.java [new file with mode: 0644]
tests/gdx-tests/src/com/badlogic/gdx/tests/Box2DTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/FFTTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/Pong.java
tests/gdx-tests/src/com/badlogic/gdx/tests/TextureRenderTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/box2d/CollisionFiltering.java

index 0908844..28bf2b9 100644 (file)
@@ -45,6 +45,7 @@ import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.Pixmap.Format;\r
 import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
 import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
+import com.badlogic.gdx.graphics.TextureData;\r
 import com.badlogic.gdx.graphics.glutils.FrameBuffer;\r
 import com.badlogic.gdx.graphics.glutils.ShaderProgram;\r
 import com.badlogic.gdx.math.WindowedMean;\r
@@ -389,6 +390,11 @@ final class AndroidGraphics implements Graphics, Renderer {
                TextureWrap vWrap) {\r
                return new AndroidTexture(this, (Bitmap)null, minFilter, magFilter, uWrap, vWrap, true, file);\r
        }\r
+       \r
+       @Override public Texture newTexture (TextureData textureData, TextureFilter minFilter, TextureFilter magFilter,\r
+               TextureWrap uWrap, TextureWrap vWrap) {\r
+               return new AndroidTexture(this, textureData, minFilter, magFilter, uWrap, vWrap);\r
+       }\r
 \r
        public void clearManagedCaches () {\r
                Mesh.clearAllMeshes();\r
index 6119b57..9403e9d 100644 (file)
@@ -47,9 +47,6 @@ final class AndroidPixmap implements Pixmap {
                paint.setXfermode(new PorterDuffXfermode(Mode.SRC));\r
        }\r
 \r
-       /**\r
-        * {@inheritDoc}\r
-        */\r
        public AndroidPixmap (Bitmap bitmap) {\r
                pixmap = bitmap;\r
 \r
index a657ba1..6c2912a 100644 (file)
@@ -28,6 +28,7 @@ import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.GL10;\r
 import com.badlogic.gdx.graphics.Pixmap;\r
 import com.badlogic.gdx.graphics.Texture;\r
+import com.badlogic.gdx.graphics.TextureData;\r
 import com.badlogic.gdx.utils.GdxRuntimeException;\r
 import com.badlogic.gdx.utils.MathUtils;\r
 \r
@@ -64,32 +65,27 @@ final class AndroidTexture implements Texture {
        private boolean invalidated = false;\r
        /** file handle **/\r
        private FileHandle file;\r
+       private TextureData textureData;\r
 \r
        /**\r
         * Creates a new texture based on the given image\r
-        * \r
-        * @param gl\r
-        * @param bitmap\r
         */\r
-       AndroidTexture (AndroidGraphics graphics, Bitmap image, TextureFilter minFilter, TextureFilter maxFilter, TextureWrap uWrap,\r
+       AndroidTexture (AndroidGraphics graphics, Bitmap image, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
                TextureWrap vWrap, boolean managed, FileHandle file) {\r
                this.file = file;\r
                this.isManaged = managed;\r
                this.bitmap = image;\r
                this.minFilter = minFilter;\r
-               this.magFilter = maxFilter;\r
+               this.magFilter = magFilter;\r
                this.uWrap = uWrap;\r
                this.vWrap = vWrap;\r
+               isMipMap = TextureFilter.isMipMap(minFilter);\r
+\r
                if (image != null) {\r
                        this.texWidth = image.getWidth();\r
                        this.texHeight = image.getHeight();\r
                }\r
 \r
-               if (TextureFilter.isMipMap(minFilter))\r
-                       isMipMap = true;\r
-               else\r
-                       isMipMap = false;\r
-\r
                createTexture();\r
                buildMipmap();\r
                Gdx.gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);\r
@@ -98,9 +94,32 @@ final class AndroidTexture implements Texture {
                if (isManaged) textures.add(this);\r
        }\r
 \r
+       /**\r
+        * Creates a managed texture that loads using the specified TextureData.\r
+        */\r
+       AndroidTexture (AndroidGraphics graphics, TextureData textureData, TextureFilter minFilter, TextureFilter magFilter,\r
+               TextureWrap uWrap, TextureWrap vWrap) {\r
+               this.minFilter = minFilter;\r
+               this.magFilter = magFilter;\r
+               this.uWrap = uWrap;\r
+               this.vWrap = vWrap;\r
+               isMipMap = TextureFilter.isMipMap(minFilter);\r
+\r
+               createTexture();\r
+               textureData.load();\r
+               texWidth = textureData.getWidth();\r
+               texHeight = textureData.getHeight();\r
+\r
+               isManaged = true;\r
+               textures.add(this);\r
+       }\r
+\r
        private void rebuild () {\r
                createTexture();\r
-               buildMipmap();\r
+               if (textureData != null)\r
+                       textureData.load();\r
+               else\r
+                       buildMipmap();\r
                invalidated = false;\r
        }\r
 \r
index 39f79f4..a6ec52f 100644 (file)
@@ -79,7 +79,7 @@ import android.view.SurfaceHolder;
  * typically they are called before setRenderer so that they take effect immediately.\r
  * <p>\r
  * <h4>Setting a Renderer</h4>\r
- * Finally, you must call {@link #setRenderer} to register a {@link Renderer}. The renderer is responsible for doing the actual\r
+ * Finally, you must call {@link #setRenderer} to register a Renderer. The renderer is responsible for doing the actual\r
  * OpenGL rendering.\r
  * <p>\r
  * <h3>Rendering Mode</h3>\r
@@ -469,7 +469,7 @@ public class GLBaseSurfaceView extends GLSurfaceView implements SurfaceHolder.Ca
                void destroyContext (EGL10 egl, EGLDisplay display, EGLContext context);\r
        }\r
 \r
-       private static class DefaultContextFactory implements EGLContextFactory {\r
+       static class DefaultContextFactory implements EGLContextFactory {\r
 \r
                public EGLContext createContext (EGL10 egl, EGLDisplay display, EGLConfig config) {\r
                        return egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT, null);\r
@@ -492,7 +492,7 @@ public class GLBaseSurfaceView extends GLSurfaceView implements SurfaceHolder.Ca
                void destroySurface (EGL10 egl, EGLDisplay display, EGLSurface surface);\r
        }\r
 \r
-       private static class DefaultWindowSurfaceFactory implements EGLWindowSurfaceFactory {\r
+       static class DefaultWindowSurfaceFactory implements EGLWindowSurfaceFactory {\r
 \r
                public EGLSurface createWindowSurface (EGL10 egl, EGLDisplay display, EGLConfig config, Object nativeWindow) {\r
                        return egl.eglCreateWindowSurface(display, config, nativeWindow, null);\r
@@ -631,7 +631,6 @@ public class GLBaseSurfaceView extends GLSurfaceView implements SurfaceHolder.Ca
 \r
                /**\r
                 * Initialize EGL for a given configuration spec.\r
-                * @param configSpec\r
                 */\r
                public void start () {\r
                        /*\r
@@ -1074,7 +1073,7 @@ public class GLBaseSurfaceView extends GLSurfaceView implements SurfaceHolder.Ca
                // Once the thread is started, all accesses to the following member\r
                // variables are protected by the sGLThreadManager monitor\r
                private boolean mShouldExit;\r
-               private boolean mExited;\r
+               boolean mExited;\r
                private boolean mPaused;\r
                private boolean mHasSurface;\r
                private boolean mWaitingForSurface;\r
@@ -1128,7 +1127,7 @@ public class GLBaseSurfaceView extends GLSurfaceView implements SurfaceHolder.Ca
                }\r
        }\r
 \r
-       private static class GLThreadManager {\r
+       static class GLThreadManager {\r
 \r
                public synchronized void threadExiting (GLThread thread) {\r
                        if (LOG_THREADS) {\r
@@ -1169,13 +1168,13 @@ public class GLBaseSurfaceView extends GLSurfaceView implements SurfaceHolder.Ca
                private GLThread mEglOwner;\r
        }\r
 \r
-       private static final GLThreadManager sGLThreadManager = new GLThreadManager();\r
-       private boolean mSizeChanged = true;\r
+       static final GLThreadManager sGLThreadManager = new GLThreadManager();\r
+       boolean mSizeChanged = true;\r
 \r
        private GLThread mGLThread;\r
-       private EGLConfigChooser mEGLConfigChooser;\r
-       private EGLContextFactory mEGLContextFactory;\r
-       private EGLWindowSurfaceFactory mEGLWindowSurfaceFactory;\r
-       private GLWrapper mGLWrapper;\r
-       private int mDebugFlags;\r
+       EGLConfigChooser mEGLConfigChooser;\r
+       EGLContextFactory mEGLContextFactory;\r
+       EGLWindowSurfaceFactory mEGLWindowSurfaceFactory;\r
+       GLWrapper mGLWrapper;\r
+       int mDebugFlags;\r
 }\r
index 05e3293..d929305 100644 (file)
@@ -924,7 +924,7 @@ class GLLogWrapper extends GLWrapperBase {
                }\r
        }\r
 \r
-       private ByteBuffer toByteBuffer (int byteCount, Buffer input) {\r
+       ByteBuffer toByteBuffer (int byteCount, Buffer input) {\r
                ByteBuffer result = null;\r
                boolean convertWholeBuffer = (byteCount < 0);\r
                if (input instanceof ByteBuffer) {\r
index 739a85c..236de45 100644 (file)
@@ -50,7 +50,7 @@ import android.util.Log;
  * red/green/blue/alpha channels bit depths). Failure to do so would result in an EGL_BAD_MATCH error.
  */
 public class GLSurfaceView20 extends GLSurfaceView {
-       private static String TAG = "GL2JNIView";
+       static String TAG = "GL2JNIView";
        private static final boolean DEBUG = false;
 
        public GLSurfaceView20 (Context context) {
@@ -89,7 +89,7 @@ public class GLSurfaceView20 extends GLSurfaceView {
                /* Set the renderer responsible for frame rendering */
        }
 
-       private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
+       static class ContextFactory implements GLSurfaceView.EGLContextFactory {
                private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
 
                public EGLContext createContext (EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
@@ -106,7 +106,7 @@ public class GLSurfaceView20 extends GLSurfaceView {
                }
        }
 
-       private static void checkEglError (String prompt, EGL10 egl) {
+       static void checkEglError (String prompt, EGL10 egl) {
                int error;
                while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) {
                        Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
index c92aa9e..94ceca3 100644 (file)
@@ -572,7 +572,6 @@ public class GLSurfaceViewCupcake extends SurfaceView implements SurfaceHolder.C
 \r
                /**\r
                 * Initialize EGL for a given configuration spec.\r
-                * @param configSpec\r
                 */\r
                public void start () {\r
                        /*\r
@@ -945,11 +944,11 @@ public class GLSurfaceViewCupcake extends SurfaceView implements SurfaceHolder.C
                private StringBuilder mBuilder = new StringBuilder();\r
        }\r
 \r
-       private static final Semaphore sEglSemaphore = new Semaphore(1);\r
+       static final Semaphore sEglSemaphore = new Semaphore(1);\r
 \r
        private GLThread mGLThread;\r
-       private EGLConfigChooser mEGLConfigChooser;\r
-       private GLWrapper mGLWrapper;\r
+       EGLConfigChooser mEGLConfigChooser;\r
+       GLWrapper mGLWrapper;\r
        private int mDebugFlags;\r
        private int mRenderMode;\r
        private Renderer mRenderer;\r
index 16c5135..87a9111 100644 (file)
@@ -62,19 +62,19 @@ import javax.media.opengl.*;
 */\r
 \r
 public class JoglAnimator {\r
-  private volatile ArrayList/*<GLAutoDrawable>*/ drawables = new ArrayList();\r
+  volatile ArrayList/*<GLAutoDrawable>*/ drawables = new ArrayList();\r
   private Runnable runnable;\r
-  private Thread thread;\r
-  private volatile boolean shouldStop;\r
+  Thread thread;\r
+  volatile boolean shouldStop;\r
   protected boolean ignoreExceptions;\r
   protected boolean printExceptions;\r
-  private boolean runAsFastAsPossible;\r
+  boolean runAsFastAsPossible;\r
 \r
   // For efficient rendering of Swing components, in particular when\r
   // they overlap one another\r
-  private List lightweights    = new ArrayList();\r
-  private Map  repaintManagers = new IdentityHashMap();\r
-  private Map  dirtyRegions    = new IdentityHashMap();\r
+  List lightweights    = new ArrayList();\r
+  Map  repaintManagers = new IdentityHashMap();\r
+  Map  dirtyRegions    = new IdentityHashMap();\r
 \r
   /** Creates a new, empty Animator. */\r
   public JoglAnimator() {\r
index 971189d..6008280 100644 (file)
@@ -34,7 +34,7 @@ import com.badlogic.gdx.utils.GdxRuntimeException;
 \r
 /**\r
  * An implemenation of the {@link Application} interface based on Jogl for Windows, Linux and Mac. Instantiate this class with\r
- * apropriate parameters and then register {@link ApplicationListener}, {@link RenderListener} or {@link InputProcessor} instances.\r
+ * apropriate parameters and then register {@link ApplicationListener} or {@link InputProcessor} instances.\r
  * \r
  * @author mzechner\r
  * \r
@@ -53,8 +53,8 @@ public final class JoglApplication implements Application {
 \r
        /**\r
         * Creates a new {@link JoglApplication} with the given title and dimensions. If useGL20IfAvailable is set the JoglApplication\r
-        * will try to create an OpenGL 2.0 context which can then be used via {@link JoglApplication.getGraphics().getGL20()}. To query whether enabling OpenGL 2.0\r
-        * was successful use the {@link JoglApplication.getGraphics().isGL20Available()} method.\r
+        * will try to create an OpenGL 2.0 context which can then be used via JoglApplication.getGraphics().getGL20(). To query whether enabling OpenGL 2.0\r
+        * was successful use the JoglApplication.getGraphics().isGL20Available() method.\r
         * \r
         * @param listener the ApplicationListener implementing the program logic\r
         * @param title the title of the application\r
@@ -79,7 +79,7 @@ public final class JoglApplication implements Application {
                }\r
        }\r
        \r
-       private void initialize(ApplicationListener listener, String title, int width, int height, boolean useGL20) {\r
+       void initialize(ApplicationListener listener, String title, int width, int height, boolean useGL20) {\r
                JoglNativesLoader.loadLibraries();\r
                graphics = new JoglGraphics(listener, title, width, height, useGL20);\r
                input = new JoglInput(graphics.getCanvas());\r
index 6c9d0a3..ef4b300 100644 (file)
@@ -19,6 +19,7 @@ import com.badlogic.gdx.graphics.GL20;
 import com.badlogic.gdx.graphics.GLCommon;\r
 import com.badlogic.gdx.graphics.Pixmap;\r
 import com.badlogic.gdx.graphics.Texture;\r
+import com.badlogic.gdx.graphics.TextureData;\r
 import com.badlogic.gdx.graphics.Pixmap.Format;\r
 import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
 import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
@@ -256,4 +257,10 @@ public abstract class JoglGraphicsBase implements Graphics, GLEventListener {
                return new JoglTexture((BufferedImage) pixmap.getNativePixmap(),\r
                                minFilter, magFilter, uWrap, vWrap, false);\r
        }\r
+\r
+       @Override\r
+       public Texture newTexture (TextureData textureData, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
+               TextureWrap vWrap) {\r
+               return new JoglTexture(textureData, minFilter, magFilter, uWrap, vWrap);\r
+       }\r
 }\r
index e4cd7d6..1bdc436 100644 (file)
@@ -15,13 +15,19 @@ package com.badlogic.gdx.backends.jogl;
 \r
 import java.awt.image.BufferedImage;\r
 import java.io.InputStream;\r
+import java.nio.ByteBuffer;\r
+import java.nio.ByteOrder;\r
+import java.nio.IntBuffer;\r
 \r
 import javax.imageio.ImageIO;\r
 import javax.media.opengl.GL;\r
 import javax.media.opengl.GLContext;\r
 \r
+import com.badlogic.gdx.Gdx;\r
 import com.badlogic.gdx.graphics.Pixmap;\r
 import com.badlogic.gdx.graphics.Texture;\r
+import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
+import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
 import com.badlogic.gdx.utils.GdxRuntimeException;\r
 import com.sun.opengl.util.texture.TextureData;\r
 import com.sun.opengl.util.texture.TextureIO;\r
@@ -47,10 +53,8 @@ final class JoglTexture implements Texture {
 \r
        /**\r
         * Create a new texture\r
-        * \r
-        * @param textureID The GL texture ID\r
         */\r
-       JoglTexture (InputStream in, TextureFilter minFilter, TextureFilter maxFilter, TextureWrap uWrap, TextureWrap vWrap,\r
+       JoglTexture (InputStream in, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap,\r
                boolean managed) {\r
                this.isManaged = managed;\r
                try {\r
@@ -63,7 +67,7 @@ final class JoglTexture implements Texture {
 \r
                bind();\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
-               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
+               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, getTextureFilter(magFilter));\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
                this.texWidth = texture.getWidth();\r
@@ -71,7 +75,7 @@ final class JoglTexture implements Texture {
                textures++;\r
        }\r
 \r
-       JoglTexture (BufferedImage image, TextureFilter minFilter, TextureFilter maxFilter, TextureWrap uWrap, TextureWrap vWrap,\r
+       JoglTexture (BufferedImage image, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap, TextureWrap vWrap,\r
                boolean managed) {\r
                this.isManaged = managed;\r
                texture = com.sun.opengl.util.texture.TextureIO.newTexture(image, TextureFilter.isMipMap(minFilter) ? true : false);\r
@@ -79,7 +83,7 @@ final class JoglTexture implements Texture {
 \r
                bind();\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
-               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
+               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, getTextureFilter(magFilter));\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
                this.texWidth = texture.getWidth();\r
@@ -89,10 +93,8 @@ final class JoglTexture implements Texture {
 \r
        /**\r
         * Create a new texture\r
-        * \r
-        * @param textureID The GL texture ID\r
         */\r
-       JoglTexture (int width, int height, int format, TextureFilter minFilter, TextureFilter maxFilter, TextureWrap uWrap,\r
+       JoglTexture (int width, int height, int format, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
                TextureWrap vWrap, boolean managed) {\r
                this.isManaged = managed;\r
                BufferedImage image = new BufferedImage(width, height, format);\r
@@ -102,7 +104,7 @@ final class JoglTexture implements Texture {
 \r
                bind();\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
-               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
+               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, getTextureFilter(magFilter));\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
                gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
                this.texWidth = texture.getWidth();\r
@@ -110,6 +112,30 @@ final class JoglTexture implements Texture {
                textures++;\r
        }\r
 \r
+       public JoglTexture (com.badlogic.gdx.graphics.TextureData textureData, TextureFilter minFilter, TextureFilter magFilter,\r
+               TextureWrap uWrap, TextureWrap vWrap) {\r
+               this.isManaged = false;\r
+               GL gl = GLContext.getCurrent().getGL();\r
+               \r
+               ByteBuffer buffer = ByteBuffer.allocateDirect(4);\r
+               buffer.order(ByteOrder.nativeOrder());\r
+               IntBuffer intBuffer = buffer.asIntBuffer();\r
+               gl.glGenTextures(1, intBuffer);\r
+               texture = com.sun.opengl.util.texture.TextureIO.newTexture(intBuffer.get(0));\r
+\r
+               bind();\r
+               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
+               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, getTextureFilter(magFilter));\r
+               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
+               gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
+\r
+               textureData.load();\r
+               texWidth = textureData.getWidth();\r
+               texHeight = textureData.getHeight();\r
+\r
+               textures++;\r
+       }\r
+\r
        private int getTextureFilter (TextureFilter filter) {\r
                if (filter == TextureFilter.Linear)\r
                        return GL.GL_LINEAR;\r
index 796cece..d511db7 100644 (file)
@@ -37,6 +37,7 @@ import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.Pixmap.Format;\r
 import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
 import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
+import com.badlogic.gdx.graphics.TextureData;\r
 import com.badlogic.gdx.utils.GdxRuntimeException;\r
 import com.badlogic.gdx.utils.MathUtils;\r
 \r
@@ -159,6 +160,11 @@ final class LwjglGraphics implements Graphics {
                return new LwjglTexture(file, minFilter, magFilter, uWrap, vWrap, false);\r
        }\r
 \r
+       public Texture newTexture (TextureData textureData, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
+               TextureWrap vWrap) {\r
+               return new LwjglTexture(textureData, minFilter, magFilter, uWrap, vWrap);\r
+       }\r
+\r
        public float getDeltaTime () {\r
                return deltaTime;\r
        }\r
index b95330d..1cf59b8 100644 (file)
@@ -24,22 +24,22 @@ import java.nio.ByteOrder;
 import java.nio.IntBuffer;\r
 \r
 import org.lwjgl.BufferUtils;\r
-import org.lwjgl.opengl.GL11;\r
-import org.lwjgl.opengl.GL12;\r
+import static org.lwjgl.opengl.GL11.*;\r
+import static org.lwjgl.opengl.GL12.*;\r
 \r
 import com.badlogic.gdx.Gdx;\r
 import com.badlogic.gdx.backends.lwjgl.PNGDecoder.Format;\r
 import com.badlogic.gdx.files.FileHandle;\r
 import com.badlogic.gdx.graphics.Pixmap;\r
 import com.badlogic.gdx.graphics.Texture;\r
+import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
+import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
+import com.badlogic.gdx.graphics.TextureData;\r
 import com.badlogic.gdx.utils.GdxRuntimeException;\r
 \r
 /**\r
- * I apologize for this class. It is a big fucking mess which can be attributed to the late hour i created this piece of shit in.\r
- * Please take my apologize. It is slow. It is ugly. It is aids.\r
- * \r
  * @author badlogicgames@gmail.com\r
- * \r
+ * @author Nathan Sweet <misc@n4te.com>\r
  */\r
 final class LwjglTexture implements Texture {\r
        /** height in pixels of texture **/\r
@@ -58,24 +58,23 @@ final class LwjglTexture implements Texture {
        static private IntBuffer intBuffer;\r
        static private final PNGDecoder pngDecoder = new PNGDecoder();\r
 \r
-       /**\r
-        * Create a new texture\r
-        */\r
        LwjglTexture (FileHandle file, TextureFilter minFilter, TextureFilter maxFilter, TextureWrap uWrap, TextureWrap vWrap,\r
                boolean managed) {\r
                this.isManaged = managed;\r
                this.isMipMapped = TextureFilter.isMipMap(minFilter);\r
-               if (file.getPath().endsWith(".png"))\r
+\r
+               if (!isMipMapped && file.getPath().endsWith(".png")) {\r
+                       // Fast path.\r
                        loadPNG(file);\r
-               else {\r
+               else {\r
                        BufferedImage image = (BufferedImage)Gdx.graphics.newPixmap(file).getNativePixmap();\r
                        loadMipMap(image);\r
                }\r
                bind();\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
                textures++;\r
        }\r
 \r
@@ -83,31 +82,49 @@ final class LwjglTexture implements Texture {
                boolean managed) {\r
                this.isManaged = managed;\r
                this.isMipMapped = TextureFilter.isMipMap(minFilter);\r
+\r
                BufferedImage img = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);\r
                loadMipMap(img);\r
                this.draw(Gdx.graphics.newPixmap(image), 0, 0);\r
                bind();\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
                textures++;\r
        }\r
 \r
-       /**\r
-        * Create a new texture\r
-        */\r
        LwjglTexture (int width, int height, int format, TextureFilter minFilter, TextureFilter maxFilter, TextureWrap uWrap,\r
                TextureWrap vWrap, boolean managed) {\r
                this.isManaged = managed;\r
                this.isMipMapped = TextureFilter.isMipMap(minFilter);\r
+\r
                BufferedImage image = new BufferedImage(width, height, format);\r
                loadMipMap(image);\r
                bind();\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
-               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getTextureFilter(maxFilter));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
+               textures++;\r
+       }\r
+\r
+       public LwjglTexture (TextureData textureData, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
+               TextureWrap vWrap) {\r
+               isManaged = false;\r
+               this.isMipMapped = TextureFilter.isMipMap(minFilter);\r
+\r
+               textureID = glGenTextures();\r
+               bind();\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getTextureFilter(minFilter));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getTextureFilter(magFilter));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, getTextureWrap(uWrap));\r
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, getTextureWrap(vWrap));\r
+\r
+               textureData.load();\r
+               texWidth = textureData.getWidth();\r
+               texHeight = textureData.getHeight();\r
+\r
                textures++;\r
        }\r
 \r
@@ -127,28 +144,28 @@ final class LwjglTexture implements Texture {
                        int glFormat, glInternalFormat;\r
                        switch (pngFormat) {\r
                        case ALPHA:\r
-                               glFormat = GL11.GL_ALPHA;\r
-                               glInternalFormat = GL11.GL_ALPHA8;\r
+                               glFormat = GL_ALPHA;\r
+                               glInternalFormat = GL_ALPHA8;\r
                                break;\r
                        case LUMINANCE:\r
-                               glFormat = GL11.GL_LUMINANCE;\r
-                               glInternalFormat = GL11.GL_LUMINANCE8;\r
+                               glFormat = GL_LUMINANCE;\r
+                               glInternalFormat = GL_LUMINANCE8;\r
                                break;\r
                        case LUMINANCE_ALPHA:\r
-                               glFormat = GL11.GL_LUMINANCE_ALPHA;\r
-                               glInternalFormat = GL11.GL_LUMINANCE8_ALPHA8;\r
+                               glFormat = GL_LUMINANCE_ALPHA;\r
+                               glInternalFormat = GL_LUMINANCE8_ALPHA8;\r
                                break;\r
                        case RGB:\r
-                               glFormat = GL11.GL_RGB;\r
-                               glInternalFormat = GL11.GL_RGB8;\r
+                               glFormat = GL_RGB;\r
+                               glInternalFormat = GL_RGB8;\r
                                break;\r
                        case RGBA:\r
-                               glFormat = GL11.GL_RGBA;\r
-                               glInternalFormat = GL11.GL_RGBA8;\r
+                               glFormat = GL_RGBA;\r
+                               glInternalFormat = GL_RGBA8;\r
                                break;\r
                        case BGRA:\r
-                               glFormat = GL12.GL_BGRA;\r
-                               glInternalFormat = GL12.GL_BGRA;\r
+                               glFormat = GL_BGRA;\r
+                               glInternalFormat = GL_BGRA;\r
                                break;\r
                        default:\r
                                throw new UnsupportedOperationException("PNG format not handled: " + pngFormat);\r
@@ -156,11 +173,9 @@ final class LwjglTexture implements Texture {
                        pngDecoder.decode(buffer, stride, pngFormat);\r
                        buffer.flip();\r
 \r
-                       textureID = GL11.glGenTextures();\r
-                       GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);\r
-                       GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, glInternalFormat, texWidth, texHeight, 0, glFormat, GL11.GL_UNSIGNED_BYTE,\r
-                               buffer);\r
-                       // FIXME - No mipmapping!\r
+                       textureID = glGenTextures();\r
+                       glBindTexture(GL_TEXTURE_2D, textureID);\r
+                       glTexImage2D(GL_TEXTURE_2D, 0, glInternalFormat, texWidth, texHeight, 0, glFormat, GL_UNSIGNED_BYTE, buffer);\r
                } catch (IOException ex) {\r
                        throw new GdxRuntimeException("Error loading image file: " + file, ex);\r
                }\r
@@ -212,16 +227,13 @@ final class LwjglTexture implements Texture {
                int width = image.getWidth();\r
                texWidth = width;\r
                texHeight = height;\r
-               textureID = GL11.glGenTextures();\r
-               GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);\r
+               textureID = glGenTextures();\r
+               glBindTexture(GL_TEXTURE_2D, textureID);\r
 \r
                while (height >= 1 || width >= 1 && level < 4) {\r
                        ByteBuffer imageBuffer = toByteBuffer(image);\r
-                       GL11.glTexImage2D(GL11.GL_TEXTURE_2D, level, GL11.GL_RGBA8, width, height, 0, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE,\r
-                               imageBuffer);\r
-                       if (height == 1 || width == 1 || isMipMapped == false) {\r
-                               break;\r
-                       }\r
+                       glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, imageBuffer);\r
+                       if (height == 1 || width == 1 || isMipMapped == false) break;\r
 \r
                        level++;\r
                        if (height > 1) height /= 2;\r
@@ -233,28 +245,28 @@ final class LwjglTexture implements Texture {
 \r
        private int getTextureFilter (TextureFilter filter) {\r
                if (filter == TextureFilter.Linear)\r
-                       return GL11.GL_LINEAR;\r
+                       return GL_LINEAR;\r
                else if (filter == TextureFilter.Nearest)\r
-                       return GL11.GL_NEAREST;\r
+                       return GL_NEAREST;\r
                else if (filter == TextureFilter.MipMap)\r
-                       return GL11.GL_LINEAR_MIPMAP_LINEAR;\r
+                       return GL_LINEAR_MIPMAP_LINEAR;\r
                else if (filter == TextureFilter.MipMapNearestNearest)\r
-                       return GL11.GL_NEAREST_MIPMAP_NEAREST;\r
+                       return GL_NEAREST_MIPMAP_NEAREST;\r
                else if (filter == TextureFilter.MipMapNearestLinear)\r
-                       return GL11.GL_NEAREST_MIPMAP_LINEAR;\r
+                       return GL_NEAREST_MIPMAP_LINEAR;\r
                else if (filter == TextureFilter.MipMapLinearNearest)\r
-                       return GL11.GL_LINEAR_MIPMAP_NEAREST;\r
+                       return GL_LINEAR_MIPMAP_NEAREST;\r
                else if (filter == TextureFilter.MipMapLinearLinear)\r
-                       return GL11.GL_LINEAR_MIPMAP_LINEAR;\r
+                       return GL_LINEAR_MIPMAP_LINEAR;\r
                else\r
-                       return GL11.GL_LINEAR_MIPMAP_LINEAR;\r
+                       return GL_LINEAR_MIPMAP_LINEAR;\r
        }\r
 \r
        private int getTextureWrap (TextureWrap wrap) {\r
                if (wrap == TextureWrap.ClampToEdge)\r
-                       return GL11.GL_CLAMP;\r
+                       return GL_CLAMP;\r
                else\r
-                       return GL11.GL_REPEAT;\r
+                       return GL_REPEAT;\r
        }\r
 \r
        public boolean isManaged () {\r
@@ -262,11 +274,11 @@ final class LwjglTexture implements Texture {
        }\r
 \r
        public void bind () {\r
-               GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);\r
+               glBindTexture(GL_TEXTURE_2D, textureID);\r
        }\r
 \r
        public void dispose () {\r
-               GL11.glDeleteTextures(textureID);\r
+               glDeleteTextures(textureID);\r
                textures--;\r
        }\r
 \r
@@ -288,10 +300,8 @@ final class LwjglTexture implements Texture {
                bind();\r
                while (height >= 1 || width >= 1 && level < 4) {\r
                        ByteBuffer imageBuffer = toByteBuffer(image);\r
-                       GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, level, x, y, width, height, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, imageBuffer);\r
-                       if (height == 1 || width == 1 || isMipMapped == false) {\r
-                               break;\r
-                       }\r
+                       glTexSubImage2D(GL_TEXTURE_2D, level, x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, imageBuffer);\r
+                       if (height == 1 || width == 1 || isMipMapped == false) break;\r
 \r
                        level++;\r
                        if (height > 1) height /= 2;\r
index 23634cf..acfe583 100644 (file)
@@ -24,6 +24,7 @@ import com.badlogic.gdx.graphics.GL20;
 import com.badlogic.gdx.graphics.GLCommon;\r
 import com.badlogic.gdx.graphics.Mesh;\r
 import com.badlogic.gdx.graphics.Pixmap;\r
+import com.badlogic.gdx.graphics.TextureData;\r
 import com.badlogic.gdx.graphics.Pixmap.Format;\r
 import com.badlogic.gdx.graphics.SpriteBatch;\r
 import com.badlogic.gdx.graphics.Texture;\r
@@ -290,7 +291,20 @@ public interface Graphics {
                        Texture.TextureWrap vWrap);\r
 \r
        /**\r
+        * Creates a new {@link Texture} that loads its data from the given {@link TextureData}. The texture is managed and the\r
+        * TextureData may be asked to load the image data multiple times throughout the application's lifetime. If the minification\r
+        * filter is specified as {@link Texture.TextureFilter#MipMap}, mipmaps will not be created automatically and must be handled\r
+        * by the TextureData. The Texture must be disposed via the {@link Texture#dispose()} methods once it is no longer used.\r
+        * Textures created via this method are managed and will be recreated automatically after the OpenGL context has been lost and\r
+        * recreated.\r
+        * @param textureData Loads the texture data into GL.\r
+        * @throws GdxRuntimeException if the texture could not be created.\r
+        */\r
+       public Texture newTexture (TextureData textureData, TextureFilter minFilter, TextureFilter magFilter, TextureWrap uWrap,\r
+               TextureWrap vWrap);\r
+\r
+       /**\r
         * @return the {@link GraphicsType} of this Graphics instance\r
         */\r
-       public GraphicsType getType();\r
+       public GraphicsType getType ();\r
 }\r
diff --git a/gdx/src/com/badlogic/gdx/graphics/TextureData.java b/gdx/src/com/badlogic/gdx/graphics/TextureData.java
new file mode 100644 (file)
index 0000000..f823d33
--- /dev/null
@@ -0,0 +1,30 @@
+\r
+package com.badlogic.gdx.graphics;\r
+\r
+import com.badlogic.gdx.Graphics;\r
+import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
+import com.badlogic.gdx.graphics.Texture.TextureWrap;\r
+\r
+/**\r
+ * Loads image data for a texture. Used with\r
+ * {@link Graphics#newTexture(TextureData, TextureFilter, TextureFilter, TextureWrap, TextureWrap) newTexture}, this allows custom\r
+ * image loading for managed textures. If the OpenGL context is lost, the TextureData will be asked to load again when the context\r
+ * is restored. The TextureData doesn't necessary need to keep the image data in memory between loads.\r
+ */\r
+public interface TextureData {\r
+       /**\r
+        * Loads the image data into the currently bound texture. Usually\r
+        * {@link GL10#glTexImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer)} is used.\r
+        */\r
+       public void load ();\r
+\r
+       /**\r
+        * Returns the width of the texture, which must be a power of two. This will not be called before {@link #load()}.\r
+        */\r
+       public int getWidth ();\r
+\r
+       /**\r
+        * Returns the height of the texture, which must be a power of two. This will not be called before {@link #load()}.\r
+        */\r
+       public int getHeight ();\r
+}\r
index 9bddb5e..ae1fd39 100644 (file)
@@ -56,13 +56,13 @@ public class Box2DTest extends GdxTest implements InputProcessor {
        private ArrayList<Body> boxes = new ArrayList<Body>();\r
 \r
        /** our ground box **/\r
-       private Body groundBody;\r
+       Body groundBody;\r
 \r
        /** our mouse joint **/\r
        private MouseJoint mouseJoint = null;\r
 \r
        /** a hit body **/\r
-       private Body hitBody = null;\r
+       Body hitBody = null;\r
 \r
        @Override public void create () {\r
                // setup the camera. In Box2D we operate on a\r
index 40c218d..e9986e4 100644 (file)
@@ -61,14 +61,14 @@ public class FFTTest {
                return sum;\r
        }\r
 \r
-       @SuppressWarnings("unused") private static float sum (FloatBuffer buffer) {\r
+       private static float sum (FloatBuffer buffer) {\r
                float sum = 0;\r
                for (int i = 1; i < SAMPLES / 2 + 1; i++)\r
                        sum += buffer.get(i) * 2 / SAMPLES;\r
                return sum;\r
        }\r
 \r
-       @SuppressWarnings("unused") private static void createFlat (float samples[], ShortBuffer shortSamples) {\r
+       private static void createFlat (float samples[], ShortBuffer shortSamples) {\r
                for (int i = 0; i < samples.length; i++) {\r
                        samples[i] = 1;\r
                        shortSamples.put(Short.MAX_VALUE);\r
index d59177e..68658cd 100644 (file)
@@ -64,8 +64,8 @@ public class Pong extends GdxTest {
        private String score = "";\r
 \r
        /**\r
-        * Here we setup all the resources. A {@link MeshRenderer} for the paddles which we use for both, a MeshRenderer for the ball\r
-        * and a {@link Text} for rendering the score.\r
+        * Here we setup all the resources. A MeshRenderer for the paddles which we use for both, a MeshRenderer for the ball\r
+        * and a Text for rendering the score.\r
         */\r
        @Override public void create () {\r
                setupGraphics();\r
@@ -74,7 +74,6 @@ public class Pong extends GdxTest {
 \r
        /**\r
         * This method sets up all the graphics related stuff like the Meshes, the camera and the Font\r
-        * @param app\r
         */\r
        private void setupGraphics () {\r
                //\r
@@ -171,8 +170,6 @@ public class Pong extends GdxTest {
 \r
        /**\r
         * Updates the game state, moves the ball, checks for collisions or whether the ball has left the playfield.\r
-        * \r
-        * @param deltaTime the time elapsed since the last frame\r
         */\r
        private void updateGame () {\r
                // the delta time so we can do frame independant time based movement\r
index 9e385a9..43f9bf4 100644 (file)
@@ -157,7 +157,7 @@ public class TextureRenderTest extends GdxTest {
                public float height;\r
                public float width;\r
 \r
-               private SimpleRect (int index, float x, float y, float width, float height) {\r
+               SimpleRect (int index, float x, float y, float width, float height) {\r
                        this.index = index;\r
                        this.x = x;\r
                        this.y = y;\r
index 20f2880..53f426b 100644 (file)
@@ -27,7 +27,7 @@ public class CollisionFiltering extends Box2DTest {
        private final static short k_smallGroup = 1;\r
        private final static short k_largeGroup = -1;\r
 \r
-       @SuppressWarnings("unused") private final static short k_defaultCategory = 0x0001;\r
+       private final static short k_defaultCategory = 0x0001;\r
        private final static short k_triangleCategory = 0x0002;\r
        private final static short k_boxCategory = 0x0004;\r
        private final static short k_circleCategory = 0x0008;\r