Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad OpenGL from listview item click
    primarykey
    data
    text
    <p>What I'm trying to do here, is to load a OpenGL context when I click a item of the listview in main activity.</p> <p>Simple as it looks! But I really don't know how to connect main activity with the OpenGL activity. Could any one give me some hint?</p> <p>Thank you!!</p> <p>EDIT: ADD some code here:</p> <p>In main activity:</p> <pre><code>listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent launchGL = new Intent(getApplicationContext(), OpenGLActivity.class); startActivity(launchGL); } }); </code></pre> <p>In OpenGLActivity:</p> <pre><code>public class OpenGLActivity extends Activity { private GLSurfaceView mGLSurfaceView; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mGLSurfaceView = new GLSurfaceView(this); // Check if the system supports OpenGL ES 2.0. final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); final boolean supportsEs2 = configurationInfo.reqGlEsVersion &gt;= 0x20000; if (supportsEs2) { // Request an OpenGL ES 2.0 compatible context. mGLSurfaceView.setEGLContextClientVersion(2); // Set the renderer to our demo renderer, defined below. mGLSurfaceView.setRenderer(new MyRenderer()); } else { // This is where you could create an OpenGL ES 1.x compatible // renderer if you wanted to support both ES 1 and ES 2. return; } setContentView(mGLSurfaceView); } </code></pre> <p>}</p> <p>(using some tutorial code for experiment)</p> <p>Error Message:</p> <pre><code>07-19 19:59:06.945: E/AndroidRuntime(1451): FATAL EXCEPTION: GLThread 108 07-19 19:59:06.945: E/AndroidRuntime(1451): java.lang.IllegalArgumentException: No configs match configSpec 07-19 19:59:06.945: E/AndroidRuntime(1451): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:863) 07-19 19:59:06.945: E/AndroidRuntime(1451): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024) 07-19 19:59:06.945: E/AndroidRuntime(1451): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401) 07-19 19:59:06.945: E/AndroidRuntime(1451): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240) </code></pre> <p>And the app "Unfortunately stopped" </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload