diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Makefile.am | 5 | ||||
-rw-r--r-- | src/render/draw.cc | 3 | ||||
-rw-r--r-- | src/render/render.cc | 33 |
3 files changed, 14 insertions, 27 deletions
diff --git a/src/render/Makefile.am b/src/render/Makefile.am index 75da9c7..5747681 100644 --- a/src/render/Makefile.am +++ b/src/render/Makefile.am @@ -3,5 +3,6 @@ METASOURCES = AUTO noinst_LTLIBRARIES = librender.la librender_la_LDFLAGS = -avoid-version -no-undefined @GL_LIBS@ librender_la_LIBADD = $(top_builddir)/src/math/libmath.la -librender_la_SOURCES = draw.cc gl.cc image.cc render.cc text.cc tga.cc -noinst_HEADERS = draw.h gl.h image.h render.h text.h tga.h +librender_la_SOURCES = draw.cc gl.cc image.cc render.cc text.cc textures.cc \ + tga.cc +noinst_HEADERS = draw.h gl.h image.h render.h text.h textures.h tga.h diff --git a/src/render/draw.cc b/src/render/draw.cc index 3fe64a5..18e587a 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -7,6 +7,7 @@ #include "core/core.h" #include "core/model.h" #include "render/render.h" +#include "render/textures.h" #include "render/draw.h" namespace render @@ -384,7 +385,7 @@ void draw_pass_model_fx() { void draw_pass_model_lights() { //glPointSize(10); - glBindTexture(GL_TEXTURE_2D, render::textures[3]); // bitmaps/fx/flare01.tga + Textures::bind("bitmaps/fx/flare00"); gl::enable(GL_TEXTURE_2D); gl::begin(gl::Quads); diff --git a/src/render/render.cc b/src/render/render.cc index 6755e08..589dce3 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -9,9 +9,11 @@ #include <sstream> #include <iomanip> -#include "render/render.h" -#include "render/tga.h" #include "render/gl.h" +#include "render/textures.h" +#include "render/tga.h" +#include "render/render.h" + #include "core/core.h" #include "filesystem/filesystem.h" #include "sys/sys.h" @@ -58,27 +60,7 @@ void init() con_print << " vendor " << gl::vendor() << std::endl; con_print << " version " << gl::version() << std::endl; - con_print << "Loading textures..." << std::endl; - - if (!texture( "bitmaps/loader.tga", 0)) { - con_error << "Essential file bitmaps/loader.tga missing" << std::endl; - core::application()->shutdown(); - } - - if (!texture("bitmaps/conchars.tga", 1)) { - con_error << "Essential file bitmaps/conchars.tga missing" << std::endl; - core::application()->shutdown(); - } - - if (!texture("bitmaps/crosshair.tga", 2)) { - con_error << "Essential file bitmaps/crosshair.tga missing" << std::endl; - core::application()->shutdown(); - } - - if (!texture("bitmaps/fx/flare01.tga", 3)) { - con_error << "Essential file bitmaps/fx/flare01.tga missing" << std::endl; - core::application()->shutdown(); - } + Textures::init(); // size of the vertex array in megabytes r_arraysize = core::Cvar::get("r_arraysize", 0.0f , core::Cvar::Archive); @@ -103,7 +85,7 @@ void shutdown() { con_print << "Shutting down renderer..." << std::endl; - glDeleteTextures(2, textures); + Textures::shutdown(); // clear entity models, this will force a reload for (std::map<unsigned int, core::Entity *>::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) { @@ -112,7 +94,10 @@ void shutdown() entity->entity_model = 0; } + // clear models core::Model::clear(); + + // clear vertex array delete vertexarray; vertexarray = 0; } |