Android Open Source - AndroidGLViewer Main G L Activity






From Project

Back to project page AndroidGLViewer.

License

The source code is released under:

GNU General Public License

If you think the Android project AndroidGLViewer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package graphics.bradley.androidglviewer;
//w  w  w .ja v  a 2s  .c o m
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainGLActivity extends Activity {
  
  private GLSurfaceView mGLView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mGLView = new MyGLSurfaceView(this);
    setContentView(mGLView);
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main_gl, menu);
    return true;
  }
  
  @Override
  protected void onResume() {
      super.onResume();
          /*
   * The activity must call the GL surface view's
   * onResume() on activity onResume().
   */
        if (mGLView != null) {
            mGLView.onResume();
        }
    }
   
    @Override
    protected void onPause() {
        super.onPause();
 
        /*
     * The activity must call the GL surface view's
     * onPause() on activity onPause().
     */
        if (mGLView != null) {
            mGLView.onPause();
        }
    }

}




Java Source Code List

graphics.bradley.androidglviewer.Cube.java
graphics.bradley.androidglviewer.MainGLActivity.java
graphics.bradley.androidglviewer.MyGL20Renderer.java
graphics.bradley.androidglviewer.MyGLSurfaceView.java
graphics.bradley.androidglviewer.Sphere.java