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

vertexProgARB.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 #ifndef __VERTEX_PROGRAM_ARB_DOT_H
00020 #define __VERTEX_PROGRAM_ARB_DOT_H
00021 
00022 #include "stateGLI.h"
00023 #include "pbuffGlift.h"
00024 #include <GL/glew.h>
00025 
00026 namespace glift {
00027 
00028 /////////////////////////////////////////////////////////////////////////
00029 ///
00030 /// VertexProgARB.h: interface for the VertexProgARB class.
00031 ///
00032 /// - Class for an ARB vertex programs.
00033 ///////////////////////////////////////////////////////////////////////
00034 
00035 class VertexProgARB : public VertexShader
00036 {
00037 public:
00038    //construct a vertex program
00039    //  if isFileName is true, assumes the vertProg is a file, and tries to 
00040    //     read it, then loads the text in this file, othewize it assumes you
00041    //     passed in the string that is the vertex program itself
00042    VertexProgARB( const char *vertProg, 
00043                   bool isFileName = false, 
00044                   PBuffGlift* pbuff=NULL,
00045                   bool noload = false); 
00046 
00047    VertexProgARB( const VertexProgARB &rhs); 
00048    VertexProgARB& operator=( const VertexProgARB& rhs );
00049 
00050 
00051    virtual ~VertexProgARB();
00052 
00053    void         init();
00054    virtual void reset(); //Destroy OpenGL shader object and re-initialize shader.
00055    virtual void reload(const char *shader);
00056 
00057    virtual void setLocalConstf(unsigned int constNum, const gutz::vec4f& constant);
00058    virtual void setLocalConstd(unsigned int constNum, const gutz::vec4d& constant);
00059 
00060    virtual char *getProgText() { return m_vertProg; }
00061    virtual char *getProgFile() { return m_vertProgFile; }
00062    virtual void  setProgFile(const char *name);
00063 
00064 protected:
00065    virtual void bindDef();
00066    virtual void releaseDef();
00067 
00068 private:
00069    char        *m_vertProg;
00070    char        *m_vertProgFile;
00071    GLuint                m_shaderNum;           /// OpenGL shader object number
00072    PBuffGlift*   m_pbuff;                       /// The pbuffer context in which this shader exists (optional)
00073    int                   m_maxLocalParams;
00074 
00075    void destroy();
00076    void initMembers( const char *vertProg, bool isFileName, GLuint shaderNum, PBuffGlift* pbuff );
00077    void initMembers( const VertexProgARB &rhs);
00078 
00079 };
00080 
00081 typedef gutz::SmartPtr<VertexProgARB> VertexProgARBSP;
00082 
00083 } //end namespace glift
00084 
00085 
00086 #endif
00087 

Send questions, comments, and bug reports to:
jmk