android.graphics.OpenGLContext
Nested Classes
Summary
Constants
| |
|
|
Value |
|
| int |
DEPTH_BUFFER |
Request an OpenGL|ES context with a depth buffer
|
1 |
0x00000001 |
Public Constructors
Public Methods
Protected Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
int
DEPTH_BUFFER
Request an OpenGL|ES context with a depth buffer
Constant Value:
1
(0x00000001)
Public Constructors
public
OpenGLContext(int flags)
Creates an OpenGL|ES context object
Parameters
| flags
| Flags used to configure the GL context |
Public Methods
public
void
destroy()
Destroys this OpenGL ES context and all associated resources.
OpenGL ES contexes are heavy object that consume a lot of resources,
it is always better to destroy them as soon as they're not needed
anymore.
public
GL
getGL()
Returns the GL interface to this OpenGL ES context.
public
void
makeCurrent(View target)
Bind this OpenGL ES context to the current thread and attach
the specified rendering target to it. The rendering target can
be either any View, but only instance of SurfaceView are supported
at this time.
The parameter can be null to make the context not current.
public
void
makeCurrent(SurfaceHolder target)
Bind this OpenGL ES context to the current thread and attach
the specified rendering target to it. The rendering target can
be either a SurfaceHolder's Surface or a regular View.
Best performance is usually achieved by using a SurfaceHolder.
The parameter can be null to make the context not current.
public
void
post()
Post the current target to the screen. This method MUST always be called
once the application is done rendering an OpenGL ES scene. Failing to
do so will prevent any rendering from occurring.
public
void
surfaceChanged(SurfaceHolder holder, int format, int width, int height)
This is called immediately after any structural changes (format or
size) have been made to the surface. You should at this point update
the imagery in the surface. This method is always called at least
once, after
surfaceCreated(SurfaceHolder).
public
void
surfaceCreated(SurfaceHolder holder)
This is called immediately after the surface is first created.
Implementations of this should start up whatever rendering code
they desire. Note that only one thread can ever draw into
a
Surface, so you should not draw into the Surface here
if your normal rendering will be in another thread.
public
void
surfaceDestroyed(SurfaceHolder holder)
This is called immediately before a surface is being destroyed. After
returning from this call, you should no longer try to access this
surface. If you have a rendering thread that directly accesses
the surface (either through
SurfaceHolder.getSurface() or {@link android.graphics.OpenGLContext,
you must ensure that thread is no longer touching the Surface before
returning from this function.
public
void
waitGL()
Block until all pending OpenGL ES operations are completed.
This method is used to synchronize OpenGL ES rendering with native
rendering and should be called after OpenGL ES primitives have been
issued and before using the native rendering engine.
public
void
waitNative()
Block until all native drawing operations have finished in the
current target (as specified in makeCurrent). If no target is current
this method has no effect.
This method should be called after any native rendering has occurred
and before calling any OpenGL ES rendering calls.
Protected Methods
protected
void
finalize()
Called by the virtual machine when there are no longer any (non-weak)
references to the receiver. Subclasses can use this facility to guarantee
that any associated resources are cleaned up before the receiver is
garbage collected. Uncaught exceptions which are thrown during the
running of the method cause it to terminate immediately, but are
otherwise ignored.
Note: The virtual machine assumes that the implementation in class Object
is empty.