Main repository of MikuMikuStudio
リビジョン | 25f01b6ead42f9f03970ec50660afc39ed54891e (tree) |
---|---|
日時 | 2013-03-04 18:30:24 |
作者 | remy.bouquet@gmail.com <remy.bouquet@gmai...> |
コミッター | remy.bouquet@gmail.com |
Android : changed the way the pixel config is passed to the OGLESContext. It's now passed in the appSettings.
This is a first step toward a generalization of the use of appSettings in the AndroidHarness.
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10458 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
@@ -25,6 +25,7 @@ import com.jme3.input.event.TouchEvent; | ||
25 | 25 | import com.jme3.renderer.android.AndroidGLSurfaceView; |
26 | 26 | import com.jme3.system.AppSettings; |
27 | 27 | import com.jme3.system.SystemListener; |
28 | +import com.jme3.system.android.AndroidConfigChooser; | |
28 | 29 | import com.jme3.system.android.AndroidConfigChooser.ConfigType; |
29 | 30 | import com.jme3.system.android.JmeAndroidSystem; |
30 | 31 | import com.jme3.system.android.OGLESContext; |
@@ -43,12 +44,10 @@ import java.util.logging.Logger; | ||
43 | 44 | public class AndroidHarness extends Activity implements TouchListener, DialogInterface.OnClickListener, SystemListener { |
44 | 45 | |
45 | 46 | protected final static Logger logger = Logger.getLogger(AndroidHarness.class.getName()); |
46 | - | |
47 | 47 | /** |
48 | 48 | * The application class to start |
49 | 49 | */ |
50 | 50 | protected String appClass = "jme3test.android.Test"; |
51 | - | |
52 | 51 | /** |
53 | 52 | * The jme3 application object |
54 | 53 | */ |
@@ -59,55 +58,52 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt | ||
59 | 58 | * RGBA8888 or better if supported by the hardware |
60 | 59 | */ |
61 | 60 | protected ConfigType eglConfigType = ConfigType.FASTEST; |
62 | - | |
63 | 61 | /** |
64 | 62 | * If true all valid and not valid egl configs are logged |
63 | + * @deprecated this has no use | |
65 | 64 | */ |
65 | + @Deprecated | |
66 | 66 | protected boolean eglConfigVerboseLogging = false; |
67 | - | |
67 | + | |
68 | + /** | |
69 | + * set to 2, 4 to enable multisampling. | |
70 | + */ | |
71 | +// protected int antiAliasingSamples = 0; | |
68 | 72 | /** |
69 | - * If true Android Sensors are used as simulated Joysticks | |
70 | - * Users can use the Android sensor feedback through the RawInputListener | |
71 | - * or by registering JoyAxisTriggers. | |
73 | + * If true Android Sensors are used as simulated Joysticks Users can use the | |
74 | + * Android sensor feedback through the RawInputListener or by registering | |
75 | + * JoyAxisTriggers. | |
72 | 76 | */ |
73 | 77 | protected boolean joystickEventsEnabled = false; |
74 | - | |
75 | 78 | /** |
76 | 79 | * If true MouseEvents are generated from TouchEvents |
77 | 80 | */ |
78 | 81 | protected boolean mouseEventsEnabled = true; |
79 | - | |
80 | 82 | /** |
81 | 83 | * Flip X axis |
82 | 84 | */ |
83 | 85 | protected boolean mouseEventsInvertX = false; |
84 | - | |
85 | 86 | /** |
86 | 87 | * Flip Y axis |
87 | 88 | */ |
88 | 89 | protected boolean mouseEventsInvertY = false; |
89 | - | |
90 | 90 | /** |
91 | 91 | * if true finish this activity when the jme app is stopped |
92 | 92 | */ |
93 | 93 | protected boolean finishOnAppStop = true; |
94 | - | |
95 | 94 | /** |
96 | 95 | * set to false if you don't want the harness to handle the exit hook |
97 | 96 | */ |
98 | 97 | protected boolean handleExitHook = true; |
99 | - | |
100 | 98 | /** |
101 | 99 | * Title of the exit dialog, default is "Do you want to exit?" |
102 | 100 | */ |
103 | 101 | protected String exitDialogTitle = "Do you want to exit?"; |
104 | - | |
105 | 102 | /** |
106 | 103 | * Message of the exit dialog, default is "Use your home key to bring this |
107 | 104 | * app into the background or exit to terminate it." |
108 | 105 | */ |
109 | 106 | protected String exitDialogMessage = "Use your home key to bring this app into the background or exit to terminate it."; |
110 | - | |
111 | 107 | /** |
112 | 108 | * Set the screen window mode. If screenFullSize is true, then the |
113 | 109 | * notification bar and title bar are removed and the screen covers the |
@@ -116,20 +112,17 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt | ||
116 | 112 | * false, then the title bar is also displayed under the notification bar. |
117 | 113 | */ |
118 | 114 | protected boolean screenFullScreen = true; |
119 | - | |
120 | 115 | /** |
121 | 116 | * if screenShowTitle is true while screenFullScreen is false, then the |
122 | 117 | * title bar is also displayed under the notification bar |
123 | 118 | */ |
124 | 119 | protected boolean screenShowTitle = true; |
125 | - | |
126 | 120 | /** |
127 | 121 | * Splash Screen picture Resource ID. If a Splash Screen is desired, set |
128 | 122 | * splashPicID to the value of the Resource ID (i.e. R.drawable.picname). If |
129 | 123 | * splashPicID = 0, then no splash screen will be displayed. |
130 | 124 | */ |
131 | 125 | protected int splashPicID = 0; |
132 | - | |
133 | 126 | /** |
134 | 127 | * Set the screen orientation, default is SENSOR |
135 | 128 | * ActivityInfo.SCREEN_ORIENTATION_* constants package |
@@ -200,7 +193,10 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt | ||
200 | 193 | settings.setEmulateMouse(mouseEventsEnabled); |
201 | 194 | settings.setEmulateMouseFlipAxis(mouseEventsInvertX, mouseEventsInvertY); |
202 | 195 | settings.setUseJoysticks(joystickEventsEnabled); |
196 | +// settings.setSamples(antiAliasingSamples); | |
203 | 197 | settings.setResolution(disp.getWidth(), disp.getHeight()); |
198 | + settings.put(AndroidConfigChooser.SETTINGS_CONFIG_TYPE, eglConfigType); | |
199 | + | |
204 | 200 | |
205 | 201 | // Create application instance |
206 | 202 | try { |
@@ -221,7 +217,7 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt | ||
221 | 217 | } |
222 | 218 | |
223 | 219 | ctx = (OGLESContext) app.getContext(); |
224 | - view = ctx.createView(eglConfigType, eglConfigVerboseLogging); | |
220 | + view = ctx.createView(); | |
225 | 221 | // AndroidHarness wraps the app as a SystemListener. |
226 | 222 | ctx.setSystemListener(this); |
227 | 223 | layoutDisplay(); |
@@ -401,7 +397,6 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt | ||
401 | 397 | switch (evt.getType()) { |
402 | 398 | case KEY_UP: |
403 | 399 | runOnUiThread(new Runnable() { |
404 | - | |
405 | 400 | @Override |
406 | 401 | public void run() { |
407 | 402 | AlertDialog dialog = new AlertDialog.Builder(AndroidHarness.this) // .setIcon(R.drawable.alert_dialog_icon) |
@@ -438,12 +433,12 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt | ||
438 | 433 | } |
439 | 434 | |
440 | 435 | if (view.getParent() != null) { |
441 | - ((ViewGroup)view.getParent()).removeView(view); | |
436 | + ((ViewGroup) view.getParent()).removeView(view); | |
442 | 437 | } |
443 | 438 | frameLayout.addView(view); |
444 | 439 | |
445 | 440 | if (splashImageView.getParent() != null) { |
446 | - ((ViewGroup)splashImageView.getParent()).removeView(splashImageView); | |
441 | + ((ViewGroup) splashImageView.getParent()).removeView(splashImageView); | |
447 | 442 | } |
448 | 443 | frameLayout.addView(splashImageView, lp); |
449 | 444 |
@@ -461,7 +456,6 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt | ||
461 | 456 | if (frameLayout != null) { |
462 | 457 | if (splashImageView != null) { |
463 | 458 | this.runOnUiThread(new Runnable() { |
464 | - | |
465 | 459 | @Override |
466 | 460 | public void run() { |
467 | 461 | splashImageView.setVisibility(View.INVISIBLE); |
@@ -2,6 +2,8 @@ package com.jme3.system.android; | ||
2 | 2 | |
3 | 3 | import android.graphics.PixelFormat; |
4 | 4 | import android.opengl.GLSurfaceView.EGLConfigChooser; |
5 | +import com.jme3.system.AppSettings; | |
6 | +import java.util.logging.Level; | |
5 | 7 | import java.util.logging.Logger; |
6 | 8 | import javax.microedition.khronos.egl.EGL10; |
7 | 9 | import javax.microedition.khronos.egl.EGLConfig; |
@@ -15,11 +17,12 @@ import javax.microedition.khronos.egl.EGLDisplay; | ||
15 | 17 | public class AndroidConfigChooser implements EGLConfigChooser { |
16 | 18 | |
17 | 19 | private static final Logger logger = Logger.getLogger(AndroidConfigChooser.class.getName()); |
20 | + public final static String SETTINGS_CONFIG_TYPE = "configType"; | |
18 | 21 | protected int clientOpenGLESVersion = 0; |
19 | 22 | protected EGLConfig bestConfig = null; |
20 | 23 | protected EGLConfig fastestConfig = null; |
21 | 24 | protected EGLConfig choosenConfig = null; |
22 | - protected ConfigType type; | |
25 | + protected AppSettings settings; | |
23 | 26 | protected int pixelFormat; |
24 | 27 | protected boolean verbose = false; |
25 | 28 | private final static int EGL_OPENGL_ES2_BIT = 4; |
@@ -29,24 +32,59 @@ public class AndroidConfigChooser implements EGLConfigChooser { | ||
29 | 32 | /** |
30 | 33 | * RGB565, 0 alpha, 16 depth, 0 stencil |
31 | 34 | */ |
32 | - FASTEST, | |
35 | + FASTEST(5, 6, 5, 0, 16, 0, 5, 6, 5, 0, 16, 0), | |
33 | 36 | /** |
34 | 37 | * RGB???, 0 alpha, >=16 depth, 0 stencil |
35 | 38 | */ |
36 | - BEST, | |
39 | + BEST(8, 8, 8, 0, 32, 0, 8, 8, 8, 0, 16, 0), | |
37 | 40 | /** |
38 | 41 | * Turn off config chooser and use hardcoded |
39 | 42 | * setEGLContextClientVersion(2); setEGLConfigChooser(5, 6, 5, 0, 16, |
40 | 43 | * 0); |
41 | 44 | */ |
42 | - LEGACY, | |
45 | + LEGACY(5, 6, 5, 0, 16, 0, 5, 6, 5, 0, 16, 0), | |
43 | 46 | /** |
44 | 47 | * RGB???, 8 alpha, >=16 depth, 0 stencil |
45 | 48 | */ |
46 | - BEST_TRANSLUCENT,} | |
49 | + BEST_TRANSLUCENT(8, 8, 8, 8, 32, 0, 8, 8, 8, 8, 16, 0); | |
50 | + /** | |
51 | + * red, green, blue, alpha, depth, stencil | |
52 | + */ | |
53 | + int r, g, b, a, d, s; | |
54 | + /** | |
55 | + * fallback | |
56 | + */ | |
57 | + int fbr, fbg, fbb, fba, fbd, fbs; | |
58 | + | |
59 | + private ConfigType(int r, int g, int b, int a, int d, int s, int fbr, int fbg, int fbb, int fba, int fbd, int fbs) { | |
60 | + this.r = r; | |
61 | + this.g = g; | |
62 | + this.b = b; | |
63 | + this.a = a; | |
64 | + this.d = d; | |
65 | + this.s = s; | |
66 | + this.fbr = fbr; | |
67 | + this.fbg = fbg; | |
68 | + this.fbb = fbb; | |
69 | + this.fba = fba; | |
70 | + this.fbd = fbd; | |
71 | + this.fbs = fbs; | |
72 | + } | |
73 | + } | |
47 | 74 | |
75 | + /** | |
76 | + * | |
77 | + * @param type | |
78 | + * @deprecated use AndroidConfigChooser(AppSettings settings) | |
79 | + */ | |
80 | + @Deprecated | |
48 | 81 | public AndroidConfigChooser(ConfigType type) { |
49 | - this.type = type; | |
82 | + this.settings = new AppSettings(true); | |
83 | + settings.put(SETTINGS_CONFIG_TYPE, type); | |
84 | + } | |
85 | + | |
86 | + public AndroidConfigChooser(AppSettings settings) { | |
87 | + this.settings = settings; | |
50 | 88 | } |
51 | 89 | |
52 | 90 | /** |
@@ -66,34 +104,42 @@ public class AndroidConfigChooser implements EGLConfigChooser { | ||
66 | 104 | * @param display |
67 | 105 | * @return true if successfull, false if no config was found |
68 | 106 | */ |
69 | - public boolean findConfig(EGL10 egl, EGLDisplay display) { | |
70 | - ComponentSizeChooser compChooser = null; | |
71 | - switch (type) { | |
72 | - case BEST: | |
73 | - compChooser = new ComponentSizeChooser(8, 8, 8, 0, 32, 0); | |
74 | - choosenConfig = compChooser.chooseConfig(egl, display); | |
75 | - if (choosenConfig == null) { | |
76 | - compChooser = new ComponentSizeChooser(8, 8, 8, 0, 16, 0); | |
77 | - choosenConfig = compChooser.chooseConfig(egl, display); | |
78 | - } | |
79 | - logger.fine("JME3 using best EGL configuration available here: "); | |
80 | - break; | |
81 | - case BEST_TRANSLUCENT: | |
82 | - compChooser = new ComponentSizeChooser(8, 8, 8, 8, 32, 0); | |
83 | - choosenConfig = compChooser.chooseConfig(egl, display); | |
84 | - if (choosenConfig == null) { | |
85 | - compChooser = new ComponentSizeChooser(8, 8, 8, 8, 16, 0); | |
86 | - choosenConfig = compChooser.chooseConfig(egl, display); | |
87 | - } | |
88 | - logger.fine("JME3 using best EGL configuration available here with translucent pixels: "); | |
89 | - break; | |
90 | - case FASTEST: | |
91 | - compChooser = new ComponentSizeChooser(5, 6, 5, 0, 16, 0); | |
92 | - choosenConfig = compChooser.chooseConfig(egl, display); | |
93 | - logger.fine("JME3 using fastest EGL configuration available here: "); | |
94 | - break; | |
95 | - | |
107 | + public boolean findConfig(EGL10 egl, EGLDisplay display) { | |
108 | + ConfigType type = (ConfigType) settings.get(SETTINGS_CONFIG_TYPE); | |
109 | + | |
110 | + ComponentSizeChooser compChooser = new ComponentSizeChooser(type.r, type.g, type.b, type.a, type.d, type.s, 4,1,2); | |
111 | + choosenConfig = compChooser.chooseConfig(egl, display); | |
112 | + if (choosenConfig == null) { | |
113 | + compChooser = new ComponentSizeChooser(type.fbr, type.fbg, type.fbb, type.fba, type.fbd, type.fbs); | |
114 | + choosenConfig = compChooser.chooseConfig(egl, display); | |
96 | 115 | } |
116 | + logger.log(Level.FINE, "JME3 using {0} EGL configuration available here: ", type.name()); | |
117 | +// switch (type) { | |
118 | +// case BEST: | |
119 | +// compChooser = new ComponentSizeChooser(8, 8, 8, 0, 32, 0); | |
120 | +// choosenConfig = compChooser.chooseConfig(egl, display); | |
121 | +// if (choosenConfig == null) { | |
122 | +// compChooser = new ComponentSizeChooser(8, 8, 8, 0, 16, 0); | |
123 | +// choosenConfig = compChooser.chooseConfig(egl, display); | |
124 | +// } | |
125 | +// logger.fine("JME3 using best EGL configuration available here: "); | |
126 | +// break; | |
127 | +// case BEST_TRANSLUCENT: | |
128 | +// compChooser = new ComponentSizeChooser(8, 8, 8, 8, 32, 0); | |
129 | +// choosenConfig = compChooser.chooseConfig(egl, display); | |
130 | +// if (choosenConfig == null) { | |
131 | +// compChooser = new ComponentSizeChooser(8, 8, 8, 8, 16, 0); | |
132 | +// choosenConfig = compChooser.chooseConfig(egl, display); | |
133 | +// } | |
134 | +// logger.fine("JME3 using best EGL configuration available here with translucent pixels: "); | |
135 | +// break; | |
136 | +// case FASTEST: | |
137 | +// compChooser = new ComponentSizeChooser(5, 6, 5, 0, 16, 0); | |
138 | +// choosenConfig = compChooser.chooseConfig(egl, display); | |
139 | +// logger.fine("JME3 using fastest EGL configuration available here: "); | |
140 | +// break; | |
141 | +// | |
142 | +// } | |
97 | 143 | |
98 | 144 | if (choosenConfig != null) { |
99 | 145 | logger.fine("JME3 using choosen config: "); |
@@ -173,6 +219,12 @@ public class AndroidConfigChooser implements EGLConfigChooser { | ||
173 | 219 | |
174 | 220 | egl.eglGetConfigAttrib(display, conf, EGL10.EGL_SURFACE_TYPE, value); |
175 | 221 | logger.fine(String.format("EGL_SURFACE_TYPE = %d", value[0])); |
222 | + | |
223 | + egl.eglGetConfigAttrib(display, conf, EGL10.EGL_SAMPLE_BUFFERS, value); | |
224 | + logger.fine(String.format("EGL_SAMPLE_BUFFERS = %d", value[0])); | |
225 | + | |
226 | + egl.eglGetConfigAttrib(display, conf, EGL10.EGL_SAMPLES, value); | |
227 | + logger.fine(String.format("EGL_SAMPLES = %d", value[0])); | |
176 | 228 | } |
177 | 229 | |
178 | 230 | public int getClientOpenGLESVersion() { |
@@ -277,6 +329,9 @@ public class AndroidConfigChooser implements EGLConfigChooser { | ||
277 | 329 | protected int mAlphaSize; |
278 | 330 | protected int mDepthSize; |
279 | 331 | protected int mStencilSize; |
332 | + protected int mRenderableType; | |
333 | + protected int mSampleBuffers; | |
334 | + protected int mSamples; | |
280 | 335 | |
281 | 336 | public ComponentSizeChooser(int redSize, int greenSize, int blueSize, |
282 | 337 | int alphaSize, int depthSize, int stencilSize) { |
@@ -297,6 +352,31 @@ public class AndroidConfigChooser implements EGLConfigChooser { | ||
297 | 352 | mStencilSize = stencilSize; |
298 | 353 | } |
299 | 354 | |
355 | + public ComponentSizeChooser(int redSize, int greenSize, int blueSize, | |
356 | + int alphaSize, int depthSize, int stencilSize, int renderableType, int sampleBuffers, int samples) { | |
357 | + super(new int[]{ | |
358 | + EGL10.EGL_RED_SIZE, redSize, | |
359 | + EGL10.EGL_GREEN_SIZE, greenSize, | |
360 | + EGL10.EGL_BLUE_SIZE, blueSize, | |
361 | + EGL10.EGL_ALPHA_SIZE, alphaSize, | |
362 | + EGL10.EGL_DEPTH_SIZE, depthSize, | |
363 | + EGL10.EGL_STENCIL_SIZE, stencilSize, | |
364 | + EGL10.EGL_RENDERABLE_TYPE, renderableType, | |
365 | + EGL10.EGL_SAMPLE_BUFFERS, sampleBuffers, | |
366 | + EGL10.EGL_SAMPLES, samples, | |
367 | + EGL10.EGL_NONE}); | |
368 | + mValue = new int[1]; | |
369 | + mRedSize = redSize; | |
370 | + mGreenSize = greenSize; | |
371 | + mBlueSize = blueSize; | |
372 | + mAlphaSize = alphaSize; | |
373 | + mDepthSize = depthSize; | |
374 | + mStencilSize = stencilSize; | |
375 | + mRenderableType = renderableType; | |
376 | + mSampleBuffers = sampleBuffers; | |
377 | + mSamples = samples; | |
378 | + } | |
379 | + | |
300 | 380 | @Override |
301 | 381 | public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display, EGLConfig[] configs) { |
302 | 382 |
@@ -315,11 +395,9 @@ public class AndroidConfigChooser implements EGLConfigChooser { | ||
315 | 395 | int s = findConfigAttrib(egl, display, config, |
316 | 396 | EGL10.EGL_STENCIL_SIZE, 0); |
317 | 397 | |
318 | - if (( | |
319 | - r == mRedSize) && (g == mGreenSize) | |
398 | + if ((r == mRedSize) && (g == mGreenSize) | |
320 | 399 | && (b == mBlueSize) && (a == mAlphaSize) |
321 | - && (d == mDepthSize) && (s == mStencilSize) | |
322 | - ) { | |
400 | + && (d == mDepthSize) && (s == mStencilSize)) { | |
323 | 401 | return config; |
324 | 402 | } |
325 | 403 | } |
@@ -66,7 +66,7 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex | ||
66 | 66 | protected final AtomicBoolean created = new AtomicBoolean(false); |
67 | 67 | protected final AtomicBoolean renderable = new AtomicBoolean(false); |
68 | 68 | protected final AtomicBoolean needClose = new AtomicBoolean(false); |
69 | - protected final AppSettings settings = new AppSettings(true); | |
69 | + protected AppSettings settings = new AppSettings(true); | |
70 | 70 | |
71 | 71 | /* |
72 | 72 | * >= OpenGL ES 2.0 (Android 2.2+) |
@@ -91,24 +91,41 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex | ||
91 | 91 | public Type getType() { |
92 | 92 | return Type.Display; |
93 | 93 | } |
94 | - | |
94 | + | |
95 | 95 | /** |
96 | - * <code>createView</code> creates the GLSurfaceView that the | |
97 | - * renderer will draw to. | |
98 | - * <p> | |
99 | - * The result GLSurfaceView will receive input events and forward | |
100 | - * them to the Application. Any rendering will be done into | |
101 | - * the GLSurfaceView. Only one GLSurfaceView can be created at this time. | |
102 | - * The given configType specifies how to determine the display configuration. | |
96 | + * <code>createView</code> creates the GLSurfaceView that the renderer will | |
97 | + * draw to. <p> The result GLSurfaceView will receive input events and | |
98 | + * forward them to the Application. Any rendering will be done into the | |
99 | + * GLSurfaceView. Only one GLSurfaceView can be created at this time. The | |
100 | + * given configType specifies how to determine the display configuration. | |
103 | 101 | * |
104 | 102 | * |
105 | 103 | * @param configType ConfigType.FASTEST (Default) | ConfigType.LEGACY | |
106 | 104 | * ConfigType.BEST |
107 | 105 | * @param eglConfigVerboseLogging if true show all found configs |
108 | 106 | * @return GLSurfaceView The newly created view |
107 | + * @deprecated AndroidGLSurfaceView createView() | |
108 | + * and put the configType in the appSettigs with the key AndroidConfigChoose.SETTINGS_CONFIG_TYPE | |
109 | 109 | */ |
110 | + @Deprecated | |
110 | 111 | public AndroidGLSurfaceView createView(ConfigType configType, boolean eglConfigVerboseLogging) { |
111 | - AndroidGLSurfaceView view; | |
112 | + settings.put(AndroidConfigChooser.SETTINGS_CONFIG_TYPE, configType); | |
113 | + return this.createView(); | |
114 | + } | |
115 | + /** | |
116 | + * <code>createView</code> creates the GLSurfaceView that the renderer will | |
117 | + * draw to. <p> The result GLSurfaceView will receive input events and | |
118 | + * forward them to the Application. Any rendering will be done into the | |
119 | + * GLSurfaceView. Only one GLSurfaceView can be created at this time. The | |
120 | + * given configType specifies how to determine the display configuration. | |
121 | + * | |
122 | + * | |
123 | + * @param eglConfigVerboseLogging if true show all found configs | |
124 | + * @return GLSurfaceView The newly created view | |
125 | + */ | |
126 | + public AndroidGLSurfaceView createView() { | |
127 | + AndroidGLSurfaceView view; | |
128 | + ConfigType configType = (ConfigType)settings.get(AndroidConfigChooser.SETTINGS_CONFIG_TYPE); | |
112 | 129 | |
113 | 130 | // Start to set up the view |
114 | 131 | view = new AndroidGLSurfaceView(JmeAndroidSystem.getActivity().getApplication()); |
@@ -136,7 +153,7 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex | ||
136 | 153 | |
137 | 154 | try { |
138 | 155 | // Create a config chooser |
139 | - AndroidConfigChooser configChooser = new AndroidConfigChooser(configType); | |
156 | + AndroidConfigChooser configChooser = new AndroidConfigChooser(settings); | |
140 | 157 | // Init chooser |
141 | 158 | if (!configChooser.findConfig(egl, display)) { |
142 | 159 | listener.handleError("Unable to find suitable EGL config", null); |
@@ -196,7 +213,6 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex | ||
196 | 213 | |
197 | 214 | // Setup unhandled Exception Handler |
198 | 215 | Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { |
199 | - | |
200 | 216 | public void uncaughtException(Thread thread, Throwable thrown) { |
201 | 217 | listener.handleError("Exception thrown in " + thread.toString(), thrown); |
202 | 218 | } |
@@ -399,7 +415,6 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex | ||
399 | 415 | |
400 | 416 | final Activity activity = JmeAndroidSystem.getActivity(); |
401 | 417 | activity.runOnUiThread(new Runnable() { |
402 | - | |
403 | 418 | @Override |
404 | 419 | public void run() { |
405 | 420 |
@@ -436,7 +451,6 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex | ||
436 | 451 | |
437 | 452 | AlertDialog dialogTextInput = new AlertDialog.Builder(activity).setTitle(title).setView(layoutTextDialogInput).setPositiveButton("OK", |
438 | 453 | new DialogInterface.OnClickListener() { |
439 | - | |
440 | 454 | public void onClick(DialogInterface dialog, int whichButton) { |
441 | 455 | /* User clicked OK, send COMPLETE action |
442 | 456 | * and text */ |
@@ -444,7 +458,6 @@ public class OGLESContext implements JmeContext, GLSurfaceView.Renderer, SoftTex | ||
444 | 458 | } |
445 | 459 | }).setNegativeButton("Cancel", |
446 | 460 | new DialogInterface.OnClickListener() { |
447 | - | |
448 | 461 | public void onClick(DialogInterface dialog, int whichButton) { |
449 | 462 | /* User clicked CANCEL, send CANCEL action |
450 | 463 | * and text */ |