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 activity.
|
EglCore(android.opengl.EGLContext sharedContext,
int flags)
Prepares EGL display and activity.
|
Modifier and Type | Method and Description |
---|---|
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.
|
int |
getGlVersion()
Returns the GLES version this activity is configured for (currently 2 or 3).
|
boolean |
isCurrent(android.opengl.EGLSurface eglSurface)
Returns true if our activity and the specified surface are current.
|
static void |
logCurrent(java.lang.String msg)
Writes the current display, activity, and surface to the log.
|
void |
makeCurrent(android.opengl.EGLSurface eglSurface)
Makes our EGL activity current, using the supplied surface for both "draw" and "read".
|
void |
makeCurrent(android.opengl.EGLSurface drawSurface,
android.opengl.EGLSurface readSurface)
Makes our EGL activity current, using the supplied "draw" and "read" surfaces.
|
void |
makeNothingCurrent()
Makes no activity 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 activity.
|
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 activity to share, or null if sharing is not desired.flags
- Configuration bit flags, e.g. FLAG_RECORDABLE.public void release()
On completion, no activity will be current.
public 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)