Graphics Programs Reference
In-Depth Information
public void onCreate(Bundle savedInstanceState) {
_surfaceView = new GLSurfaceView(this);
_surfaceView.setRenderer(new GLES20Renderer());
Note We have been calling the rendering surface different
names— EGL window, OpenGL surface, OpenGL surface view,
OpenGL view, and GL surface. Do not get confused; they are all the
Setting up the Renderer
Although the GLSurfaceView class can automate many steps, it cannot directly
render graphics on the rendering surface. This requires a Renderer object that does
the actual rendering. We specify the renderer using the setRender-
er(GLSurfaceView.Rendererrenderer) method. Abstract methods of the
GLSurfaceView.Renderer interface ( an-
droid.opengl.GLSurfaceView.Renderer ) can be easily implemented
within an anonymous inner type. However, for all ES 2.0 applications in the source
code, we created a separate Renderer class— GLES20Renderer —similar to the
Renderer class from the GL SURFACE application ( Listing 3-3 ).
3-3. GL SURFACE/src/com/apress/android/glsurface/GLES20Render-
public class GLES20Renderer implements Renderer {
public void onSurfaceCreated(GL10 gl, EGLConfig
Search WWH ::

Custom Search