Renderer Class

Description

Augmenter是一个渲染器,用于渲染camera图像。它通常在渲染线程中使用。

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

切换图形API。这个函数通常不需要手动调用。

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

设置渲染设备。这个函数通常不需要手动调用。

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

渲染当前frame到当前绑定的FBO。这个方法应该在需要显示camera背景的每帧被调用。

viewport是Vec4I数据,和输入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

渲染当前frame到贴图。这个方法应该在需要显示camera背景的每帧被调用。

在OpenGL中, texture 应该被设为 texture id, 通常在C++中可以使用reinterpret_cast 将其转换成void*。

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

渲染错误信息到当前绑定的FBO。

如果key验证出错,可以使用这个方法将错误信息渲染到屏幕。

如果key验证出错,返回true。

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

渲染错误信息到贴图。

如果key验证出错,可以使用这个方法将错误信息渲染到屏幕。

如果key验证出错,返回true。

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