Sfoglia il codice sorgente

last updates for android's shit

mikymod 12 anni fa
parent
commit
2c466afd43

+ 11 - 10
engine/os/android/CrownActivity.java

@@ -45,13 +45,14 @@ import android.view.SurfaceHolder;
 
 import crown.android.CrownEnum;
 
+import java.lang.Thread;
+
+
 /**
 *	BootStrap of Android Application
 */
 public class CrownActivity extends Activity
 {
-
-	// Debug
 	public static String TAG = "crown";
 
 	// Resource attributes
@@ -69,19 +70,19 @@ public class CrownActivity extends Activity
     {
         super.onCreate(savedInstanceState);
 
-		Log.i(TAG, "Crown Activity created");
-
-		// init AssetManager
+		// Init AssetManager
 		mAssetManager = getAssets();
 		CrownLib.initAssetManager(mAssetManager);
 
+		// Init Input
+		mTouch = new CrownTouch(this);
+		mSensor = new CrownSensor(this);
+
 		// init Native Window
         mWindow = new CrownSurfaceView(this);
         setContentView(mWindow);
 
-		// Init Input
-		mTouch = new CrownTouch(this);
-		mSensor = new CrownSensor(this);
+		Log.i(TAG, "Crown Activity created");
     }
 
 //-----------------------------------------------------------------------------
@@ -97,7 +98,6 @@ public class CrownActivity extends Activity
 	{
 		super.onResume();
 
-		// init accelerometer
 		mSensor.startListening(this);
 
 		Log.i(TAG, "Crown Activity resumed");
@@ -108,7 +108,6 @@ public class CrownActivity extends Activity
 	{
 		super.onPause();
 
-		// stop accelerometer
 		mSensor.stopListening();
 
 		Log.i(TAG, "Crown Activity paused");
@@ -126,6 +125,8 @@ public class CrownActivity extends Activity
 	public void onRestart()
 	{
 		super.onRestart();
+
+		Log.i(TAG, "Crown Activity restarted");
 	}
 
 //-----------------------------------------------------------------------------

+ 0 - 42
engine/os/android/CrownEnum.java

@@ -1,42 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-package crown.android;
-
-public class CrownEnum
-{
-	// OSEventType enum in OS.h
-	public static int OSET_NONE				= 0;
-	public static int OSET_KEY_PRESS		= 1;
-	public static int OSET_KEY_RELEASE		= 2;
-	public static int OSET_BUTTON_PRESS		= 3;
-	public static int OSET_BUTTON_RELEASE	= 4;
-	public static int OSET_MOTION_NOTIFY	= 5;
-	public static int OSET_TOUCH_DOWN 		= 6;
-	public static int OSET_TOUCH_MOVE		= 7;
-	public static int OSET_TOUCH_UP			= 8;
-	public static int OSET_ACCELEROMETER	= 9; 
-}

+ 0 - 67
engine/os/android/CrownLib.java

@@ -1,67 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-package crown.android;
-
-import android.content.res.AssetManager;
-import android.view.Surface;
-
-public class CrownLib
-{
-	static 
-	{
-		System.loadLibrary("luajit-5.1");
-		System.loadLibrary("crown");
-	}
-	
-	// Device functions
-	public static native void 		initDevice();
-	public static native void		stopDevice();
-	public static native void		pauseDevice();
-	public static native void		unpauseDevice();
-	public static native void 		shutdownDevice();
-
-	public static native boolean 	isDeviceInit();
-	public static native boolean	isDeviceRunning();
-
-	public static native void 		frame();
-
-	// AssetManager functions
-	public static native void 		initAssetManager(AssetManager assetManager);
-
-	// Window functions
-	public static native void		setWindow(Surface window);
-	public static native void 		setDisplaySize(int width, int height);
-
-	// Renderer functions
-	public static native void		initRenderer();
-	public static native void		shutdownRenderer();
-	public static native void		invalidateRenderer();
-
-	// InputManager functions
-	public static native void 		pushIntEvent(int type, int a, int b, int c, int d);
-	public static native void 		pushFloatEvent(int type, float a, float b, float c, float d);	
-}

+ 0 - 211
engine/os/android/CrownSensor.java

@@ -1,211 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-package crown.android;
-
-import java.util.List;
-import java.lang.Math;
-
-import android.content.Context;
-import android.util.Log;
-import android.hardware.Sensor;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.SensorManager;
-
-import crown.android.CrownEnum;
-
-
-/**
-*	CrownSensor manage sensors for Android Devices.
-*/
-public class CrownSensor
-{
-    private final float MIN_VALUE = -1.0f;
-    private final float MAX_VALUE = 1.0f;
-    private final static float RAD2DEG = (float) (180.0f / Math.PI);
-
-    private SensorManager sensorManager;
-    private Sensor mAccelerometerSensor;
-    private Sensor mCompassSensor;
-    private SensorEventListener mAccelerometerEventListener;
-    private SensorEventListener mCompassEventListener;
-    private boolean isAccelerometerAvailable;
-    private boolean isCompassAvailable;
-
-    private float[] mRotationMatrix;
-    private float[] mGravity;
-    private float[] mLastGravity;
-    private float[] mBufferedAccelGData;
-    private float[] mGeoMagn;
-    private float[] mBufferedMagnetData;
-    private float[] mOrientation;
-
-    private float[] mRotAngle;
- 
-
-//-----------------------------------------------------------------------------------
-    public CrownSensor(Context context)
-    {
-        mRotationMatrix = new float[16];
-        mGravity = new float[3];
-        mLastGravity = new float[3];
-        mGeoMagn = new float[3];
-        mOrientation = new float[3];
-        mRotAngle = new float[3];
-
-        isAccelerometerAvailable = context.getPackageManager().hasSystemFeature("android.hardware.sensor.accelerometer");
-        isCompassAvailable = context.getPackageManager().hasSystemFeature("android.hardware.sensor.compass");
-
-        if (hasAccelerometerSupport())
-        {
-            mAccelerometerEventListener = new SensorEventListener()
-            {
-                public void onAccuracyChanged(Sensor sensor, int accuracy) 
-                {
-                }
-
-                public void onSensorChanged(SensorEvent event)
-                {
-                    mGravity[0] = (mGravity[0] * 2 + event.values[0]) * 0.33334f * RAD2DEG;
-                    mGravity[1] = (mGravity[1] * 2 + event.values[1]) * 0.33334f * RAD2DEG;
-                    mGravity[2] = (mGravity[2] * 2 + event.values[2]) * 0.33334f * RAD2DEG;
-
-                    norm();
-
-                    CrownLib.pushFloatEvent(CrownEnum.OSET_ACCELEROMETER, mGravity[0], mGravity[1], mGravity[2], 0.0f);
-                }
-            };           
-        }
-
-        if (hasCompassSupport())
-        {
-            mCompassEventListener = new SensorEventListener()
-            {
-                public void onAccuracyChanged(Sensor sensor, int accuracy) 
-                {
-                }
-
-                public void onSensorChanged(SensorEvent event)
-                {
-                    mGeoMagn[0] = (mGeoMagn[0] + event.values[0]) * 0.5f;
-                    mGeoMagn[1] = (mGeoMagn[1] + event.values[1]) * 0.5f;
-                    mGeoMagn[2] = (mGeoMagn[2] + event.values[2]) * 0.5f; 
-
-                    // CrownLib.pushFloatEvent(CrownEnum.OSET_ACCELEROMETER, mGeoMagn[0], mGeoMagn[1], mGeoMagn[2], 0.0f);
-                }                
-            };
-        }
-    }
-
-//-----------------------------------------------------------------------------------
-    public boolean startListening(Context context)
-    {
-        sensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
-
-        mAccelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
-        mCompassSensor = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
-
-        sensorManager.registerListener(mAccelerometerEventListener, mAccelerometerSensor, SensorManager.SENSOR_DELAY_GAME);
-        sensorManager.registerListener(mCompassEventListener, mCompassSensor, SensorManager.SENSOR_DELAY_GAME);
-
-        return true;
-    }
-
-//-----------------------------------------------------------------------------------
-    public void stopListening()
-    {
-    	sensorManager.unregisterListener(mAccelerometerEventListener);
-        sensorManager.unregisterListener(mCompassEventListener);
-    }
-
-//-----------------------------------------------------------------------------------
-    public boolean hasAccelerometerSupport()
-    {
-        return isAccelerometerAvailable;       
-    }
-
-//-----------------------------------------------------------------------------------
-    public boolean hasCompassSupport()
-    {   
-        return isCompassAvailable;
-    }
-
- //-----------------------------------------------------------------------------------
-//     private void lowPassFiltering(float x, float y, float z)
-//     {
-//         float updateFreq = 30; // match this to your update speed
-//         float cutOffFreq = 0.9f;
-//         float timeRC = 1.0f / cutOffFreq;
-//         float dt = 1.0f / updateFreq;
-//         float filterConstant = timeRC / (dt + timeRC);
-//         float alpha = filterConstant;                 
-//         float kAccelerometerMinStep = 0.033f;
-//         float kAccelerometerNoiseAttenuation = 3.0f;
-
-//         float d = clamp((Math.abs(norm(mGravity[0], mGravity[1], mGravity[2]) - norm(x, y, z)) / kAccelerometerMinStep - 1.0f), MIN_VALUE, MAX_VALUE);
-//         alpha = d * filterConstant / kAccelerometerNoiseAttenuation + (1.0f - d) * filterConstant;
-
-//         mGravity[0] = (float) (alpha * (mGravity[0] + x - mLastGravity[0]));
-//         mGravity[1] = (float) (alpha * (mGravity[1] + y - mLastGravity[1]));
-//         mGravity[2] = (float) (alpha * (mGravity[2] + z - mLastGravity[2]));
-
-//         mLastGravity[0] = mGravity[0];
-//         mLastGravity[1] = mGravity[1];
-//         mLastGravity[2] = mGravity[2];
-//     }
-
-//-----------------------------------------------------------------------------------
-    private float clamp(float v, float min, float max)
-    {
-        if (v < min)
-        {
-            v = min;
-        }
-        else if (v > max)
-        {
-            v = max;
-        }
-
-        return v;
-    }
-
-//-----------------------------------------------------------------------------------
-    private void norm()
-    {
-        float v = mGravity[0] * mGravity[0] + mGravity[1] * mGravity[1] + mGravity[2] * mGravity[2];
-        float magnitude = (float)Math.sqrt(v);
-        float invMagnitude = 1 / magnitude;
-
-        mGravity[0] *= invMagnitude;
-        mGravity[1] *= invMagnitude;
-        mGravity[2] *= invMagnitude;
-
-        mGravity[0] = clamp(mGravity[0], MIN_VALUE, MAX_VALUE);
-        mGravity[1] = clamp(mGravity[1], MIN_VALUE, MAX_VALUE);
-        mGravity[2] = clamp(mGravity[2], MIN_VALUE, MAX_VALUE);
-    }
-}

+ 0 - 84
engine/os/android/CrownSurfaceView.java

@@ -1,84 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-package crown.android;
-
-import android.content.Context;
-import android.view.Surface;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder;
-
-import android.util.Log;
-
-public class CrownSurfaceView extends SurfaceView implements SurfaceHolder.Callback
-{
-	private final String TAG = "crown";
-
-	//-----------------------------------------------------------------------------
-	public CrownSurfaceView(Context context)
-	{
-		super(context);
-
-		getHolder().addCallback(this);
-
-		setFocusable(true);
-	}
-
-	//-----------------------------------------------------------------------------
-	@Override
-	public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) 
-	{
-		Log.d(TAG, "Crown Surface changed");
-	}
-
-	//-----------------------------------------------------------------------------
-	@Override
-	public void surfaceCreated(SurfaceHolder holder) 
-	{
-		Log.d(TAG, "Crown Surface created");
-
-		CrownLib.setWindow(getHolder().getSurface());
-
-		if (!CrownLib.isDeviceInit())
-		{
-			CrownLib.initDevice();
-		}
-		else
-		{
-			CrownLib.unpauseDevice();
-		}
-	}
-
-	//-----------------------------------------------------------------------------
-	@Override
-	public void surfaceDestroyed(SurfaceHolder holder) 
-	{
-		Log.d(TAG, "Crown Surface destroyed");
-		
-		CrownLib.pauseDevice();
-		CrownLib.invalidateRenderer();
-	}
-}

+ 0 - 90
engine/os/android/CrownTouch.java

@@ -1,90 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-package crown.android;
-
-import android.content.Context;
-import android.util.Log;
-import android.view.MotionEvent;
-
-
-/**
-* CrownTouch manages touch and gesture events passing them to Crown Engine
-*/
-
-//TODO: gestures doesn't work...fix them
-public class CrownTouch
-{
-	private boolean 				isListening;
-
-//-----------------------------------------------------------------------------------
-	public CrownTouch(Context context)
-	{
-		isListening = false;
-	}
-
-//-----------------------------------------------------------------------------------
-	public void onTouch(MotionEvent event)
-	{
-		final int pointerIndex = event.getActionIndex();
-		final int pointerCount = event.getPointerCount();
-
-		final int pointerId = event.getPointerId(pointerIndex);
-		final float x = event.getX(pointerIndex);
-		final float y = event.getY(pointerIndex);
-
-		final int actionMasked = event.getActionMasked();
-
-		switch (actionMasked) 
-		{	
-			case MotionEvent.ACTION_DOWN:
-			case MotionEvent.ACTION_POINTER_DOWN:
-			{
-				CrownLib.pushIntEvent(CrownEnum.OSET_TOUCH_DOWN, pointerId, (int)x, (int)y, 0);
-				break;			
-			}
-
-			case MotionEvent.ACTION_UP:
-			case MotionEvent.ACTION_POINTER_UP:
-			case MotionEvent.ACTION_OUTSIDE:
-			case MotionEvent.ACTION_CANCEL:
-			{
-				CrownLib.pushIntEvent(CrownEnum.OSET_TOUCH_UP, pointerId, (int)x, (int)y, 0);
-				break;			
-			}
-			
-			case MotionEvent.ACTION_MOVE:
-			{
-				for (int index = 0; index < pointerCount; index++)
-				{
-					CrownLib.pushIntEvent(CrownEnum.OSET_TOUCH_MOVE, event.getPointerId(index), (int)event.getX(index), (int)event.getY(index), 0);
-				}
-
-				break;
-			}
-		}
-	}
-}

+ 2 - 2
engine/os/android/OsWindow.cpp

@@ -119,15 +119,15 @@ void OsWindow::set_title(const char* /*title*/)
 //-----------------------------------------------------------------------------
 void OsWindow::frame()
 {
-	// Log::i("window width: %d", ANativeWindow_getWidth(g_android_window));
 }
 
 //-----------------------------------------------------------------------------
-extern "C" void Java_crown_android_CrownLib_setWindow(JNIEnv *env, jclass /*clazz*/, jobject surface)
+extern "C" void Java_crown_android_CrownLib_createWindow(JNIEnv *env, jclass /*clazz*/, jobject surface)
 {
     // obtain a native window from a Java surface
 	CE_ASSERT(surface != 0, "Unable to get Android window");
     g_android_window = ANativeWindow_fromSurface(env, surface);
+    Log::i("Window created");
 }
 
 } // namespace crown

+ 0 - 7
engine/renderers/Renderer.h

@@ -104,7 +104,6 @@ public:
 	static Renderer*		create(Allocator& a);
 	static void				destroy(Allocator& a, Renderer* renderer);
 
-							Renderer() : m_is_valid(true) {}
 	virtual 				~Renderer() {};
 
 	virtual void			init() = 0;
@@ -229,12 +228,6 @@ public:
 	virtual void 			draw_triangles(IndexBufferId id) const = 0;
 				
 	virtual void 			draw_lines(const float* vertices, const float* colors, uint32_t count) = 0;
-
-	inline	void			invalidate() { m_is_valid = false; }
-
-public:
-
-	bool 					m_is_valid;
 };
 
 } // namespace crown

