Package com.banuba.sdk.internal.gl
Class EglSurfaceBase
- java.lang.Object
-
- com.banuba.sdk.internal.gl.EglSurfaceBase
-
- Direct Known Subclasses:
OffscreenSurface
,WindowSurface
public class EglSurfaceBase extends java.lang.Object
Common base class for EGL surfaces. There can be multiple surfaces associated with a single context.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createOffscreenSurface(int width, int height)
Creates an off-screen surface.int
getHeight()
Returns the surface's height, in pixels.int
getWidth()
Returns the surface's width, in pixels.void
makeCurrent()
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
saveFrame(java.io.File file)
Saves the EGL surface to a file.void
setPresentationTime(long nsecs)
Sends the presentation time stamp to EGL.boolean
swapBuffers()
Calls eglSwapBuffers.
-
-
-
Method Detail
-
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
public void makeCurrentReadFrom(EglSurfaceBase readSurface)
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
public void saveFrame(java.io.File file) throws java.io.IOException
Saves the EGL surface to a file. Expects that this object's EGL surface is current.- Throws:
java.io.IOException
-
-