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>2011-07-29 23:38:44 +0000
committerStijn Buys <ingar@osirion.org>2011-07-29 23:38:44 +0000
commit3a28abfa64d02b8d530689c425f6ed476a14fe9c (patch)
tree026fa2d299f0c2a381aa82de1e6e2dcfdaea329a
parent044d0183e254d89dd12d0799be6aa8f8f0f979f2 (diff)
Render ui bitmaps through the materials system.
-rw-r--r--src/ui/paint.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/ui/paint.cc b/src/ui/paint.cc
index 6531b0e..1745e1f 100644
--- a/src/ui/paint.cc
+++ b/src/ui/paint.cc
@@ -7,6 +7,7 @@
#include "auxiliary/functions.h"
#include "math/vector2f.h"
#include "render/gl.h"
+#include "render/state.h"
#include "render/text.h"
#include "render/textures.h"
#include "ui/paint.h"
@@ -60,9 +61,20 @@ void Paint::draw_rectangle(const math::Vector2f &global_location, const math::Ve
// draw a bitmap
void Paint::draw_bitmap(const math::Vector2f &global_location, const math::Vector2f &size, const std::string &texture)
{
- render::Textures::bind(texture);
- gl::enable(GL_TEXTURE_2D);
-
+ // find the material
+ model::Material *material = model::Material::find(texture);
+ if (!material) {
+ material = new model::Material(texture);
+ model::Material::add(material);
+ material->set_texture(material->name());
+ // ui btimaps are fullbright
+ material->set_flags(model::Material::Bright);
+ }
+
+ render::State::set_color(math::Color());
+ render::State::set_color_second(math::Color());
+ render::State::use_material(material);
+
gl::begin(gl::Quads);
glTexCoord2f(0.0f, 0.0f);
@@ -79,7 +91,7 @@ void Paint::draw_bitmap(const math::Vector2f &global_location, const math::Vecto
gl::end();
- gl::disable(GL_TEXTURE_2D);
+ render::State::reset();
}