Class EglSurfaceBase

java.lang.Object
com.banuba.sdk.internal.gl.EglSurfaceBase
Direct Known Subclasses:
OffscreenSurface, WindowSurface

public class EglSurfaceBase extends Object
Common base class for EGL surfaces.

There can be multiple surfaces associated with a single context.

  • 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

      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(File file) throws IOException
      Saves the EGL surface to a file.

      Expects that this object's EGL surface is current.

      Throws:
      IOException