Please keep in mind that I am new to android development and I have no experience of using OpenGL before. I followed this lesson: http://developer.android.com/training/graphics/opengl/environment.html
and my current code is:
OpenGLESTestActivity.java:
package com.KML;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.opengl.*;
import com.KML.MyGLRenderer;
public class OpenGLESTestActivity extends Activity {
/** Called when the activity is first created. */
private GLSurfaceView mGLView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGLView = new MyGLSurfaceView(this);
setContentView(mGLView);
}
}
class MyGLSurfaceView extends GLSurfaceView {
public MyGLSurfaceView(Context context) {
super(context);
setRenderer(new MyGLRenderer());
this.setEGLContextClientVersion(2);
this.setRenderMode(RENDERMODE_WHEN_DIRTY);
}
}
in MyGLRenderer.java:
package com.KML;
import android.opengl.GLES20;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLSurfaceView;
public class MyGLRenderer implements GLSurfaceView.Renderer {
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
}
public void onDrawFrame(GL10 unused) {
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
}
public void onSurfaceChanged(GL10 unused, int width, int height) {
GLES20.glViewport(0, 0, width, height);
}
}
This is giving me "Unfortunately, OpenGLESTest has stopped." on my android device.
Thanks
adb
, but I don't know the exact command. Tryadb -help
(or some such help command)