Graphics Programs Reference
In-Depth Information
config) {
GLES20.glClearColor(0.0f, 0.0f, 1.0f, 1);
}
public void onSurfaceChanged(GL10 gl, int width, int
height) {
GLES20.glViewport(0, 0, width, height);
}
public void onDrawFrame(GL10 gl) {
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT |
GLES20.GL_DEPTH_BUFFER_BIT);
}
}
After specifying the Renderer object, add this surface to the view hierarchy of the
current activity using the setContentView method discussed in Chapter 2 .
Renderer Thread
Using the GLSurfaceView class and the addContentView method, we can
conveniently decouple OpenGL ES graphics from XML-based views (discussed in
Chapter 2 , section “Setting Views Using setContentView and addContentView”), so
that the XML-based views get displayed on top of the rendering surface hosting the
3D graphics (as shown in Figure 3-1 ).
 
Search WWH ::




Custom Search