arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

fragProgARB.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////
00002 // 10/3/02      Joe M. Kniss    Scientific Computing and Imaging Institute
00003 // School of Computing          University of Utah
00004 //
00005 //  This library is free software; you can redistribute it and/or
00006 //  modify it under the terms of the GNU Lesser General Public
00007 //  License as published by the Free Software Foundation; either
00008 //  version 2.1 of the License, or (at your option) any later version.
00009 //
00010 //  This library is distributed in the hope that it will be useful,
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 //  Lesser General Public License for more details.
00014 //
00015 //  You should have received a copy of the GNU Lesser General Public
00016 //  License along with this library; if not, write to the Free Software
00017 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 /////////////////////////////////////////////////////////////////////////
00019 // Aaron Lefohn
00020 //
00021 
00022 #ifndef __FRAGMENT_PROGRAM_ARB_DOT_H
00023 #define __FRAGMENT_PROGRAM_ARB_DOT_H
00024 
00025 #include "stateGLI.h"
00026 #include "pbuffGlift.h"
00027 #include <GL/glew.h>
00028 
00029 namespace glift {
00030 
00031 ///////////////////////////////////////////////////////////////////////
00032 /// FragProgARB.h: interface for the FragProgARB class.
00033 ///
00034 /// - Class for an ARB fragment program.
00035 ///////////////////////////////////////////////////////////////////////
00036 
00037 class FragProgARB : public PixelShader
00038 {
00039 public:
00040    //construct a fragment program
00041    //  if isFileName is true, assumes the fragProg is a file, and tries to 
00042    //     read it, then loads the text in this file, othewize it assumes you
00043    //     passed in the string that is the fragment program itself
00044    FragProgARB( const char *fragProg, 
00045                 bool isFileName = false, 
00046                 PBuffGlift* pbuff=NULL, 
00047                 bool noload = false ); 
00048 
00049    FragProgARB( const FragProgARB &rhs); 
00050    FragProgARB& operator=( const FragProgARB& rhs );
00051 
00052 
00053    virtual ~FragProgARB();
00054 
00055    void         init();
00056    virtual void reset(); //Destroy OpenGL shader object and re-initialize shader.
00057    virtual void reload(const char *shader);
00058 
00059    int  getInfoInt( GLenum param );
00060    virtual void setLocalConstf(unsigned int constNum, const gutz::vec4f& constant);
00061    virtual void setLocalConstd(unsigned int constNum, const gutz::vec4d& constant);
00062 
00063    /// will be 0 if invalid
00064    virtual char *getProgText() { return m_fragProg; }
00065    virtual char *getProgFile() { return m_fragProgFile; }       
00066    virtual void  setProgFile(const char *name);
00067 
00068 protected:
00069    virtual void bindDef();
00070    virtual void releaseDef();
00071 
00072 private:
00073    char        *m_fragProg;
00074    char        *m_fragProgFile;
00075    GLuint                m_shaderNum;           /// OpenGL shader object number
00076    PBuffGlift  *m_pbuff;                        /// The pbuffer context in which this shader exists (optional)
00077    int                   m_maxLocalParams;      /// Max number of local parameter constants
00078 
00079    void destroy();
00080    void initMembers( const char *fragProg, bool isFileName, GLuint shaderNum, PBuffGlift* pbuff );
00081    void initMembers( const FragProgARB &rhs);
00082 
00083 };
00084 
00085 typedef gutz::SmartPtr<FragProgARB> FragProgARBSP;
00086 
00087 } //end namespace glift
00088 
00089 
00090 #endif
00091 

Send questions, comments, and bug reports to:
jmk