public final class EglCore
extends java.lang.Object
The EGLContext must only be attached to one thread at a time. This class is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
static int |
FLAG_RECORDABLE
Constructor flag: surface must be recordable.
|
static int |
FLAG_TRY_GLES3
Constructor flag: ask for GLES3, fall back to GLES2 if not available.
|
| Constructor and Description |
|---|
EglCore()
Prepares EGL display and context.
|
EglCore(android.opengl.EGLContext sharedContext,
int flags)
Prepares EGL display and context.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkCurrentEgl(android.opengl.EGLSurface currentSurface)
check CurrentEgl
|
android.opengl.EGLSurface |
createOffscreenSurface(int width,
int height)
Creates an EGL surface associated with an offscreen buffer.
|
android.opengl.EGLSurface |
createWindowSurface(java.lang.Object surface)
Creates an EGL surface associated with a Surface.
|
protected void |
finalize() |
int |
getGlVersion()
Returns the GLES version this context is configured for (currently 2 or 3).
|
boolean |
isCurrent(android.opengl.EGLSurface eglSurface)
Returns true if our context and the specified surface are current.
|
static void |
logCurrent(java.lang.String msg)
Writes the current display, context, and surface to the log.
|
void |
makeCurrent(android.opengl.EGLSurface eglSurface)
Makes our EGL context current, using the supplied surface for both "draw" and "read".
|
void |
makeCurrent(android.opengl.EGLSurface drawSurface,
android.opengl.EGLSurface readSurface)
Makes our EGL context current, using the supplied "draw" and "read" surfaces.
|
void |
makeNothingCurrent()
Makes no context current.
|
java.lang.String |
queryString(int what)
Queries a string value.
|
int |
querySurface(android.opengl.EGLSurface eglSurface,
int what)
Performs a simple surface query.
|
void |
release()
Discards all resources held by this class, notably the EGL context.
|
void |
releaseSurface(android.opengl.EGLSurface eglSurface)
Destroys the specified surface.
|
void |
setPresentationTime(android.opengl.EGLSurface eglSurface,
long nsecs)
Sends the presentation time stamp to EGL.
|
boolean |
swapBuffers(android.opengl.EGLSurface eglSurface)
Calls eglSwapBuffers.
|
public static final int FLAG_RECORDABLE
public static final int FLAG_TRY_GLES3
public EglCore()
Equivalent to EglCore(null, 0).
public EglCore(android.opengl.EGLContext sharedContext,
int flags)
sharedContext - The context to share, or null if sharing is not desired.flags - Configuration bit flags, e.g. FLAG_RECORDABLE.public void release()
On completion, no context will be current.
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic void releaseSurface(android.opengl.EGLSurface eglSurface)
public android.opengl.EGLSurface createWindowSurface(java.lang.Object surface)
If this is destined for MediaCodec, the EGLConfig should have the "recordable" attribute.
public android.opengl.EGLSurface createOffscreenSurface(int width,
int height)
public void makeCurrent(android.opengl.EGLSurface eglSurface)
public void makeCurrent(android.opengl.EGLSurface drawSurface,
android.opengl.EGLSurface readSurface)
public void makeNothingCurrent()
public boolean swapBuffers(android.opengl.EGLSurface eglSurface)
public void setPresentationTime(android.opengl.EGLSurface eglSurface,
long nsecs)
public boolean isCurrent(android.opengl.EGLSurface eglSurface)
public int querySurface(android.opengl.EGLSurface eglSurface,
int what)
public java.lang.String queryString(int what)
public int getGlVersion()
public static void logCurrent(java.lang.String msg)
public boolean checkCurrentEgl(android.opengl.EGLSurface currentSurface)