FastCV Sample Application  1.7.1
CameraRendererRGB565GL2 Class Reference

CameraRendererRGB565GL2 class provide functionality of rendering the camera image to the screen. More...

#include <CameraRendererRGB565GL2.h>

Public Member Functions

 CameraRendererRGB565GL2 (bool npotTextures=false)
 Basic Constructor.
bool Render (const uint8_t *img, uint16_t w, uint16_t h)
 Renders provided camera image in NV21 format in current viewport.
float GetRenderingFPS ()
 Returns GPU Rendering FPS for Camera frames.
bool Init ()
 Initializes the object.
void UnInit ()
 UnInitializes the object.
virtual ~CameraRendererRGB565GL2 ()
 Default desctructor.
 CameraRendererRGB565GL2 (bool npotTextures=false)
 Basic Constructor.
bool Render (const uint8_t *img, uint16_t w, uint16_t h)
 Renders provided camera image in NV21 format in current viewport.
float GetRenderingFPS ()
 Returns GPU Rendering FPS for Camera frames.
bool Init ()
 Initializes the object.
void UnInit ()
 UnInitializes the object.
virtual ~CameraRendererRGB565GL2 ()
 Default desctructor.

Protected Member Functions

bool CreateTextures ()
 Creating 2D texture for an RGB565 image.
bool UpdateTextures (const uint8_t *rgbImg, uint16_t w, uint16_t h)
 Updates texture with new input image.
bool CreateShaderProgram ()
 Creates shader program required to render yuv texture.
bool InitGPU ()
 Initializes the object.
bool RenderGPURGB (const uint8_t *rgbImg, uint16_t w, uint16_t h)
 Renders texture in current viewport by provide RGB image to GPU.
bool CreateTextures ()
 Creating 2D texture for an RGB565 image.
bool UpdateTextures (const uint8_t *rgbImg, uint16_t w, uint16_t h)
 Updates texture with new input image.
bool CreateShaderProgram ()
 Creates shader program required to render yuv texture.
bool InitGPU ()
 Initializes the object.
bool RenderGPURGB (const uint8_t *rgbImg, uint16_t w, uint16_t h)
 Renders texture in current viewport by provide RGB image to GPU.

Protected Attributes

bool mInitialized
bool mNPOTTextures
GLuint mProgramObject
GLint mGL_av4_PositionLoc
GLint mGL_av2_TexCoordLoc
GLuint mTextureId [1]
GLint mGL_u_ImgRGBLoc
FPSCounter mFPSCounter
GLuint mWidth
GLuint mHeight

Static Protected Attributes

static GLfloat mVertices []
static const GLfloat mLandscapeVertices []
static const GLfloat mLandscapeReverseVertices []
static const GLfloat mPortraitVertices []
static const GLfloat mPortraitReverseVertices []

Detailed Description

CameraRendererRGB565GL2 class provide functionality of rendering the camera image to the screen.

CameraRendererRGB565GL2 support multiple modes for rendering. If the user is using any of the GPU based rendering mode, CameraRendererRGB565GL2 requires the caller to setup the OpenGL ES 2.0 context and set up the OpenGL view port in which to draw the camera image.

Usage: Usage of CameraRender is very simple as shown below.

//CameraRendererRGB565GL2 object needs to be created during //initialization time of your application.

CameraRendererRGB565GL2 camRenderer();

//In your OpenGL Rendering loop please call following //function.

camRenderer.Render(img, w,h);


Constructor & Destructor Documentation

CameraRendererRGB565GL2::CameraRendererRGB565GL2 ( bool  npotTextures = false)

Basic Constructor.

Parameters:
npotTexturesIndicate if this renderer is to use non-power-of-two-textures or not. Default value is false.
CameraRendererRGB565GL2::CameraRendererRGB565GL2 ( bool  npotTextures = false)

Basic Constructor.

Parameters:
npotTexturesIndicate if this renderer is to use non-power-of-two-textures or not. Default value is false.

Member Function Documentation

Creates shader program required to render yuv texture.

Returns:
returns true if successfull false otherwise.

Creates shader program required to render yuv texture.

Returns:
returns true if successfull false otherwise.

Creating 2D texture for an RGB565 image.

Returns:
returns true if successfull false otherwise.

Creating 2D texture for an RGB565 image.

Returns:
returns true if successfull false otherwise.

Returns GPU Rendering FPS for Camera frames.

Returns:
Frames per Second.

Returns GPU Rendering FPS for Camera frames.

Returns:
Frames per Second.

Initializes the object.

Returns:
true if the object is initialized, false otherwise.

Initializes the object.

Returns:
true if the object is initialized, false otherwise.
bool CameraRendererRGB565GL2::InitGPU ( ) [protected]

Initializes the object.

Returns:
true if the object is initialized, false otherwise.
bool CameraRendererRGB565GL2::InitGPU ( ) [protected]

Initializes the object.

Returns:
true if the object is initialized, false otherwise.
bool CameraRendererRGB565GL2::Render ( const uint8_t *  img,
uint16_t  w,
uint16_t  h 
)

