Graphics Programs Reference
In-Depth Information
an application similar to GL SURFACE , but before that, let's discuss Listing 3-4 -
pseudo code to describe the internal functioning of a renderer thread (after GLSur-
faceView is set as the activity's content view, as shown in Listing 3-2 ).
Listing 3-4. High Level Overview of Renderer Thread's Functioning
// after setContentView(_surfaceView);
_surfaceView.draw() { // there is no such method
Renderer.surfaceChanged(_width, _height);
while(true) {
if(_deviceOrientationChanged) {
if(_stopped) {
Rendering begins with a call to the Renderer.surfaceCreated (that is, Ren-
derer.onSurfaceCreated ) method. Inside this method, we can place ES 2.0
functions for rendering graphics using the GPU.
However, the surfaceCreated method is the block in which we usually add code
for basic State Management apart from setting the background color for our render-
ing surface.
To accommodate any change in the orientation of device, the surfaceChanged
(that is, Renderer.onSurfaceChanged ) method is called.
To render graphics on a frame by frame basis, the call to the Render-
er.drawFrame (that is, Renderer.onDrawFrame ) method takes place inside
a while loop, which ends only if the application (or the activity using the rendering
surface) is stopped.
Search WWH ::

Custom Search