Renderer Class

Description

Renderer is a renderer that render the camera image in AR scenes. It is generally used in the rendering thread.

Constructor

C: void easyar_Renderer__ctor(easyar_Renderer * * Return)
C++11: Renderer()
Traditional C++: Renderer()
Java: public Renderer()
Objective-C: + (easyar_Renderer *) create
Swift (since EasyAR SDK 2.1.0): public convenience init()

chooseAPI

Choose graphics API. Generally there is no need to call this function manually.

C: void easyar_Renderer_chooseAPI(easyar_Renderer * This, easyar_RendererAPI api)
C++11: void chooseAPI(RendererAPI api)
Traditional C++: void chooseAPI(RendererAPI api)
Java: public native void chooseAPI(/* RendererAPI */ int api)
Objective-C: - (void)chooseAPI:(easyar_RendererAPI)api
Swift (since EasyAR SDK 2.1.0): public func chooseAPI(_ api: RendererAPI) -> Void

setDevice

Set graphics device. Generally there is no need to call this function manually.

C: void easyar_Renderer_setDevice(easyar_Renderer * This, void * device)
C++11: void setDevice(void * device)
Traditional C++: void setDevice(void * device)
Java: public native void setDevice(long device)
Objective-C: - (void)setDevice:(void *)device
Swift (since EasyAR SDK 2.1.0): public func setDevice(_ device: OpaquePointer) -> Void

render

Draws current frame to the current bound FBO. This method should be called in each frame if a camera background is needed.

A view port is a Vec4I data like the four input parameters in glViewPort {left, top, width, height}.

C: bool easyar_Renderer_render(easyar_Renderer * This, easyar_Drawable * frame, easyar_Vec4I viewport)
C++11: bool render(std::shared_ptr<Drawable> frame, Vec4I viewport)
Traditional C++: bool render(Drawable * frame, Vec4I viewport)
Java: public native boolean render(Drawable frame, Vec4I viewport)
Objective-C: - (bool)render:(easyar_Drawable *)frame viewport:(easyar_Vec4I *)viewport
Swift (since EasyAR SDK 2.1.0): public func render(_ frame: Drawable?, _ viewport: Vec4I) -> Bool

renderToTexture

Draws current frame to the texture. This method should be called in each frame if a camera background is needed.

texture should be set to the texture id in OpenGL, usually you can do this by cast it to void* using reinterpret_cast in C++.

C: bool easyar_Renderer_renderToTexture(easyar_Renderer * This, easyar_Drawable * frame, void * texture)
C++11: bool renderToTexture(std::shared_ptr<Drawable> frame, void * texture)
Traditional C++: bool renderToTexture(Drawable * frame, void * texture)
Java: public native boolean renderToTexture(Drawable frame, long texture)
Objective-C: - (bool)renderToTexture:(easyar_Drawable *)frame texture:(void *)texture
Swift (since EasyAR SDK 2.1.0): public func renderToTexture(_ frame: Drawable?, _ texture: OpaquePointer) -> Bool

renderErrorMessage

Render error message to the current bound FBO.

If a key validation fails, you can use this to render the error message directly onto the screen.

Returns true if key validation fails.

C: bool easyar_Renderer_renderErrorMessage(easyar_Renderer * This, easyar_Vec4I viewport)
C++11: bool renderErrorMessage(Vec4I viewport)
Traditional C++: bool renderErrorMessage(Vec4I viewport)
Java: public native boolean renderErrorMessage(Vec4I viewport)
Objective-C: - (bool)renderErrorMessage:(easyar_Vec4I *)viewport
Swift (since EasyAR SDK 2.1.0): public func renderErrorMessage(_ viewport: Vec4I) -> Bool

renderErrorMessageToTexture

Render error message to texture.

If a key validation fails, you can use this to render the error message directly onto the screen.

Returns true if key validation fails.

C: bool easyar_Renderer_renderErrorMessageToTexture(easyar_Renderer * This, void * texture)
C++11: bool renderErrorMessageToTexture(void * texture)
Traditional C++: bool renderErrorMessageToTexture(void * texture)
Java: public native boolean renderErrorMessageToTexture(long texture)
Objective-C: - (bool)renderErrorMessageToTexture:(void *)texture
Swift (since EasyAR SDK 2.1.0): public func renderErrorMessageToTexture(_ texture: OpaquePointer) -> Bool