Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-11 15:16:25 +0000
committerStijn Buys <ingar@osirion.org>2008-05-11 15:16:25 +0000
commitd2e93235b9ccd37bf8c8fb7c4376ab1911c83639 (patch)
tree61bfbf023228ba10abe488d8c8bd27359171c9f7 /src/render/textures.cc
parentd82c8f449c604d0f957e3dd190f7beae3596e6f9 (diff)
console font
Diffstat (limited to 'src/render/textures.cc')
-rw-r--r--src/render/textures.cc31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/render/textures.cc b/src/render/textures.cc
index eef5f1d..8dac3a3 100644
--- a/src/render/textures.cc
+++ b/src/render/textures.cc
@@ -28,8 +28,14 @@ void Textures::init()
load("textures/common/notex");
// console characters
- if (load("bitmaps/conchars") == 0) {
- con_error << "Essential file bitmaps/conchars missing" << std::endl;
+ if (!load("bitmaps/fonts/console", false)) {
+ con_error << "Essential file bitmaps/fonts/console missing" << std::endl;
+ core::application()->shutdown();
+ }
+
+ // console characters
+ if (!load("bitmaps/fonts/gui", false)) {
+ con_error << "Essential file bitmaps/fonts/gui missing" << std::endl;
core::application()->shutdown();
}
@@ -59,7 +65,7 @@ void Textures::clear()
index = 0;
}
-size_t Textures::load(std::string name)
+size_t Textures::load(std::string name, bool filter)
{
// check if it is already loaded
iterator it = registry.find(name);
@@ -97,8 +103,7 @@ size_t Textures::load(std::string name)
gluBuild2DMipmaps(GL_TEXTURE_2D, image->channels(),
image->width(), image->height(), texture_type, GL_UNSIGNED_BYTE, image->data());
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
+ set_filter(filter);
// add to the registry
registry[name] = id;
@@ -119,7 +124,7 @@ size_t Textures::find(std::string name)
return id;
}
-size_t Textures::bind(std::string name)
+size_t Textures::bind(std::string name, bool filter)
{
size_t id = 0;
iterator it = registry.find(name);
@@ -129,17 +134,29 @@ size_t Textures::bind(std::string name)
id = load(name);
glBindTexture(GL_TEXTURE_2D, textures[id]);
+ set_filter(filter);
return id;
}
-size_t Textures::bind(size_t texture)
+size_t Textures::bind(size_t texture, bool filter)
{
size_t id = texture;
if (texture >= index)
id = 0;
glBindTexture(GL_TEXTURE_2D, textures[id]);
+ set_filter(filter);
return id;
}
+void Textures::set_filter(bool filter)
+{
+ if (filter) {
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
+ } else {
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
+ }
+ }
}