Renders provided camera image in NV21 format in current viewport.

Parameters:
imgInput image in NV21 format.
wWidth of input image.
hHeight of input image.
Returns:
true if rendering was successfull false otherwise.
bool CameraRendererRGB565GL2::Render ( const uint8_t *  img,
uint16_t  w,
uint16_t  h 
)

Renders provided camera image in NV21 format in current viewport.

Parameters:
imgInput image in NV21 format.
wWidth of input image.
hHeight of input image.
Returns:
true if rendering was successfull false otherwise.
bool CameraRendererRGB565GL2::RenderGPURGB ( const uint8_t *  rgbImg,
uint16_t  w,
uint16_t  h 
) [protected]

Renders texture in current viewport by provide RGB image to GPU.

Parameters:
rgbImgInput image in YUV420SP format.
wWidth of input image.
hHeight of input image.
Returns:
true if the rendering was successfull and false otherwise. If false see adb log for error messages from this class.
bool CameraRendererRGB565GL2::RenderGPURGB ( const uint8_t *  rgbImg,
uint16_t  w,
uint16_t  h 
) [protected]

Renders texture in current viewport by provide RGB image to GPU.

Parameters:
rgbImgInput image in YUV420SP format.
wWidth of input image.
hHeight of input image.
Returns:
true if the rendering was successfull and false otherwise. If false see adb log for error messages from this class.

UnInitializes the object.

Releases any graphics resources held such as shader programs and textures.

UnInitializes the object.

Releases any graphics resources held such as shader programs and textures.

bool CameraRendererRGB565GL2::UpdateTextures ( const uint8_t *  rgbImg,
uint16_t  w,
uint16_t  h 
) [protected]

Updates texture with new input image.

Parameters:
rgbImginput image in RGB565 format
wWidth of input image.
hHeight of input image.
Returns:
returns true if successfull false otherwise.
bool CameraRendererRGB565GL2::UpdateTextures ( const uint8_t *  rgbImg,
uint16_t  w,
uint16_t  h 
) [protected]

Updates texture with new input image.

Parameters:
rgbImginput image in RGB565 format
wWidth of input image.
hHeight of input image.
Returns:
returns true if successfull false otherwise.

Field Documentation

FPS counter for Camera frame rendering.

Location for OpenGL shader attribute for quad texture mapping.

Location for OpenGL shader attribute for quad vertices.

Location for OpenGL shader uniform for RGB Image sampler.

Height

Flag indicating initialization status

static const GLfloat CameraRendererRGB565GL2::mLandscapeReverseVertices [static, protected]
Initial value:
 
{
   1.0f, -1.0f, 0.0f, 
   0.0f, 0.0f, 
   1.0f, 1.0f, 0.0f, 
   0.0f, 1.0f, 
   -1.0f, -1.0f, 0.0f, 
   1.0f, 0.0f, 
   -1.0f, 1.0f, 0.0f, 
   1.0f, 1.0f 
}

Reference vertex array for reverse landscape rendering

static const GLfloat CameraRendererRGB565GL2::mLandscapeVertices [static, protected]
Initial value:
 
{
   -1.0f, 1.0f, 0.0f, 
   0.0f, 0.0f, 
   -1.0f, -1.0f, 0.0f, 
   0.0f, 1.0f, 
   1.0f, 1.0f, 0.0f, 
   1.0f, 0.0f, 
   1.0f, -1.0f, 0.0f, 
   1.0f, 1.0f 
}

Reference vertex array for landscape rendering

Flag indicating non-power-of-two texture support

static const GLfloat CameraRendererRGB565GL2::mPortraitReverseVertices [static, protected]
Initial value:
 
{
   -1.0f, -1.0f, 0.0f, 
   0.0f, 0.0f, 
   1.0f, -1.0f, 0.0f, 
   0.0f, 1.0f, 
   -1.0f, 1.0f, 0.0f, 
   1.0f, 0.0f, 
   1.0f, 1.0f, 0.0f, 
   1.0f, 1.0f 
}

Reference vertex array for reverse portrait rendering

static const GLfloat CameraRendererRGB565GL2::mPortraitVertices [static, protected]
Initial value:
 
{
   1.0f, 1.0f, 0.0f, 
   0.0f, 0.0f, 
   -1.0f, 1.0f, 0.0f, 
   0.0f, 1.0f, 
   1.0f, -1.0f, 0.0f, 
   1.0f, 0.0f, 
   -1.0f, -1.0f, 0.0f, 
   1.0f, 1.0f 
}

Reference vertex array for portrait rendering

Compiled and Linked Shader Program object.

Array for texture ids. Either one or two of these array will be used depending rendering mode.

static GLfloat CameraRendererRGB565GL2::mVertices [static, protected]

Vertex Array used to define Quad for drawing and its texture mapping.

GLuint CameraRendererRGB565GL2::mWidth [protected]

Width


The documentation for this class was generated from the following files:
 All Data Structures Functions Variables