[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Usata-commits] Changes to usata2/src/system.cpp
From: |
David Lau |
Subject: |
[Usata-commits] Changes to usata2/src/system.cpp |
Date: |
Thu, 20 Jan 2005 15:20:33 -0500 |
Index: usata2/src/system.cpp
diff -u usata2/src/system.cpp:1.16 usata2/src/system.cpp:1.17
--- usata2/src/system.cpp:1.16 Sun Jan 16 20:02:38 2005
+++ usata2/src/system.cpp Thu Jan 20 20:20:30 2005
@@ -10,7 +10,7 @@
// included in the software distribution, or visit
// http://www.fsf.org/licenses/gpl.html.
//
-// $Id: system.cpp,v 1.16 2005/01/16 20:02:38 Descender Exp $
+// $Id: system.cpp,v 1.17 2005/01/20 20:20:30 skunix Exp $
#include "system.hpp"
#include <SDL.h>
@@ -19,11 +19,11 @@
#include <boost/format.hpp>
#include <GL/glew.h>
#include "log.hpp"
+#include "config.hpp"
namespace usata
{
-
namespace system
{
static bool glew_was_init = false;
@@ -42,6 +42,83 @@
}
+ namespace video
+ {
+ namespace
+ {
+ Capabilities capabilities;
+ }
+ void
+ Capabilities::update()
+ {
+
+ log::BufferedStream logstream;
+
+ ConfigSection conf("video/gl");
+
+ // Figure out texture compression
+ use_texture_compression =
conf.get_b("texture_compression", true);
+ if (use_texture_compression)
+ {
+ arb_texture_compression
=(GLEW_ARB_texture_compression? true:false);
+ s3_texture_compression =
(GLEW_EXT_texture_compression_s3tc);
+ }
+
+ setup_format();
+ if (GLEW_ARB_point_sprite)
+ point_sprites=true;
+ }
+
+ void
+ Capabilities::setup_format()
+ {
+ if (!(s3_texture_compression ||
arb_texture_compression))
+ {
+ use_texture_compression = false;
+ }
+
+ if (use_texture_compression)
+ {
+ compressed_format[1] =
(arb_texture_compression?
+
GL_COMPRESSED_LUMINANCE_ARB :
+
GL_LUMINANCE_ALPHA);
+
+ compressed_format[2] =
(arb_texture_compression?
+
GL_COMPRESSED_LUMINANCE_ALPHA_ARB :
+
GL_LUMINANCE_ALPHA);
+
+ if (s3_texture_compression)
+ {
+ compressed_format[0] = 0;
+ // This will set the LUMINANCE type to arb
texture compression
+ // if its available. (I sorta doubt this is
required, but
+ // but better safe ;) )
+ compressed_format[3] =
GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+ compressed_format[4] =
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
+ }
+ else if (arb_texture_compression)
+ {
+ compressed_format[3] =
GL_COMPRESSED_RGB_ARB;
+ compressed_format[4] =
GL_COMPRESSED_RGBA_ARB;
+ }
+ else {} //shouldnt ever get here
+ }
+ else
+ {
+ compressed_format[1] = GL_LUMINANCE;
+ compressed_format[2] = GL_LUMINANCE_ALPHA;
+ compressed_format[3] = GL_RGB;
+ compressed_format[4] = GL_RGBA;
+ }
+ return;
+ }
+
+ const Capabilities& get_capabilities() throw()
+ {
+ return capabilities;
+ }
+ }
+
static bool initialized = false;
void init()
{
@@ -113,10 +190,7 @@
if (GLEW_ARB_texture_non_power_of_two)
log << "Non power-of-2 texture sizes\n";
-
- if (GLEW_ARB_texture_compression)
- log << "ARB texture compression\n";
-
+
if (GLEW_EXT_texture_compression_s3tc)
log << "S3TC texture compression\n";
}
@@ -137,8 +211,9 @@
}
// Point sprites
+/*
if (GLEW_ARB_point_sprite)
- log << "Point sprites\n";
+ log << "Point sprites\n";*/
}
VideoMode
@@ -209,7 +284,7 @@
{
init_glew();
print_gl_capabilities();
-
+ video::capabilities.update();
glViewport(0,0,(GLsizei)vm.width, (GLsizei) vm.height);
}
else
- [Usata-commits] Changes to usata2/src/system.cpp, David Lau, 2005/01/02
- [Usata-commits] Changes to usata2/src/system.cpp, David Lau, 2005/01/03
- [Usata-commits] Changes to usata2/src/system.cpp, David Lau, 2005/01/09
- [Usata-commits] Changes to usata2/src/system.cpp, Chong Kai Xiong, 2005/01/16
- [Usata-commits] Changes to usata2/src/system.cpp,
David Lau <=
- [Usata-commits] Changes to usata2/src/system.cpp, David Lau, 2005/01/21
- [Usata-commits] Changes to usata2/src/system.cpp, David Lau, 2005/01/28