/[gzz]/gzz/gfx/libcallgl/callgl.hxx
ViewVC logotype

Diff of /gzz/gfx/libcallgl/callgl.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by jvk, Mon Sep 16 13:59:42 2002 UTC revision 1.16 by mudyc, Tue Sep 17 15:11:07 2002 UTC
# Line 12  using std::string; Line 12  using std::string;
12  #include <vector>  #include <vector>
13  using std::vector;  using std::vector;
14    
15    #include <map>
16    using std::map;
17    
18  #include <boost/shared_ptr.hpp>  #include <boost/shared_ptr.hpp>
19  using boost::shared_ptr;  using boost::shared_ptr;
20    
# Line 180  namespace CallGL { Line 183  namespace CallGL {
183    
184    
185    
186    const int EXT_ERROR = 0;    /* Just a simple container for Extender Calls
187    const int FLOAT3    = 1;     *   -SecondaryColorEXT
188    const int FLOAT4    = 2;     *   -GL_EXT_blend_color
   const int ENUM1     = 3;  
   
   
   class ExtCall {  
   private:  
     string name;  
     int type;  
       
   public:  
     ExtCall(string s, int type) {  
       this->name = s;  
       this->type = type;  
     }  
   
     inline string getName(void) const { return name; }  
     inline int getType(void) const { return type; }  
   };  
   
   
   /* Just a simple container for ExtCalls  
    * All used extended calls should be listed in constructor.  
    *   -BlendColorEXT  
189     */     */
190    class ExtCallsCheckList {    class ExtCalls {
191    private:    private:
192      vector<ExtCall> list;      // < function name, proc address>
193        map<string, void (*)()> list_address;
194    
195        // <OpenGL call name, function name>
196        map<string, string> list_names;
197    
198    private:    private:
199      void add(string s, int type) {      void add(string call_name, string func_name) {
200        list.push_back(ExtCall(s, type));        list_names[call_name] = func_name;
201      }      }
202    
203    public:    public:
204      ExtCallsCheckList() {      ExtCalls() {
205        this->add("null", EXT_ERROR);        // EXT_secondary_color
206          add("SecondaryColorEXT", "glSecondaryColor3dEXT");
207    
208        // GL_ARB_imaging        // GL_EXT_blend_color
209        this->add("glBlendColorEXT", FLOAT4);        add("BlendColorEXT","glBlendColorEXT");
       this->add("BlendEquationEXT", ENUM1);  
210      }      }
211    
212      bool isCallNameFound(string str_find) const {      void (* getAddress(string call_name))() {
       for (unsigned int i=0; i<list.size(); i++) {  
         if (list[i].getName() == str_find) return true;  
       }  
       return false;  
     }  
213    
214      const ExtCall & getCallObj(string str_find) const {        string func_name = list_names[call_name];
215        for (unsigned int i=0; i<list.size(); i++) {        if (func_name == "") return NULL;
216          if( str_find == list[i].getName()) return list[i];  
217          void (* addr)() = list_address[func_name];
218          if (addr == NULL) {
219            addr = Os::getExtendedProcAddress(func_name);
220            list_address[func_name] = addr;
221        }        }
222        // be sure you added "exception"        return addr;
223        return list[0];      }      
     }  
224    };    };
   
225  }  }
226    
227  #endif // GZZ CALLGL HXX  #endif // GZZ CALLGL HXX
228    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26