diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/paint.cc | 20 |
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(); } |