Demo,HelloEffects;
改变 mEffect 变量
GLSurfaceView.Renderer 和 GLSurfaceView
GLSurfaceView --> SurfaceView --> View --> Object.
A GLSurfaceView provides the following features: Manages a surface, which is a special piece of memory that can be composited into the Android view system. ; Manages an EGL display, which enables OpenGL to render into a surface.; Accepts a user-provided Renderer object that does the actual rendering.; Renders on a dedicated thread to decouple rendering performance from the UI thread.; Supports both on-demand and continuous rendering.; Optionally wraps, traces, and/or error-checks the renderer's OpenGL calls.
Using GLSurfaceView: 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 setRenderer(Renderer) call.
Initializing GLSurfaceView: All you have to do to initialize a GLSurfaceView is call setRenderer(Renderer).
Rendering Mode: Once the renderer is set, you can control whether the renderer draws continuously or on-demand by calling setRenderMode(int).
Activity Life-cycle: A GLSurfaceView must be notified when the activity is paused and resumed. GLSurfaceView clients are required to call onPause() when the activity pauses and onResume() when the activity resumes. These calls allow GLSurfaceView to pause and resume the rendering thread, and also allow GLSurfaceView to release and recreate the OpenGL display.
GLSurfaceView.Renderer接口,The renderer is responsible for making OpenGL calls to render a frame.
The renderer will be called on a separate thread, so that rendering performance is decoupled from the UI thread.比如queueEvent(Runnable);
Effect --> Object. Effects are high-performance transformations that can be applied to image frames. These are passed in the form of OpenGL ES 2.0 texture names. Typical frames could be images loaded from disk, or frames from the camera or other video streams.
EdgeEffect --> Object.This class performs the graphical effect used at the edges of scrollable widgets when the user scrolls beyond the content bounds in 2D space.
Android supports OpenGL both through its framework API and the Native Development Kit (NDK).