Disable acceleration in kill_fall().
[supertux.git] / src / video / texture_manager.cpp
index 7b556a6..4bdece7 100644 (file)
 #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;
 
@@ -103,16 +104,7 @@ TextureManager::create_image_texture(const std::string& filename)
 
   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;
@@ -128,11 +120,15 @@ TextureManager::create_image_texture(const std::string& filename)
 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);
@@ -181,11 +177,14 @@ TextureManager::save_texture(GL::Texture* texture)
 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();