Jump to content

  • Log In with Google      Sign In   
  • Create Account

Android OpenGL not working in emulator


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 MatejaS   Members   -  Reputation: 203

Like
0Likes
Like

Posted 05 August 2014 - 11:53 PM

I have recently started making a game for Android and I want to use OpenGL 1.0 ES for drawing.

I have followed a tutorial I found on Youtube.

However,when I run it,it always says: "Unfortunately,<MyApp> has stopped".

I'm pretty sure that my emulator is somehow not supporting OpenGL...

Here's my code:

MainActivity.java

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		MySurfaceView view=new MySurfaceView(this);
		setContentView(view);
	}
}

MySurfaceView.java

public class MySurfaceView extends GLSurfaceView {

	public MySurfaceView(Context context) {
		super(context);
		setEGLContextClientVersion(1);
		setRenderer(new MyRenderer());
	}

}

and MyRenderer.java

public class MyRenderer implements Renderer {

	@Override
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
		gl.glClearColor(0.0f,0.0f,0.0f,1.0f);

	}

	@Override
	public void onSurfaceChanged(GL10 gl, int width, int height) {
		gl.glViewport(0,0,width,height);
	    float ratio = (float) width / height;
	    gl.glMatrixMode(GL10.GL_PROJECTION);
	    gl.glLoadIdentity();
	    gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);

	}

	@Override
	public void onDrawFrame(GL10 gl) {
		gl.glClear(GL10.GL_COLOR_BUFFER_BIT|GL10.GL_DEPTH_BUFFER_BIT);

	}

}

I would really appreciate if someone could help me...

Maybe there is a bug in my code??

 

Thanks,

MatejaS



Sponsor:

#2 DaBono   Members   -  Reputation: 1021

Like
0Likes
Like

Posted 06 August 2014 - 05:29 AM

Did you try to run your app using an actual Android-device? Did it work that way?

 

Also, LogCat can show you a trace where the crash occurred. You could use that to pinpoint any errors.

If you use Eclipse (ADT Bundle), you can open it using Window -> Show view -> Other -> Android -> LogCat.



#3 MatejaS   Members   -  Reputation: 203

Like
0Likes
Like

Posted 06 August 2014 - 10:12 AM

log.txt:

08-06 12:07:43.114: D/(1134): HostConnection::get() New Host Connection established 0xb8041720, tid 1134
08-06 12:07:43.224: W/EGL_emulation(1134): eglSurfaceAttrib not implemented
08-06 12:07:43.264: D/OpenGLRenderer(1134): Enabling debug mode 0
08-06 12:07:43.434: I/Choreographer(1134): Skipped 32 frames!  The application may be doing too much work on its main thread.
08-06 12:07:43.444: D/(1134): HostConnection::get() New Host Connection established 0xb803c110, tid 1147
08-06 12:07:43.474: W/dalvikvm(1134): threadid=11: thread exiting with uncaught exception (group=0xb4ac6ba8)
08-06 12:07:43.534: E/AndroidRuntime(1134): FATAL EXCEPTION: GLThread 84
08-06 12:07:43.534: E/AndroidRuntime(1134): Process: com.example.opengltest, PID: 1134
08-06 12:07:43.534: E/AndroidRuntime(1134): java.lang.IllegalArgumentException: No config chosen
08-06 12:07:43.534: E/AndroidRuntime(1134): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:874)
08-06 12:07:43.534: E/AndroidRuntime(1134): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
08-06 12:07:43.534: E/AndroidRuntime(1134): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
08-06 12:07:43.534: E/AndroidRuntime(1134): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
08-06 12:07:49.974: I/Process(1134): Sending signal. PID: 1134 SIG: 9
 
I do not have access to any Android device right now.
MatejaS

Edited by MatejaS, 06 August 2014 - 10:28 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS