diff --git a/engine/src/android/com/jme3/input/android/AndroidInput.java b/engine/src/android/com/jme3/input/android/AndroidInput.java
index a6d56f7a6..51e54efdf 100644
--- a/engine/src/android/com/jme3/input/android/AndroidInput.java
+++ b/engine/src/android/com/jme3/input/android/AndroidInput.java
@@ -20,6 +20,11 @@ import com.jme3.math.Vector2f;
import com.jme3.util.RingBuffer;
+/**
+ * AndroidInput
is one of the main components that connect jme with android. Is derived from GLSurfaceView and handles all Inputs
+ * @author larynx
+ *
+ */
public class AndroidInput extends GLSurfaceView implements TouchInput,
GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener
{
@@ -190,7 +195,7 @@ public class AndroidInput extends GLSurfaceView implements TouchInput,
else
{
evt = eventPool.pop();
- }
+ }
return evt;
}
/**
@@ -218,6 +223,7 @@ public class AndroidInput extends GLSurfaceView implements TouchInput,
touch.set(Type.DOWN, event.getX(p), event.getY(p), 0, 0);
touch.setPointerId(event.getPointerId(p));
touch.setTime(event.getEventTime());
+ touch.setPressure(event.getPressure(p));
processEvent(touch);
}
@@ -233,6 +239,7 @@ public class AndroidInput extends GLSurfaceView implements TouchInput,
touch.set(Type.UP, event.getX(p), event.getY(p), 0, 0);
touch.setPointerId(event.getPointerId(p));
touch.setTime(event.getEventTime());
+ touch.setPressure(event.getPressure(p));
processEvent(touch);
}
@@ -253,6 +260,7 @@ public class AndroidInput extends GLSurfaceView implements TouchInput,
touch.set(Type.MOVE, event.getX(p), event.getY(p), event.getX(p) - lastPos.x, event.getY(p) - lastPos.y);
touch.setPointerId(event.getPointerId(p));
touch.setTime(event.getEventTime());
+ touch.setPressure(event.getPressure(p));
processEvent(touch);
lastPos.set(event.getX(p), event.getY(p));
}
diff --git a/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java b/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java
index 5c8793ece..841de2b68 100644
--- a/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java
+++ b/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java
@@ -32,7 +32,6 @@
package com.jme3.renderer.android;
-import com.jme3.asset.TextureKey;
import com.jme3.light.LightList;
import com.jme3.material.RenderState;
import com.jme3.math.ColorRGBA;
@@ -58,7 +57,6 @@ import com.jme3.shader.Shader;
import com.jme3.shader.Shader.ShaderSource;
import com.jme3.shader.Shader.ShaderType;
import com.jme3.shader.Uniform;
-import com.jme3.system.JmeSystem;
import com.jme3.texture.FrameBuffer;
import com.jme3.texture.FrameBuffer.RenderBuffer;
import com.jme3.texture.Image;
@@ -385,12 +383,19 @@ public class OGLESShaderRenderer implements Renderer {
*/
String extensions = GLES20.glGetString(GLES20.GL_EXTENSIONS);
-
- logger.info("GL_EXTENSIONS: " + extensions);
+ logger.info("GL_EXTENSIONS: " + extensions);
+
+ GLES20.glGetIntegerv(GLES20.GL_COMPRESSED_TEXTURE_FORMATS, intBuf16);
+ for (int i = 0; i < intBuf16.limit(); i++)
+ {
+ logger.info("Compressed Texture Formats: " + intBuf16.get(i));
+ }
if (extensions.contains("GL_OES_texture_npot"))
powerOf2 = true;
+
+
applyRenderState(RenderState.DEFAULT);
// GLES20.glClearDepthf(1.0f);
@@ -1834,14 +1839,31 @@ public class OGLESShaderRenderer implements Renderer {
// Upload a cube map / sky box
@SuppressWarnings("unchecked")
List bmps = (List)img.getEfficentData();
- if (bmps.size() != 6)
+ if (bmps != null)
{
- throw new UnsupportedOperationException("Invalid texture: " + img +
- "Cubemap textures must contain 6 data units." );
+ // Native android bitmap
+ if (bmps.size() != 6)
+ {
+ throw new UnsupportedOperationException("Invalid texture: " + img +
+ "Cubemap textures must contain 6 data units." );
+ }
+ for (int i = 0; i < 6; i++)
+ {
+ TextureUtil.uploadTextureBitmap(GLES20.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, bmps.get(i), false, powerOf2);
+ }
}
- for (int i = 0; i < 6; i++)
+ else
{
- TextureUtil.uploadTextureBitmap(GLES20.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, bmps.get(i), false, powerOf2);
+ // Standard jme3 image data
+ List data = img.getData();
+ if (data.size() != 6) {
+ logger.log(Level.WARNING, "Invalid texture: {0}\n"
+ + "Cubemap textures must contain 6 data units.", img);
+ return;
+ }
+ for (int i = 0; i < 6; i++) {
+ TextureUtil.uploadTexture(img, GLES20.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, i, 0, tdc, false, powerOf2);
+ }
}
}
else
diff --git a/engine/src/android/com/jme3/renderer/android/TextureUtil.java b/engine/src/android/com/jme3/renderer/android/TextureUtil.java
index 9e34d32cb..ebd1b58c5 100644
--- a/engine/src/android/com/jme3/renderer/android/TextureUtil.java
+++ b/engine/src/android/com/jme3/renderer/android/TextureUtil.java
@@ -1,6 +1,10 @@
package com.jme3.renderer.android;
+
import android.graphics.Bitmap;
+import android.opengl.GLES10;
+import android.opengl.GLES11;
+import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import com.jme3.math.FastMath;
@@ -8,6 +12,7 @@ import com.jme3.texture.Image;
import com.jme3.texture.Image.Format;
import java.nio.ByteBuffer;
import javax.microedition.khronos.opengles.GL10;
+import javax.microedition.khronos.opengles.GL10Ext;
public class TextureUtil {
@@ -32,8 +37,10 @@ public class TextureUtil {
case RGBA16:
case RGBA8:
return GL10.GL_RGBA;
+ case DXT1A:
+ throw new UnsupportedOperationException("Unsupported format: " + fmt);
default:
- throw new UnsupportedOperationException("Unrecognized format: "+fmt);
+ throw new UnsupportedOperationException("Unrecognized format: " + fmt);
}
}
@@ -189,6 +196,9 @@ public class TextureUtil {
format = GL10.GL_RGBA;
dataType = GL10.GL_UNSIGNED_BYTE;
break;
+ case DXT1A:
+ format = GLES20.GL_COMPRESSED_TEXTURE_FORMATS;
+ dataType = GL10.GL_UNSIGNED_BYTE;
default:
throw new UnsupportedOperationException("Unrecognized format: "+fmt);
}