+ 0 - 11
engine/renderers/gles/GLESRenderer.cpp

@@ -180,15 +180,11 @@ void GLESRenderer::init()
 	GL_CHECK(glDisable(GL_DITHER));
 
 	Log::i("OpenGL Renderer initialized.");
-
-	load_default_shaders();
 }
 
 //-----------------------------------------------------------------------------
 void GLESRenderer::shutdown()
 {
-	unload_default_shaders();
-
 	m_context.destroy_context();
 }
 
@@ -759,13 +755,6 @@ void GLESRenderer::get_scissor_params(int32_t& x, int32_t& y, int32_t& width, in
 //-----------------------------------------------------------------------------
 void GLESRenderer::frame()
 {
-	if (!m_is_valid)
-	{
-		m_context.destroy_context();
-		m_context.create_context();
-		m_is_valid = true;
-	}
-
 	// Clear frame/depth buffer
 	GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
 	GL_CHECK(glClearColor(0.5f, 0.5f, 0.5f, 0.5f));

+ 7 - 13
engine/renderers/gles/egl/GLContext.cpp

@@ -79,19 +79,13 @@ GLContext::GLContext()
 //-----------------------------------------------------------------------------
 void GLContext::create_context()
 {
-	// Screen format rgbx8888 with no alpha channel,
-	// maybe it is wrong but is for testing
-	EGLint attrib_list[] =
-	{
-		#ifdef ANDROID
-			EGL_DEPTH_SIZE,  16,
-		#else
-			EGL_DEPTH_SIZE,  24,
-		#endif
-		EGL_SURFACE_TYPE,    EGL_WINDOW_BIT,
-		EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
-		EGL_NONE
-	};
+    const EGLint attrib_list[] = {
+            EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+            EGL_BLUE_SIZE, 8,
+            EGL_GREEN_SIZE, 8,
+            EGL_RED_SIZE, 8,
+            EGL_NONE
+    };
 
 	EGLint attributes[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };