Getting Started with EasyAR
Header:#include "easyar/augmenter.hpp"
Inherits:RefBase

Description

An Augmenter is a renderer that gets a frame from trackers and render the camera image as background in AR scenes. It is generally used in the rendering thread.

Public Types

enumAPI{kAugmenterAPIDefault, kAugmenterAPINONE, kAugmenterAPIGLES2, kAugmenterAPIGL, kAugmenterAPID3D9, kAugmenterAPID3D11}

Public Functions

Augmenter()
virtual~Augmenter()
voidchooseAPI(API api = kAugmenterAPIDefault, void* device = 0)
FramenewFrame(const ImageTracker& obj) (until 1.2.1)
FramenewFrame(const BarCodeScanner& obj) (until 1.2.1)
FramenewFrame() (since 1.3.0)
virtual boolattachCamera(const CameraDevice& obj) (since 1.3.0)
virtual booldetachCamera(const CameraDevice& obj) (since 1.3.0)
voidsetViewPort(const Vec4I& viewport)
Vec4IviewPort() const
booldrawVideoBackground()
Vec2IvideoBackgroundTextureSize()
PixelFormatvideoBackgroundTextureFormat()
voidsetVideoBackgroundTextureID(int id)
voidsetVideoBackgroundTextureID(void* id)
intid() const

enum Augmenter::API

ConstantValueDescription
kAugmenterAPIDefault0The default API.
kAugmenterAPINONE1The empty API.
kAugmenterAPIGLES22OpenGL ES 2.
kAugmenterAPIGL3Desktop OpenGL.
kAugmenterAPID3D94Direct3D9.
kAugmenterAPID3D115Direct3D11.

Augmenter()

Creates a Augmenter object.

virtual ~Augmenter()

Destroys the Augmenter object.

void chooseAPI(API api = kAugmenterAPIDefault, void* device = 0)

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

Frame newFrame(const ImageTracker& obj) (until 1.2.1)

Gets a new frame from ImageTracker.

Frame newFrame(const BarCodeScanner& obj) (until 1.2.1)

Gets a new frame from BarCodeScanner.

Frame newFrame() (since 1.3.0)

Gets a new frame. An CameraDevice must be attached before getting a valid frame.

virtual bool attachCamera(const CameraDevice& obj) (since 1.3.0)

Attach CameraDevice to the Augmenter. Frame from newFrame will be empty if no CameraDevice has been attached.

virtual bool detachCamera(const CameraDevice& obj) (since 1.3.0)

Detach CameraDevice from the Augmenter.

void setViewPort(const Vec4I& viewport)

Sets the viewport of camera image draw. A view port is a Vec4I data like the four input parameters in glViewPort {left, top, width, height}.

When a texture is set via setVideoBackgroundTextureID, the max viewport size that contains image data can be retrived by videoBackgroundTextureSize and the max size will be used if viewport size is zero.

Vec4I viewPort() const

Gets current viewport.

bool drawVideoBackground()

Draws current camera image as background. It will draw the image to the current context when no texture is set. After a texture is set via setVideoBackgroundTextureID, it will draw to the texture. This function should be called in each frame if a camera background is needed.

Vec2I videoBackgroundTextureSize()

Gets current background camera image size. This size may change if CameraDevice size changed. If current frame is not available, {0, 0} will be returned.

PixelFormat videoBackgroundTextureFormat()

Gets current background camera image format. If current frame is not available, kPixelFormatUnknown will be returned.

void setVideoBackgroundTextureID(int id)

Sets texture id. If a valid id is set, the texture will be updated after a drawVideoBackground call. If id equals 0, it will clear previously set value and drawVideoBackground will draw based on the current context settings and not draw to texture.

void setVideoBackgroundTextureID(void* id)

Sets texture id, id is used by value. If a valid id is set, the texture will be updated after a drawVideoBackground call. If id equals 0, it will clear previously set value and drawVideoBackground will draw based on the current context settings and not draw to texture.

int id() const

Returns the Augmenter id.