Package com.banuba.sdk.render_target
Class OpenGLRenderTarget
java.lang.Object
com.banuba.sdk.render_target.OpenGLRenderTarget
- All Implemented Interfaces:
IRenderedFrameProvider
,IRenderTarget
,IRenderTargetPresentable
Implementation of the RenderTarget with using OpenGL render
-
Constructor Summary
ConstructorDescriptionOpenGLRenderTarget
(com.banuba.sdk.effect_player.EffectPlayer effectPlayer, android.util.Size renderSize, android.opengl.EGLContext eglContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Activate rendering contextvoid
destroy()
Destroy RenderTarget and release resourceslong
Get the drawing time of the current frameint
android.util.Size
Get render surface sizevoid
present()
Display frame on attached surfacevoid
present
(WindowSurface windowSurface, android.graphics.Rect renderingRect) Draw frame on surfacecom.banuba.sdk.types.PixelBuffer
Get the rendered frame as an array of pixelsvoid
resize()
Recalculate viewport size and set new draw sizesvoid
setFrameTimeNanos
(long timeNanos) Set frame drawing time.
-
Constructor Details
-
OpenGLRenderTarget
public OpenGLRenderTarget(com.banuba.sdk.effect_player.EffectPlayer effectPlayer, android.util.Size renderSize, android.opengl.EGLContext eglContext)
-
-
Method Details
-
getContext
-
destroy
public void destroy()Description copied from interface:IRenderTarget
Destroy RenderTarget and release resources- Specified by:
destroy
in interfaceIRenderTarget
-
activate
public void activate()Description copied from interface:IRenderTarget
Activate rendering context- Specified by:
activate
in interfaceIRenderTarget
-
getRenderingSize
public android.util.Size getRenderingSize()Description copied from interface:IRenderTargetPresentable
Get render surface size- Specified by:
getRenderingSize
in interfaceIRenderTargetPresentable
- Returns:
- size of the rendering viewport
-
present
Description copied from interface:IRenderTargetPresentable
Draw frame on surface- Specified by:
present
in interfaceIRenderTargetPresentable
- Parameters:
windowSurface
- the surface on which the frame will be drawnrenderingRect
- scaling and positioning the frame on the surface
-
present
public void present()Description copied from interface:IRenderTargetPresentable
Display frame on attached surface- Specified by:
present
in interfaceIRenderTargetPresentable
-
getGlTexture
public int getGlTexture() -
resize
public void resize()Description copied from interface:IRenderTarget
Recalculate viewport size and set new draw sizes- Specified by:
resize
in interfaceIRenderTarget
-
readPixels
public com.banuba.sdk.types.PixelBuffer readPixels()Description copied from interface:IRenderedFrameProvider
Get the rendered frame as an array of pixels- Specified by:
readPixels
in interfaceIRenderedFrameProvider
- Returns:
- pixel buffer, stores dimensions, pixel type and array of pixels
-
setFrameTimeNanos
public void setFrameTimeNanos(long timeNanos) Description copied from interface:IRenderTarget
Set frame drawing time. Necessary for correct video recording- Specified by:
setFrameTimeNanos
in interfaceIRenderTarget
- Parameters:
timeNanos
- current frame drawing time in nanoseconds
-
getFrameTimeNanos
public long getFrameTimeNanos()Description copied from interface:IRenderTargetPresentable
Get the drawing time of the current frame- Specified by:
getFrameTimeNanos
in interfaceIRenderTargetPresentable
- Returns:
- frame drawing time in nanoseconds
-