Package com.banuba.sdk.internal.gl
Class EglSurfaceBase
java.lang.Object
com.banuba.sdk.internal.gl.EglSurfaceBase
- Direct Known Subclasses:
OffscreenSurface
,WindowSurface
Common base class for EGL surfaces.
There can be multiple surfaces associated with a single context.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createOffscreenSurface
(int width, int height) Creates an off-screen surface.int
Returns the surface's height, in pixels.int
getWidth()
Returns the surface's width, in pixels.void
Makes our EGL context and surface current.void
makeCurrentReadFrom
(EglSurfaceBase readSurface) Makes our EGL context and surface current for drawing, using the supplied surface for reading.void
Saves the EGL surface to a file.void
setPresentationTime
(long nsecs) Sends the presentation time stamp to EGL.boolean
Calls eglSwapBuffers.
-
Method Details
-
createOffscreenSurface
public void createOffscreenSurface(int width, int height) Creates an off-screen surface. -
getWidth
public int getWidth()Returns the surface's width, in pixels. If this is called on a window surface, and the underlying surface is in the process of changing size, we may not see the new size right away (e.g. in the "surfaceChanged" callback). The size should match after the next buffer swap. -
getHeight
public int getHeight()Returns the surface's height, in pixels. -
makeCurrent
public void makeCurrent()Makes our EGL context and surface current. -
makeCurrentReadFrom
Makes our EGL context and surface current for drawing, using the supplied surface for reading. -
swapBuffers
public boolean swapBuffers()Calls eglSwapBuffers. Use this to "publish" the current frame.- Returns:
- false on failure
-
setPresentationTime
public void setPresentationTime(long nsecs) Sends the presentation time stamp to EGL.- Parameters:
nsecs
- Timestamp, in nanoseconds.
-
saveFrame
Saves the EGL surface to a file. Expects that this object's EGL surface is current.- Throws:
IOException
-