/**@class android.opengl.GLSurfaceView
 implements android.view.SurfaceHolder.Callback2

@extends android.view.SurfaceView

 An implementation of SurfaceView that uses the dedicated surface for
 displaying OpenGL rendering.
 <p>
 A GLSurfaceView provides the following features:
 <p>
 <ul>
 <li>Manages a surface, which is a special piece of memory that can be
 composited into the Android view system.
 <li>Manages an EGL display, which enables OpenGL to render into a surface.
 <li>Accepts a user-provided Renderer object that does the actual rendering.
 <li>Renders on a dedicated thread to decouple rendering performance from the
 UI thread.
 <li>Supports both on-demand and continuous rendering.
 <li>Optionally wraps, traces, and/or error-checks the renderer's OpenGL calls.
 </ul>

 <div class="special reference">
 <h3>Developer Guides</h3>
 <p>For more information about how to use OpenGL, read the
 <a href="{@docRoot}guide/topics/graphics/opengl.html">OpenGL</a> developer guide.</p>
 </div>

 <h3>Using GLSurfaceView</h3>
 <p>
 Typically you use GLSurfaceView by subclassing it and overriding one or more of the
 View system input event methods. If your application does not need to override event
 methods then GLSurfaceView can be used as-is. For the most part
 GLSurfaceView behavior is customized by calling "set" methods rather than by subclassing.
 For example, unlike a regular View, drawing is delegated to a separate Renderer object which
 is registered with the GLSurfaceView
 using the {@link #setRenderer}(Renderer) call.
 <p>
 <h3>Initializing GLSurfaceView</h3>
 All you have to do to initialize a GLSurfaceView is call {@link #setRenderer}(Renderer).
 However, if desired, you can modify the default behavior of GLSurfaceView by calling one or
 more of these methods before calling setRenderer:
 <ul>
 <li>{@link #setDebugFlags}(int)
 <li>{@link #setEGLConfigChooser}(boolean)
 <li>{@link #setEGLConfigChooser}(EGLConfigChooser)
 <li>{@link #setEGLConfigChooser(int, int, int, int, int, int)}
 <li>{@link #setGLWrapper}(GLWrapper)
 </ul>
 <p>
 <h4>Specifying the android.view.Surface</h4>
 By default GLSurfaceView will create a PixelFormat.RGB_888 format surface. If a translucent
 surface is required, call getHolder().setFormat(PixelFormat.TRANSLUCENT).
 The exact format of a TRANSLUCENT surface is device dependent, but it will be
 a 32-bit-per-pixel surface with 8 bits per component.
 <p>
 <h4>Choosing an EGL Configuration</h4>
 A given Android device may support multiple EGLConfig rendering configurations.
 The available configurations may differ in how many channels of data are present, as
 well as how many bits are allocated to each channel. Therefore, the first thing
 GLSurfaceView has to do when starting to render is choose what EGLConfig to use.
 <p>
 By default GLSurfaceView chooses a EGLConfig that has an RGB_888 pixel format,
 with at least a 16-bit depth buffer and no stencil.
 <p>
 If you would prefer a different EGLConfig
 you can override the default behavior by calling one of the
 setEGLConfigChooser methods.
 <p>
 <h4>Debug Behavior</h4>
 You can optionally modify the behavior of GLSurfaceView by calling
 one or more of the debugging methods {@link #setDebugFlags}(int),
 and {@link #setGLWrapper}. These methods may be called before and/or after setRenderer, but
 typically they are called before setRenderer so that they take effect immediately.
 <p>
 <h4>Setting a Renderer</h4>
 Finally, you must call {@link #setRenderer} to register a {@link android.opengl.GLSurfaceView.Renderer}.
 The renderer is
 responsible for doing the actual OpenGL rendering.
 <p>
 <h3>Rendering Mode</h3>
 Once the renderer is set, you can control whether the renderer draws
 continuously or on-demand by calling
 {@link #setRenderMode}. The default is continuous rendering.
 <p>
 <h3>Activity Life-cycle</h3>
 A GLSurfaceView must be notified when to pause and resume rendering. GLSurfaceView clients
 are required to call {@link #onPause}() when the activity stops and
 {@link #onResume}() when the activity starts. These calls allow GLSurfaceView to
 pause and resume the rendering thread, and also allow GLSurfaceView to release and recreate
 the OpenGL display.
 <p>
 <h3>Handling events</h3>
 <p>
 To handle an event you will typically subclass GLSurfaceView and override the
 appropriate method, just as you would with any other View. However, when handling
 the event, you may need to communicate with the Renderer object
 that's running in the rendering thread. You can do this using any
 standard Java cross-thread communication mechanism. In addition,
 one relatively easy way to communicate with your renderer is
 to call
 {@link #queueEvent}(Runnable). For example:
 <pre class="prettyprint">
 class MyGLSurfaceView extends GLSurfaceView {

     private MyRenderer mMyRenderer;

     public void start() {
         mMyRenderer = ...;
         setRenderer(mMyRenderer);
     }

     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
             queueEvent(new Runnable() {
                 // This method will be called on the rendering
                 // thread:
                 public void run() {
                     mMyRenderer.handleDpadCenter();
                 }});
             return true;
         }
         return super.onKeyDown(keyCode, event);
     }
 }
 </pre>

*/
var GLSurfaceView = {

/** The renderer only renders
 when the surface is created, or when {@link #requestRender} is called.

 @see #getRenderMode()
 @see #setRenderMode(int)
 @see #requestRender()
*/
RENDERMODE_WHEN_DIRTY : "0",
/** The renderer is called
 continuously to re-render the scene.

 @see #getRenderMode()
 @see #setRenderMode(int)
*/
RENDERMODE_CONTINUOUSLY : "1",
/** Check glError() after every GL call and throw an exception if glError indicates
 that an error has occurred. This can be used to help track down which OpenGL ES call
 is causing an error.

 @see #getDebugFlags
 @see #setDebugFlags
*/
DEBUG_CHECK_GL_ERROR : "1",
/** Log GL calls to the system log at "verbose" level with tag "GLSurfaceView".

 @see #getDebugFlags
 @see #setDebugFlags
*/
DEBUG_LOG_GL_CALLS : "2",
/**Set the glWrapper. If the glWrapper is not null, its
 {@link android.opengl.GLSurfaceView.GLWrapper#wrap(GL)} method is called
 whenever a surface is created. A GLWrapper can be used to wrap
 the GL object that's passed to the renderer. Wrapping a GL
 object enables examining and modifying the behavior of the
 GL calls made by the renderer.
 <p>
 Wrapping is typically used for debugging purposes.
 <p>
 The default value is null.
@param {Object {GLSurfaceView.GLWrapper}} glWrapper the new GLWrapper
*/
setGLWrapper : function(  ) {},

/**Set the debug flags to a new value. The value is
 constructed by OR-together zero or more
 of the DEBUG_CHECK_* constants. The debug flags take effect
 whenever a surface is created. The default value is zero.
@param {Number} debugFlags the new debug flags
@see #DEBUG_CHECK_GL_ERROR
@see #DEBUG_LOG_GL_CALLS
*/
setDebugFlags : function(  ) {},

/**Get the current value of the debug flags.
@return {Number} the current value of the debug flags.
*/
getDebugFlags : function(  ) {},

/**Control whether the EGL context is preserved when the GLSurfaceView is paused and
 resumed.
 <p>
 If set to true, then the EGL context may be preserved when the GLSurfaceView is paused.
 <p>
 Prior to API level 11, whether the EGL context is actually preserved or not
 depends upon whether the Android device can support an arbitrary number of
 EGL contexts or not. Devices that can only support a limited number of EGL
 contexts must release the EGL context in order to allow multiple applications
 to share the GPU.
 <p>
 If set to false, the EGL context will be released when the GLSurfaceView is paused,
 and recreated when the GLSurfaceView is resumed.
 <p>

 The default is false.
@param {Boolean} preserveOnPause preserve the EGL context when paused
*/
setPreserveEGLContextOnPause : function(  ) {},

/**
@return {Boolean} true if the EGL context will be preserved when paused
*/
getPreserveEGLContextOnPause : function(  ) {},

/**Set the renderer associated with this view. Also starts the thread that
 will call the renderer, which in turn causes the rendering to start.
 <p>This method should be called once and only once in the life-cycle of
 a GLSurfaceView.
 <p>The following GLSurfaceView methods can only be called <em>before</em>
 setRenderer is called:
 <ul>
 <li>{@link #setEGLConfigChooser}(boolean)
 <li>{@link #setEGLConfigChooser}(EGLConfigChooser)
 <li>{@link #setEGLConfigChooser(int, int, int, int, int, int)}
 </ul>
 <p>
 The following GLSurfaceView methods can only be called <em>after</em>
 setRenderer is called:
 <ul>
 <li>{@link #getRenderMode}()
 <li>{@link #onPause}()
 <li>{@link #onResume}()
 <li>{@link #queueEvent}(Runnable)
 <li>{@link #requestRender}()
 <li>{@link #setRenderMode}(int)
 </ul>
@param {Object {GLSurfaceView.Renderer}} renderer the renderer to use to perform OpenGL drawing.
*/
setRenderer : function(  ) {},

/**Install a custom EGLContextFactory.
 <p>If this method is
 called, it must be called before {@link #setRenderer}(Renderer)
 is called.
 <p>
 If this method is not called, then by default
 a context will be created with no shared context and
 with a null attribute list.
*/
setEGLContextFactory : function(  ) {},

/**Install a custom EGLWindowSurfaceFactory.
 <p>If this method is
 called, it must be called before {@link #setRenderer}(Renderer)
 is called.
 <p>
 If this method is not called, then by default
 a window surface will be created with a null attribute list.
*/
setEGLWindowSurfaceFactory : function(  ) {},

/**Install a custom EGLConfigChooser.
 <p>If this method is
 called, it must be called before {@link #setRenderer}(Renderer)
 is called.
 <p>
 If no setEGLConfigChooser method is called, then by default the
 view will choose an EGLConfig that is compatible with the current
 android.view.Surface, with a depth buffer depth of
 at least 16 bits.
@param {Object {GLSurfaceView.EGLConfigChooser}} configChooser
*/
setEGLConfigChooser : function(  ) {},

/**Install a config chooser which will choose a config
 as close to 16-bit RGB as possible, with or without an optional depth
 buffer as close to 16-bits as possible.
 <p>If this method is
 called, it must be called before {@link #setRenderer}(Renderer)
 is called.
 <p>
 If no setEGLConfigChooser method is called, then by default the
 view will choose an RGB_888 surface with a depth buffer depth of
 at least 16 bits.
@param {Boolean} needDepth
*/
setEGLConfigChooser : function(  ) {},

/**Install a config chooser which will choose a config
 with at least the specified depthSize and stencilSize,
 and exactly the specified redSize, greenSize, blueSize and alphaSize.
 <p>If this method is
 called, it must be called before {@link #setRenderer}(Renderer)
 is called.
 <p>
 If no setEGLConfigChooser method is called, then by default the
 view will choose an RGB_888 surface with a depth buffer depth of
 at least 16 bits.
*/
setEGLConfigChooser : function(  ) {},

/**Inform the default EGLContextFactory and default EGLConfigChooser
 which EGLContext client version to pick.
 <p>Use this method to create an OpenGL ES 2.0-compatible context.
 Example:
 <pre class="prettyprint">
     public MyView(Context context) {
         super(context);
         setEGLContextClientVersion(2); // Pick an OpenGL ES 2.0 context.
         setRenderer(new MyRenderer());
     }
 </pre>
 <p>Note: Activities which require OpenGL ES 2.0 should indicate this by
 setting @lt;uses-feature android:glEsVersion="0x00020000" /> in the activity's
 AndroidManifest.xml file.
 <p>If this method is called, it must be called before {@link #setRenderer}(Renderer)
 is called.
 <p>This method only affects the behavior of the default EGLContexFactory and the
 default EGLConfigChooser. If
 {@link #setEGLContextFactory}(EGLContextFactory) has been called, then the supplied
 EGLContextFactory is responsible for creating an OpenGL ES 2.0-compatible context.
 If
 {@link #setEGLConfigChooser}(EGLConfigChooser) has been called, then the supplied
 EGLConfigChooser is responsible for choosing an OpenGL ES 2.0-compatible config.
@param {Number} version The EGLContext client version to choose. Use 2 for OpenGL ES 2.0
*/
setEGLContextClientVersion : function(  ) {},

/**Set the rendering mode. When renderMode is
 RENDERMODE_CONTINUOUSLY, the renderer is called
 repeatedly to re-render the scene. When renderMode
 is RENDERMODE_WHEN_DIRTY, the renderer only rendered when the surface
 is created, or when {@link #requestRender} is called. Defaults to RENDERMODE_CONTINUOUSLY.
 <p>
 Using RENDERMODE_WHEN_DIRTY can improve battery life and overall system performance
 by allowing the GPU and CPU to idle when the view does not need to be updated.
 <p>
 This method can only be called after {@link #setRenderer}(Renderer)
@param {Number} renderMode one of the RENDERMODE_X constants
@see #RENDERMODE_CONTINUOUSLY
@see #RENDERMODE_WHEN_DIRTY
*/
setRenderMode : function(  ) {},

/**Get the current rendering mode. May be called
 from any thread. Must not be called before a renderer has been set.
@return {Number} the current rendering mode.
@see #RENDERMODE_CONTINUOUSLY
@see #RENDERMODE_WHEN_DIRTY
*/
getRenderMode : function(  ) {},

/**Request that the renderer render a frame.
 This method is typically used when the render mode has been set to
 {@link #RENDERMODE_WHEN_DIRTY}, so that frames are only rendered on demand.
 May be called
 from any thread. Must not be called before a renderer has been set.
*/
requestRender : function(  ) {},

/**This method is part of the SurfaceHolder.Callback interface, and is
 not normally called or subclassed by clients of GLSurfaceView.
*/
surfaceCreated : function(  ) {},

/**This method is part of the SurfaceHolder.Callback interface, and is
 not normally called or subclassed by clients of GLSurfaceView.
*/
surfaceDestroyed : function(  ) {},

/**This method is part of the SurfaceHolder.Callback interface, and is
 not normally called or subclassed by clients of GLSurfaceView.
*/
surfaceChanged : function(  ) {},

/**This method is part of the SurfaceHolder.Callback2 interface, and is
 not normally called or subclassed by clients of GLSurfaceView.
*/
surfaceRedrawNeededAsync : function(  ) {},

/**This method is part of the SurfaceHolder.Callback2 interface, and is
 not normally called or subclassed by clients of GLSurfaceView.
*/
surfaceRedrawNeeded : function(  ) {},

/**Pause the rendering thread, optionally tearing down the EGL context
 depending upon the value of {@link #setPreserveEGLContextOnPause}(boolean).

 This method should be called when it is no longer desirable for the
 GLSurfaceView to continue rendering, such as in response to
 {@link android.app.Activity#onStop Activity.onStop}.

 Must not be called before a renderer has been set.
*/
onPause : function(  ) {},

/**Resumes the rendering thread, re-creating the OpenGL context if necessary. It
 is the counterpart to {@link #onPause}().

 This method should typically be called in
 {@link android.app.Activity#onStart Activity.onStart}.

 Must not be called before a renderer has been set.
*/
onResume : function(  ) {},

/**Queue a runnable to be run on the GL rendering thread. This can be used
 to communicate with the Renderer on the rendering thread.
 Must not be called before a renderer has been set.
@param {Object {Runnable}} r the runnable to be run on the GL rendering thread.
*/
queueEvent : function(  ) {},


};