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

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

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

revision 1.13 by jvk, Mon Sep 16 18:57:21 2002 UTC revision 1.14 by mudyc, Tue Sep 17 15:11:07 2002 UTC
# Line 12  Line 12 
12  #include <vector>  #include <vector>
13  using std::vector;  using std::vector;
14    
 #include <map>  
   
15  // Should include nvidia's gl.h...  // Should include nvidia's gl.h...
16  //extern "C" void glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params);  //extern "C" void glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params);
17    
# Line 22  namespace CallGL { Line 20  namespace CallGL {
20    
21      using std::string;      using std::string;
22      using std::vector;      using std::vector;
     using std::map;  
23    
24      using std::cerr;      using std::cerr;
25      using std::cout;      using std::cout;
26    
27      map<string, void (*)()> extended_calls;      ExtCalls ext_calls;
     ExtCallsCheckList ext_check;  
28    
29      static bool Begin = false;      static bool Begin = false;
30    
# Line 438  namespace CallGL { Line 434  namespace CallGL {
434    
435  #endif  #endif
436    
437    
438    #define FLOAT3(ADDRESS) ((void (*)(float, float, float))(ADDRESS))
439    #define FLOAT4(ADDRESS) ((void (*)(float, float, float, float))(ADDRESS))
440    
441  // XXX  // XXX
442  //#define USE_GL_EXTENSION_CALLS  //#define USE_GL_EXTENSION_CALLS
443  #ifdef USE_GL_EXTENSION_CALLS  #ifdef USE_GL_EXTENSION_CALLS
444                
         } else if (checkfunc(v, "GetProcAddress", 1)) {  
           if (ext_check.isCallNameFound(v[1])) {  
   
             void (* addr)() = Os::getExtendedProcAddress(v[1]);  
   
             if (addr == NULL) {  
               cerr << v[1] << " not supported by your gl-driver.\n";  
               return false;  
             }  
             extended_calls[v[1]] = addr;  
   
           } else {  
             cerr << v[1] << " not found from extended calls list.\n";  
             return false;  
           }  
445          } else {          } else {
           if (ext_check.isCallNameFound(v[0])) {  
             ExtCall ext_c = ext_check.getCallObj(v[0]);  
446    
447              void (* addr)() = extended_calls[v[0]];            void (* addr)() = ext_calls.getAddress(v[0]);
448                          bool isOpenGLCall = true;
449              if (addr == NULL) {            if (addr == NULL) isOpenGLCall = false;
450                cerr << v[0] << " is extension function but "<<            
451                  "it haven't been initialized with \"GetProcAddress\".\n";            if (isOpenGLCall) {
452                return false;              if(checkfunc(v, "SecondaryColorEXT", 3)) {
453              }                void (* a)(float,float,float) = FLOAT3(addr);
             switch (ext_c.getType()) {  
             case EXT_ERROR:  
               cerr << "something very broken in extended call.\n";  
               return false;  
             case FLOAT3: { if (v.size() != 4) goto error_args_count;  
               void (* a)(float,float,float);  
               a = (void (*)( float, float,float))(addr);  
454                (* a)( atof(v[1].c_str()), atof(v[2].c_str()),                (* a)( atof(v[1].c_str()), atof(v[2].c_str()),
455                          atof(v[3].c_str()));                       atof(v[3].c_str()));
456                break;              } else if(checkfunc(v, "BlendColorEXT", 4)) {
457              }                void (* a)(float,float,float,float) = FLOAT4(addr);
             case FLOAT4: {  
               if (v.size() != 5) goto error_args_count;  
               void (* a)(float,float,float,float);  
               a = (void (*)( float, float,float,float))(addr);  
458                (* a)( atof(v[1].c_str()), atof(v[2].c_str()),                (* a)( atof(v[1].c_str()), atof(v[2].c_str()),
459                          atof(v[3].c_str()), atof(v[4].c_str()));                       atof(v[3].c_str()), atof(v[4].c_str()));
460                break;              } else {
461              }                cerr << "Extension OpenGL call \'" << v[0]
462      /*      //probably just put ints to map<string> or something                     <<"\' not supported.\n";
             case ENUM1: {  
               if (v.size() != 2) goto error_args_count;  
               void (* a)(enum);  
               a = (void (*)(enum))(addr);  
   
               //(* a)( );  
               break;  
463              }              }
     */  
             } // end of switch  
   
464            } else {            } else {
           error_args_count:  
465              cerr << "Unknown function \"" << v[0] << "\" with "              cerr << "Unknown function \"" << v[0] << "\" with "
466                   << v.size() - 1 << " arguments\n";                   << v.size() - 1 << " arguments\n";
467              return false;              return false;

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

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