/[usata]/usata2/src/system.cpp
ViewVC logotype

Diff of /usata2/src/system.cpp

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

revision 1.16 by Descender, Sun Jan 16 20:02:38 2005 UTC revision 1.17 by skunix, Thu Jan 20 20:20:30 2005 UTC
# Line 19  Line 19 
19  #include <boost/format.hpp>  #include <boost/format.hpp>
20  #include <GL/glew.h>  #include <GL/glew.h>
21  #include "log.hpp"  #include "log.hpp"
22    #include "config.hpp"
23    
24  namespace usata  namespace usata
25  {  {
26    
   
27  namespace system  namespace system
28  {  {
29                  static bool glew_was_init = false;                  static bool glew_was_init = false;
# Line 42  namespace system Line 42  namespace system
42                  }                  }
43    
44    
45            namespace video
46            {
47                    namespace
48                    {
49                            Capabilities capabilities;
50                    }
51                    void
52                    Capabilities::update()
53                    {
54    
55                            log::BufferedStream logstream;
56    
57                            ConfigSection conf("video/gl");
58    
59                            // Figure out texture compression
60                            use_texture_compression = conf.get_b("texture_compression", true);
61                            if (use_texture_compression)
62                            {      
63                                    arb_texture_compression =(GLEW_ARB_texture_compression? true:false);
64                                    s3_texture_compression = (GLEW_EXT_texture_compression_s3tc);
65                            }
66    
67                            setup_format();
68                            if (GLEW_ARB_point_sprite)
69                                    point_sprites=true;
70                    }
71            
72                    void    
73                    Capabilities::setup_format()
74                    {
75                            if (!(s3_texture_compression || arb_texture_compression))
76                            {
77                                    use_texture_compression = false;
78                            }
79    
80                            if (use_texture_compression)
81                            {
82                                    compressed_format[1] = (arb_texture_compression?
83                                                                                            GL_COMPRESSED_LUMINANCE_ARB :
84                                                                                            GL_LUMINANCE_ALPHA);
85    
86                                    compressed_format[2] = (arb_texture_compression?
87                                                                                            GL_COMPRESSED_LUMINANCE_ALPHA_ARB :
88                                                                                            GL_LUMINANCE_ALPHA);
89            
90                                    if (s3_texture_compression)
91                                    {
92                                            compressed_format[0] = 0;
93                                    // This will set the LUMINANCE type to arb texture compression
94                                    // if its available. (I sorta doubt this is required, but
95                                    // but better safe ;) )
96                                            compressed_format[3] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
97                                            compressed_format[4] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
98                                    }
99                                    else if (arb_texture_compression)
100                                    {
101                                            compressed_format[3] = GL_COMPRESSED_RGB_ARB;
102                                            compressed_format[4] = GL_COMPRESSED_RGBA_ARB;  
103                                    }
104                                    else {} //shouldnt ever get here        
105                            }      
106                            else
107                            {
108                                    compressed_format[1] = GL_LUMINANCE;
109                                    compressed_format[2] = GL_LUMINANCE_ALPHA;
110                                    compressed_format[3] = GL_RGB;
111                                    compressed_format[4] = GL_RGBA;
112                            }
113                            return;
114                    }
115    
116                    const Capabilities& get_capabilities() throw()
117                    {
118                            return capabilities;    
119                    }
120            }
121    
122          static bool initialized = false;          static bool initialized = false;
123          void init()          void init()
124          {          {
# Line 113  namespace system Line 190  namespace system
190    
191                          if (GLEW_ARB_texture_non_power_of_two)                          if (GLEW_ARB_texture_non_power_of_two)
192                                  log << "Non power-of-2 texture sizes\n";                                  log << "Non power-of-2 texture sizes\n";
193                            
                         if (GLEW_ARB_texture_compression)  
                                 log << "ARB texture compression\n";  
   
194                          if (GLEW_EXT_texture_compression_s3tc)                          if (GLEW_EXT_texture_compression_s3tc)
195                                  log << "S3TC texture compression\n";                                  log << "S3TC texture compression\n";
196                  }                  }
# Line 137  namespace system Line 211  namespace system
211                  }                  }
212    
213                  // Point sprites                  // Point sprites
214    /*
215                  if (GLEW_ARB_point_sprite)                  if (GLEW_ARB_point_sprite)
216                          log << "Point sprites\n";                          log << "Point sprites\n";*/
217          }          }
218    
219          VideoMode          VideoMode
# Line 209  namespace system Line 284  namespace system
284                  {                  {
285                          init_glew();                          init_glew();
286                          print_gl_capabilities();                          print_gl_capabilities();
287                            video::capabilities.update();
288                          glViewport(0,0,(GLsizei)vm.width, (GLsizei) vm.height);                                      glViewport(0,0,(GLsizei)vm.width, (GLsizei) vm.height);            
289                  }                  }
290                  else                  else

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

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