Part 2: Integration with OpenGL and Designing a Splash Screen

Step 1: Creating an OpenGL View

In order to create an OpenGL activity we will need to create at least three new classes.

  1. GameActivity is the class that extends Activity. This class just creates the OpenGL view.
  2. VortexView is the class that extends GLSurfaceView. This is responsible for handling the view related functions of the OpenGL application. All the user inputs will be received by this class.
  3. Last but definitely not the least is the VortexRenderer class. This class implements GLSurfaceView.Renderer interface. This is responsible for rendering the OpenGL view.

The basic code for GameActivity.java looks like:

public class GameActivity extends Activity {
	private VortexView _vortexView;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		_vortexView = new VortexView(this);
		setContentView(_vortexView);
	}
}

You can change the text color and text in the title bar by adding following two lines in the onCreate() function:
this.setTitleColor(Color.DKGRAY);
this.setTitle(“FunFight”);

If you want to hide the title bar you can make it full screen by:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>