ProgramCG.h
Go to the documentation of this file.
00001 
00002 //      File:           ProgramCG.h
00003 //      Author:         Changchang Wu
00004 //      Description :   interface for the ProgramCG classes.
00005 //              ProgramCG:              Cg programs
00006 //              ShaderBagCG:    All Cg shaders for Sift in a bag
00007 //              FilterGLCG:             Cg Gaussian Filters
00008 //
00009 //      Copyright (c) 2007 University of North Carolina at Chapel Hill
00010 //      All Rights Reserved
00011 //
00012 //      Permission to use, copy, modify and distribute this software and its
00013 //      documentation for educational, research and non-profit purposes, without
00014 //      fee, and without a written agreement is hereby granted, provided that the
00015 //      above copyright notice and the following paragraph appear in all copies.
00016 //      
00017 //      The University of North Carolina at Chapel Hill make no representations
00018 //      about the suitability of this software for any purpose. It is provided
00019 //      'as is' without express or implied warranty. 
00020 //
00021 //      Please send BUG REPORTS to ccwu@cs.unc.edu
00022 //
00024 
00025 
00026 #if defined(CG_SIFTGPU_ENABLED) 
00027 
00028 #ifndef _PROGRAM_CG_H
00029 #define _PROGRAM_CG_H
00030 
00031 #include "ProgramGPU.h"
00032 class FragmentProgram;
00033 #include "Cg/cgGL.h"
00034 
00035 class ProgramCG:public ProgramGPU  
00036 {
00037         CGprogram                 _programID; 
00038         CGprofile                 _profile;
00039         int                               _valid;
00040 public:
00041         static CGcontext _Context;
00042         static CGprofile _FProfile;     
00043 public:
00044         operator CGprogram (){return _programID;}
00045         CGprogram GetProgramID(){return _programID;}
00046         int UseProgram();
00047         int IsValidProgram(){return _programID && _valid;}
00048         static void  ErrorCallback();
00049         static void InitContext();
00050         static void DestroyContext();
00051         ProgramCG(const char * code, const char** cg_compile_args= NULL, CGprofile profile = ProgramCG::_FProfile);
00052         ProgramCG();
00053         virtual ~ProgramCG();
00054 
00055 };
00056 
00057 class ShaderBagCG:public ShaderBag
00058 {
00059         CGparameter _param_dog_texu;
00060         CGparameter     _param_dog_texd;
00061         CGparameter _param_genlist_start_tex0;
00062         CGparameter _param_ftex_width;
00063         CGparameter _param_genlist_step_tex;
00064         CGparameter _param_genlist_step_tex0;
00065         CGparameter _param_genvbo_size;
00066         CGparameter _param_orientation_gtex;
00067         CGparameter _param_orientation_stex;
00068         CGparameter _param_orientation_size;
00069         CGparameter _param_descriptor_gtex;
00070         CGparameter _param_descriptor_size;
00071         CGparameter _param_descriptor_dsize;
00072         CGparameter _param_margin_copy_truncate;
00073         CGparameter _param_genlist_init_bbox;
00074 public:
00075         virtual void LoadDescriptorShader();
00076         void    LoadDescriptorShaderF2();
00077         static void  WriteOrientationCodeToStream(ostream& out);
00078         virtual void SetGenListInitParam(int w, int h);
00079         virtual void SetMarginCopyParam(int xmax, int ymax);
00080         virtual void SetFeatureOrientationParam(int gtex, int width, int height, float sigma, int stex = 0, float step = 1.0f);
00081         virtual void SetFeatureDescirptorParam(int gtex, int otex, float dwidth, float fwidth, float width, float height, float sigma);
00082         virtual void SetSimpleOrientationInput(int oTex, float sigma, float sigma_step);
00083         void LoadOrientationShader();
00084         virtual void SetGenListStartParam(float width, int tex0);
00085         static ProgramCG* LoadGenListStepShader(int start, int step);
00086         static ProgramCG* LoadGenListStepShaderV2(int start, int step);
00087         void LoadGenListShader(int ndoglev,  int nlev);
00088         virtual void UnloadProgram();
00089         virtual void SetDogTexParam(int texU, int texD);
00090         virtual void SetGenListStepParam(int tex, int tex0);
00091         virtual void SetGenVBOParam( float width, float fwidth,  float size);
00092         virtual void LoadFixedShaders();
00093         virtual void LoadDisplayShaders();
00094         virtual void LoadKeypointShader(float threshold, float edgeThreshold);
00095         virtual int  LoadKeypointShaderMR(float threshold, float edgeThreshold);
00096         ShaderBagCG();
00097         virtual ~ShaderBagCG(){}
00098 };
00099 
00100 
00101 class FilterGLCG : public FilterProgram
00102 {
00103 private:
00104         ProgramGPU* CreateFilterH(float kernel[], float offset[], int width);
00105         ProgramGPU* CreateFilterV(float kernel[], float offset[], int height);
00106         //packed version 
00107         ProgramGPU* CreateFilterHPK(float kernel[], float offset[], int width);
00108         ProgramGPU* CreateFilterVPK(float kernel[], float offset[], int height);
00109 };
00110 
00111 class ShaderBagPKCG:public ShaderBag
00112 {
00113 private:
00114         CGparameter _param_dog_texu;
00115         CGparameter     _param_dog_texd;
00116         CGparameter _param_margin_copy_truncate;
00117         CGparameter _param_grad_pass_texp;
00118         CGparameter _param_genlist_init_bbox;
00119         CGparameter _param_genlist_start_tex0;
00120         CGparameter _param_ftex_width;
00121         CGparameter _param_genlist_step_tex;
00122         CGparameter _param_genlist_step_tex0;
00123         CGparameter _param_genlist_end_ktex;
00124         CGparameter _param_genvbo_size;
00125         CGparameter _param_orientation_gtex;
00126         CGparameter _param_orientation_otex;
00127         CGparameter _param_orientation_size;
00128         CGparameter     _param_descriptor_gtex; 
00129         CGparameter     _param_descriptor_otex;
00130         CGparameter     _param_descriptor_size; 
00131         CGparameter     _param_descriptor_dsize;
00132 
00133 public:
00134         ShaderBagPKCG();
00135         virtual ~ShaderBagPKCG(){}
00136         virtual void LoadDescriptorShader();
00137         virtual void LoadDescriptorShaderF2();
00138         virtual void LoadOrientationShader();
00139         virtual void LoadGenListShader(int ndoglev, int nlev);
00140         virtual void LoadGenListShaderV2(int ndoglev, int nlev);
00141         virtual void UnloadProgram() ;
00142         virtual void LoadKeypointShader(float threshold, float edgeTrheshold);
00143         virtual void LoadFixedShaders();
00144         virtual void LoadDisplayShaders();
00145         virtual void SetGradPassParam(int texP);
00146         virtual void SetGenListEndParam(int ktex);
00147 public:
00148         //parameters
00149         virtual void SetGenListStartParam(float width, int tex0);
00150         virtual void SetGenListInitParam(int w, int h);
00151         virtual void SetMarginCopyParam(int xmax, int ymax);
00152         virtual void SetDogTexParam(int texU, int texD);
00153         virtual void SetGenListStepParam(int tex, int tex0);
00154         virtual void SetGenVBOParam( float width, float fwidth, float size);
00155         virtual void SetFeatureDescirptorParam(int gtex, int otex, float dwidth, float fwidth, float width, float height, float sigma);
00156         virtual void SetFeatureOrientationParam(int gtex, int width, int height, float sigma, int stex, float step);
00157         virtual void SetSimpleOrientationInput(int oTex, float sigma, float sigma_step);
00158 };
00159 #endif
00160 #endif
00161 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


rgbd_registration
Author(s): Ross Kidson
autogenerated on Thu May 23 2013 15:36:53