FastCV Sample Application  1.7.1
CameraRendererRGB565GL2.h
00001 
00002 /*
00003  * Copyright (c) 2010-2011 Qualcomm Technologies Incorporated.
00004  *
00005  * @file Defines CameraRendererRGB565GL2 class. 
00006  *         This class provides efficeint rendering 
00007  *       of a camera image.
00008  *
00009  */
00010 
00011 
00012 #ifndef __CAMERARENDERER_RGB565_GL2_HEADERFILE__
00013 #define __CAMERARENDERER_RGB565_GL2_HEADERFILE__
00014 
00015 
00016 #include <stdint.h>
00017 #include <GLES2/gl2.h>
00018 #include <GLES2/gl2ext.h>
00019 
00020 #include "FPSCounter.h"
00021 
00022 class CameraBuffer;
00023 
00047 class CameraRendererRGB565GL2
00048 {
00049 
00050 public:
00058    CameraRendererRGB565GL2(bool npotTextures = false);
00059 
00070    bool Render
00071    (
00072       const uint8_t* img, 
00073       uint16_t w, 
00074       uint16_t h
00075    );
00076    
00077 
00084    float GetRenderingFPS();
00085 
00086 
00093    bool Init();
00094 
00102    void UnInit();
00103 
00104 
00109    virtual ~CameraRendererRGB565GL2();
00110 
00111 protected:
00112 
00116    bool           mInitialized;
00117 
00121    bool          mNPOTTextures;
00122 
00126    GLuint         mProgramObject;
00127 
00132    static GLfloat mVertices[];
00133 
00137    static const GLfloat mLandscapeVertices[];
00138 
00142    static const GLfloat mLandscapeReverseVertices[];
00143 
00147    static const GLfloat mPortraitVertices[];
00148 
00152    static const GLfloat mPortraitReverseVertices[];
00153 
00157    GLint          mGL_av4_PositionLoc;
00158 
00163    GLint          mGL_av2_TexCoordLoc;
00164 
00169    GLuint         mTextureId[1];  // texture ID's
00170 
00174    GLint          mGL_u_ImgRGBLoc;
00175 
00179    FPSCounter        mFPSCounter;
00180 
00184    GLuint         mWidth;
00185 
00189    GLuint         mHeight;
00190 
00197    bool CreateTextures();
00198 
00199   
00210    bool UpdateTextures(const uint8_t* rgbImg, uint16_t w, uint16_t h);
00211 
00212 
00219    bool CreateShaderProgram();
00220 
00221 
00228    bool InitGPU();
00229 
00243    bool RenderGPURGB(const uint8_t* rgbImg, uint16_t w, uint16_t h);
00244 
00245 }; // class CameraRendererRGB565GL2
00246 
00247 #endif //#ifndef __CAMERARENDERER_RGB565_GL2_HEADERFILE__
 All Data Structures Functions Variables