developer.android.com OpenGL es sample doesn't work? -
i'm following tutorial: http://developer.android.com/training/graphics/opengl/environment.html
and trying running throughout whole day... in meantime looking other tutorials opengl ended application crash... here files: androidmanifest.xml:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.openglproject1" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="19" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <supports-gl-texture android:name="gl_oes_compressed_etc1_rgb8_texture" /> <supports-gl-texture android:name="gl_oes_compressed_paletted_texture" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.example.openglproject1.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest>
activity_main.xml:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.openglproject1.mainactivity" tools:ignore="mergerootframe" />
fragment_main.xml:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > </linearlayout>
mainactivity.java:
package com.example.openglproject1; import android.app.activity; import android.content.context; import android.opengl.glsurfaceview; import android.os.bundle; public class mainactivity extends activity { private glsurfaceview mglview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // create glsurfaceview instance , set // contentview activity. mglview = new myglsurfaceview(this); setcontentview(mglview); } class myglsurfaceview extends glsurfaceview { public myglsurfaceview(context context){ super(context); // create opengl es 2.0 context seteglcontextclientversion(2); // set renderer drawing on glsurfaceview setrenderer(new myglrenderer()); // render view when there change in drawing data setrendermode(glsurfaceview.rendermode_when_dirty); } } }
myglrenderer.java:
package com.example.openglproject1; import javax.microedition.khronos.egl.eglconfig; import javax.microedition.khronos.opengles.gl10; import android.opengl.glsurfaceview; import android.opengl.gles20; public class myglrenderer implements glsurfaceview.renderer { public void ondrawframe(gl10 unused) { // redraw background color gles20.glclear(gles20.gl_color_buffer_bit); } public void onsurfacechanged(gl10 unused, int width, int height) { gles20.glviewport(0, 0, width, height); } @override public void onsurfacecreated(gl10 arg0, eglconfig arg1) { gles20.glclearcolor(0.0f, 0.0f, 0.0f, 1.0f); } }
and according developer.android.com should work , display gray screen. i'm able compile app , launch on emulator crashes... see issues in these code snippets? i'm exhasuted trying run 1 stupid opengl app whole day... here's logcat:
06-27 13:58:16.901: d/(1075): hostconnection::get() new host connection established 0xb8946c38, tid 1075 06-27 13:58:16.971: w/egl_emulation(1075): eglsurfaceattrib not implemented 06-27 13:58:16.981: d/openglrenderer(1075): enabling debug mode 0 06-27 13:58:17.081: d/(1075): hostconnection::get() new host connection established 0xb894f3d0, tid 1088 06-27 13:58:17.141: w/dalvikvm(1075): threadid=11: thread exiting uncaught exception (group=0xb2a97ba8) 06-27 13:58:17.151: e/androidruntime(1075): fatal exception: glthread 78 06-27 13:58:17.151: e/androidruntime(1075): process: com.example.openglproject1, pid: 1075 06-27 13:58:17.151: e/androidruntime(1075): java.lang.illegalargumentexception: no config chosen 06-27 13:58:17.151: e/androidruntime(1075): @ android.opengl.glsurfaceview$baseconfigchooser.chooseconfig(glsurfaceview.java:874) 06-27 13:58:17.151: e/androidruntime(1075): @ android.opengl.glsurfaceview$eglhelper.start(glsurfaceview.java:1024) 06-27 13:58:17.151: e/androidruntime(1075): @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1401) 06-27 13:58:17.151: e/androidruntime(1075): @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1240) 06-27 13:58:24.351: i/process(1075): sending signal. pid: 1075 sig: 9 06-27 14:22:48.651: d/(1120): hostconnection::get() new host connection established 0xb894b288, tid 1120 06-27 14:22:48.691: w/egl_emulation(1120): eglsurfaceattrib not implemented 06-27 14:22:48.701: d/openglrenderer(1120): enabling debug mode 0 06-27 14:22:48.771: d/(1120): hostconnection::get() new host connection established 0xb894f420, tid 1133 06-27 14:22:48.821: w/dalvikvm(1120): threadid=11: thread exiting uncaught exception (group=0xb2a97ba8) 06-27 14:22:48.841: e/androidruntime(1120): fatal exception: glthread 81 06-27 14:22:48.841: e/androidruntime(1120): process: com.example.openglproject1, pid: 1120 06-27 14:22:48.841: e/androidruntime(1120): java.lang.illegalargumentexception: no config chosen 06-27 14:22:48.841: e/androidruntime(1120): @ android.opengl.glsurfaceview$baseconfigchooser.chooseconfig(glsurfaceview.java:874) 06-27 14:22:48.841: e/androidruntime(1120): @ android.opengl.glsurfaceview$eglhelper.start(glsurfaceview.java:1024) 06-27 14:22:48.841: e/androidruntime(1120): @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1401) 06-27 14:22:48.841: e/androidruntime(1120): @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1240) 06-27 14:22:55.231: i/process(1120): sending signal. pid: 1120 sig: 9 06-27 14:23:08.541: d/(1160): hostconnection::get() new host connection established 0xb894ba50, tid 1160 06-27 14:23:08.591: w/egl_emulation(1160): eglsurfaceattrib not implemented 06-27 14:23:08.601: d/openglrenderer(1160): enabling debug mode 0 06-27 14:23:08.661: d/(1160): hostconnection::get() new host connection established 0xb894f4f0, tid 1173 06-27 14:23:08.691: w/dalvikvm(1160): threadid=11: thread exiting uncaught exception (group=0xb2a97ba8) 06-27 14:23:08.691: e/androidruntime(1160): fatal exception: glthread 84 06-27 14:23:08.691: e/androidruntime(1160): process: com.example.openglproject1, pid: 1160 06-27 14:23:08.691: e/androidruntime(1160): java.lang.illegalargumentexception: no config chosen 06-27 14:23:08.691: e/androidruntime(1160): @ android.opengl.glsurfaceview$baseconfigchooser.chooseconfig(glsurfaceview.java:874) 06-27 14:23:08.691: e/androidruntime(1160): @ android.opengl.glsurfaceview$eglhelper.start(glsurfaceview.java:1024) 06-27 14:23:08.691: e/androidruntime(1160): @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1401) 06-27 14:23:08.691: e/androidruntime(1160): @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1240) 06-27 14:23:10.811: i/process(1160): sending signal. pid: 1160 sig: 9
Comments
Post a Comment