This article illustrates the Java rendering method based on OpenGL ES. Share to everyone for your reference. Specifically as follows:
1. Run.java Documents:
Package Net.obviam.opengl;
Import android.app.Activity;
Import Android.opengl.GLSurfaceView;
Import Android.os.Bundle;
Import Android.view.Window;
Import Android.view.WindowManager;
public class Run extends activity {/** The OpenGL view/private Glsurfaceview Glsurfaceview; /** called the activity is a.
* * @Override public void onCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);
Requesting to turn the title off Requestwindowfeature (Window.feature_no_title); Making it full screen GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Initiate the "Open GL View and//create an instance with the" Glsurfaceview = new Glsurfaceview (this); Set our renderer to is the main renderer with//the current Activity context glsurfaceview.setrenderer (NE
W Glrenderer ());
Setcontentview (Glsurfaceview); }/** Remember to resume The Glsurface/@Override protected void Onresume () {super.onresume ();
Glsurfaceview.onresume ();
}/** Also Pause the glsurface/@Override protected void OnPause () {super.onpause ();
Glsurfaceview.onpause ();
}
}
2. Glrenderer.java Documents:
Import Javax.microedition.khronos.egl.EGLConfig;
Import javax.microedition.khronos.opengles.GL10;
Import Android.opengl.GLSurfaceView.Renderer;
public class Glrenderer implements Renderer {
@Override public
void Ondrawframe (GL10 gl) {
}
@Override c8/>public void onsurfacechanged (GL10 gl, int width, int height) {
}
@Override public
Void Onsurfacecreated (GL10 gl, eglconfig config) {
}
}
I hope this article will help you with your Java programming.