package com.vizit;
import android.app.Activity;
import android.os.Bundle;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.view.ViewGroup;
public class ESTriangles
extends Activity
{
private GLSurfaceView view;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Create a GLSurfaceView instance and set it
// as the ContentView for this Activity.
view = new MyGLSurfaceView(this);
setContentView(view,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
}
@Override
protected void onResume()
{
// The activity must call the GL surface view's onResume() on activity onResume().
super.onResume();
view.onResume();
}
@Override
protected void onPause()
{
// The activity must call the GL surface view's onPause() on activity onPause().
super.onPause();
view.onPause();
}
class MyGLSurfaceView extends GLSurfaceView
{
private final TriangleRenderer renderer;
public MyGLSurfaceView(Context context)
{
super(context);
// We are using the OpenGL ES 2 API..
setEGLContextClientVersion(2);
renderer = new TriangleRenderer();
// Set the Renderer for drawing on the GLSurfaceView
setRenderer(renderer);
// Render the view only when there is a change in the drawing data
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
}
}
}
This introduces explicit LayoutParams.