#include <sstream>
#include <stdexcept>
#include "physfs/physfs_sdl.hpp"
+#include "video_systems.hpp"
#include "gl_texture.hpp"
-#include "sdl_texture.hpp"
#include "glutil.hpp"
#include "gameconfig.hpp"
#include "file_system.hpp"
#include "log.hpp"
+#include "texture.hpp"
TextureManager* texture_manager = NULL;
Texture* result = 0;
try {
-#ifdef HAVE_OPENGL
- if(config->video == "opengl")
- {
- result = new GL::Texture(image);
- }
- else
-#endif
- {
- result = new SDL::Texture(image);
- }
+ result = new_texture(image);
result->set_filename(filename);
} catch(...) {
delete result;
void
TextureManager::save_textures()
{
+#ifdef GL_PACK_ROW_LENGTH
+ /* all this stuff is not support by OpenGL ES */
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0);
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
glPixelStorei(GL_PACK_SKIP_IMAGES, 0);
+#endif
+
glPixelStorei(GL_PACK_ALIGNMENT, 1);
for(Textures::iterator i = textures.begin(); i != textures.end(); ++i) {
save_texture(*i);
void
TextureManager::reload_textures()
{
+#ifdef GL_UNPACK_ROW_LENGTH
+ /* OpenGL ES doesn't support these */
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei(GL_UNPACK_SKIP_IMAGES, 0);
+#endif
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
for(std::vector<SavedTexture>::iterator i = saved_textures.begin();