C++ Java Unity
Java Reference
Renderer Class Reference

Detailed Description

A helper class that provides common AR related rendering tasks.

The Renderer class provides methods to fulfill typical AR related tasks such as rendering the video background and 3D objects with up-to-date pose data. It also exposes methods for configuring the rendering frame rate in both AR and VR use cases.

Note: Some methods of the Renderer class may only be called from the render thread.

Classes

class  FPSHINT_FLAGS
 Flags for getRecommendedFps() to provide hints about the rendering context. More...
 

Public Member Functions

boolean equals (Object obj)
 
void begin (State state)
 Tell the Renderer that rendering of the current frame is about to begin using a specific State. More...
 
void end ()
 Tell the Renderer that rendering is finished. More...
 
boolean updateVideoBackgroundTexture (TextureUnit textureUnit)
 Update the video background texture. More...
 
boolean updateVideoBackgroundTexture ()
 Update the video background texture. More...
 
void setVideoBackgroundConfig (VideoBackgroundConfig cfg)
 Configure the layout of the video background (its location/size on screen). More...
 
VideoBackgroundConfig getVideoBackgroundConfig ()
 Get the current layout configuration of the video background. More...
 
VideoBackgroundTextureInfo getVideoBackgroundTextureInfo ()
 Get the texture info associated with the current video background. More...
 
boolean setVideoBackgroundTexture (TextureData textureData)
 Tell Vuforia which texture to use when updating the video background. More...
 
boolean setTargetFps (int fps)
 Set a target rendering frame rate. More...
 
int getRecommendedFps (int flags)
 Get a recommended rendering frame rate based on application usage context. More...
 
int getRecommendedFps ()
 Get a recommended rendering frame rate based on application usage context. More...
 

Static Public Member Functions

static Renderer getInstance ()
 Returns the Renderer singleton instance. More...
 

Static Public Attributes

static final int TARGET_FPS_CONTINUOUS = -1
 

Member Function Documentation

boolean equals ( Object  obj)
static Renderer getInstance ( )
static

Returns the Renderer singleton instance.

void begin ( State  state)

Tell the Renderer that rendering of the current frame is about to begin using a specific State.

Use this method if you want to draw a specific camera frame, rather than the latest available one.

Parameters
statethe State that rendering will be based on.

Note: May only be called from the render thread.

Note: You may pass a different renderData object to end(); details are platform specific

void end ( )

Tell the Renderer that rendering is finished.

Note: May only be called from the render thread.

boolean updateVideoBackgroundTexture ( TextureUnit  textureUnit)

Update the video background texture.

Parameters
textureUnitA pointer to a 3D graphics rendering API specific identifier which binds the texture to the textureUnit value. Pass NULL if you do not wish Vuforia to bind the texture to the textureUnit.

This method may only be called on the render thread, between calls to begin() and end().

The textureUnit (if any) can be discarded after the call as it is only used during the call.

boolean updateVideoBackgroundTexture ( )

Update the video background texture.

This method may only be called on the render thread, between calls to begin() and end().

The textureUnit (if any) can be discarded after the call as it is only used during the call.

void setVideoBackgroundConfig ( VideoBackgroundConfig  cfg)

Configure the layout of the video background (its location/size on screen).

VideoBackgroundConfig getVideoBackgroundConfig ( )

Get the current layout configuration of the video background.

VideoBackgroundTextureInfo getVideoBackgroundTextureInfo ( )

Get the texture info associated with the current video background.

The result is only valid after a call to updateVideoBackgroundTexture().

boolean setVideoBackgroundTexture ( TextureData  textureData)

Tell Vuforia which texture to use when updating the video background.

Use in conjunction with updateVideoBackgroundTexture().

Note: May only be called from the render thread.

Parameters
textureDataA reference to 3D graphics rendering API specific texture data, such as GLTextureData. Vuforia makes a copy of the textureData object, so you can release the data after the call has been made.
boolean setTargetFps ( int  fps)

Set a target rendering frame rate.

Request a rendering frame rate that the application should target in its render loop. Not all requested frame rates may be achievable on all devices and/or usage contexts.

The target frame rate may influence power consumption, heat buildup, battery life and/or application performance. See getRecommendedFps() for more details.

You may use a fixed rate (such as 30 or 60). To get a recommended frame rate, call getRecommendedFps() specifying your usage context via the flags.

Parameters
fpsThe desired frame rate, in frames per second, or TARGET_FPS_CONTINUOUS for continuous rendering (if supported).
Returns
true on success, otherwise false (check application logs for details).
int getRecommendedFps ( int  flags)

Get a recommended rendering frame rate based on application usage context.

The target rendering frame rate of an AR or VR application is an important trade-off between optimal experience and device power usage. The choice is influenced by multiple parameters including device type, the active Trackers, the camera and/or sensor frame rates.

Furthermore there are application specific trade offs to consider, which you can pass to this method via FPSHINT_FLAGS. For example, an application with animated content may need consistent 60 fps rendering, even on a device that can only deliver tracking results at 30 fps.

This method considers the capabilities of the current device along with any hint flags passed to it and returns a recommended frame rate, which should be passed to setTargetFps().

Note: This method may return different values based on the CameraDevice's VideoMode and/or the set of currently active Trackers. It is therefore recommended that you call this method only after initializing the camera and starting all desired Trackers, and possibly again after transitioning between application modes (for example when swapping from AR to VR mode or back).

Parameters
flagsFlags which hint at your application's usage context.
Returns
A recommended target frames per second, which should be passed to setTargetFps().
int getRecommendedFps ( )

Get a recommended rendering frame rate based on application usage context.

The target rendering frame rate of an AR or VR application is an important trade-off between optimal experience and device power usage. The choice is influenced by multiple parameters including device type, the active Trackers, the camera and/or sensor frame rates.

Furthermore there are application specific trade offs to consider, which you can pass to this method via FPSHINT_FLAGS. For example, an application with animated content may need consistent 60 fps rendering, even on a device that can only deliver tracking results at 30 fps.

This method considers the capabilities of the current device along with any hint flags passed to it and returns a recommended frame rate, which should be passed to setTargetFps().

Note: This method may return different values based on the CameraDevice's VideoMode and/or the set of currently active Trackers. It is therefore recommended that you call this method only after initializing the camera and starting all desired Trackers, and possibly again after transitioning between application modes (for example when swapping from AR to VR mode or back).

Returns
A recommended target frames per second, which should be passed to setTargetFps().

Member Data Documentation

final int TARGET_FPS_CONTINUOUS = -1
static