diff --git a/modules/gfx/pymod/wrap_gfx.cc b/modules/gfx/pymod/wrap_gfx.cc
index 1c8ca00655a03830eaed53a3e6c9f1a407395956..cd308a6a7b7d3e26f51a6636308a0271d3d9be14 100644
--- a/modules/gfx/pymod/wrap_gfx.cc
+++ b/modules/gfx/pymod/wrap_gfx.cc
@@ -19,13 +19,14 @@
 #include <boost/python.hpp>
 using namespace boost::python;
 
+#include <ost/gfx/module_config.hh>
+#if OST_SHADER_SUPPORT_ENABLED
+#include <ost/gfx/shader.hh>
+#endif
 #include <ost/info/info.hh>
 #include <ost/gfx/prim_list.hh>
 #include <ost/gfx/gradient.hh>
 #include <ost/gfx/gfx_test_object.hh>
-#if OST_SHADER_SUPPORT_ENABLED
-#include <ost/gfx/shader.hh>
-#endif
 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
 
 extern void export_Scene();
diff --git a/modules/gfx/src/CMakeLists.txt b/modules/gfx/src/CMakeLists.txt
index 26fb2b7b8cf1d3a339ed770e79d7bd56d6993c92..ee2a67f4ee4b5f1c60de7c17630e040d3f531b94 100644
--- a/modules/gfx/src/CMakeLists.txt
+++ b/modules/gfx/src/CMakeLists.txt
@@ -22,6 +22,7 @@ prim_list.hh
 scene.hh
 selection.hh
 surface.hh
+texture.hh
 vertex_array.hh
 vertex_array_helper.hh
 scene_observer.hh
@@ -90,9 +91,7 @@ bitmap_io.cc
 color.cc
 primitives.cc
 entity.cc
-
 symmetry_node.cc
-
 gfx_node.cc
 gfx_object.cc
 gfx_prim.cc
@@ -107,6 +106,7 @@ vertex_array.cc
 vertex_array_helper.cc
 material.cc
 povray.cc
+texture.cc
 color_ops/color_op.cc
 color_ops/by_element_color_op.cc
 color_ops/by_chain_color_op.cc
diff --git a/modules/gfx/src/bitmap_io.cc b/modules/gfx/src/bitmap_io.cc
index 7c8fdf71b2b10f9225f74d6db8e1f6c22372a00f..3f16451371417244d16e7fb8027e3c7544d1edb2 100644
--- a/modules/gfx/src/bitmap_io.cc
+++ b/modules/gfx/src/bitmap_io.cc
@@ -148,7 +148,7 @@ Bitmap import_png(const String& filename)
   channels=png_get_channels(png_ptr,info_ptr);
 
   if(channels<1 || channels>4) {
-    LOGN_ERROR("error importing bitmap: " << filename << " has " << channels << " channels, excpected 1-4");
+    LOGN_ERROR("error importing bitmap: " << filename << " has " << channels << " channels, expected 1-4");
     return bm;
   }
   
diff --git a/modules/gfx/src/gfx_test_object.cc b/modules/gfx/src/gfx_test_object.cc
index 7baead968e35bb9ffc7d1630e5eb0870f8c28803..83ae9b329d38db8f17d534c4b871e65e008f0e64 100644
--- a/modules/gfx/src/gfx_test_object.cc
+++ b/modules/gfx/src/gfx_test_object.cc
@@ -26,6 +26,7 @@
 #include <boost/filesystem/fstream.hpp>
 
 #include <ost/platform.hh>
+#include "texture.hh"
 #include "glext_include.hh"
 #include "gfx_test_object.hh"
 #include "scene.hh"
@@ -59,8 +60,8 @@ GfxTestObj::GfxTestObj():
   String ost_root=GetSharedDataPath();
   bf::path ost_root_dir(ost_root);
   bf::path tex_file(ost_root_dir / "textures/test_texture.png");
-  Bitmap bm = BitmapImport(tex_file.string(),".png");
-  if(!bm.data) {
+  Texture tex(BitmapImport(tex_file.string(),".png"));
+  if(!tex.IsValid()) {
     LOGN_ERROR("error loading " << tex_file.string());
   } else {
     LOGN_VERBOSE("importing tex with id " << tex_id);
@@ -70,11 +71,7 @@ GfxTestObj::GfxTestObj():
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    if(bm.channels==3) {
-      glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,bm.width,bm.height,0,GL_RGB,GL_UNSIGNED_BYTE,bm.data.get());
-    } else if(bm.channels==4) {
-      glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,bm.width,bm.height,0,GL_RGBA,GL_UNSIGNED_BYTE,bm.data.get());
-    }
+    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,tex.width(),tex.height(),tex.border(),tex.format(),tex.type(),tex.data());
   }
 }
 
diff --git a/modules/gfx/src/gfx_test_object.hh b/modules/gfx/src/gfx_test_object.hh
index b233f2812d397352cefe4d197d9375b97b6d2d19..95eeeb2cc6e32a292b58ce457a8027124c4379d5 100644
--- a/modules/gfx/src/gfx_test_object.hh
+++ b/modules/gfx/src/gfx_test_object.hh
@@ -26,7 +26,7 @@
 */
 
 #include "gfx_object.hh"
-#include "gl_include.hh"
+#include "glext_include.hh"
 
 namespace ost { namespace gfx {
 
diff --git a/modules/gfx/src/gl_helper.hh b/modules/gfx/src/gl_helper.hh
index 7dc1155da23abf28d16fdb8e50e279b94b3e102b..11f87c94de5dcc988e065352059836da2d578d71 100644
--- a/modules/gfx/src/gl_helper.hh
+++ b/modules/gfx/src/gl_helper.hh
@@ -36,7 +36,6 @@ Author: Juergen Haas
 #include <ost/geom/vec3.hh>
 
 #include "glext_include.hh"
-#include "gl_include.hh"
 
 #include <ost/log.hh>
 
diff --git a/modules/gfx/src/map_slab.hh b/modules/gfx/src/map_slab.hh
index 3af06bd5ae3d59713dd39ffdcc0ff3f214cb42ac..7cd85a1110a34a2f0e2c80248415b4c7ba8a115a 100644
--- a/modules/gfx/src/map_slab.hh
+++ b/modules/gfx/src/map_slab.hh
@@ -29,8 +29,8 @@
 #include <ost/geom/geom.hh>
 
 #include <ost/img/map.hh>
-#include <ost/gfx/gl_include.hh>
 
+#include "glext_include.hh"
 #include "gfx_object.hh"
 
 namespace ost { namespace gfx {
diff --git a/modules/gfx/src/scene.hh b/modules/gfx/src/scene.hh
index a58a8652c0395199ed486bf1f4e30fe6c9b59be3..8f1b3b9c2f90557ed1e5e871e6c937b32ca519ea 100644
--- a/modules/gfx/src/scene.hh
+++ b/modules/gfx/src/scene.hh
@@ -32,6 +32,7 @@
 #include <ost/gfx/module_config.hh>
 #include <ost/mol/transform.hh>
 
+#include "gl_include.hh"
 #include "color.hh"
 #include "gfx_object_fw.hh"
 #include "gfx_node_fw.hh"
@@ -40,7 +41,6 @@
 #include "glwin_base.hh"
 #include "scene_observer.hh"
 #include "gfx_prim.hh"
-#include "gl_include.hh"
 #include "povray_fw.hh"
 
 namespace ost { namespace gfx {
diff --git a/modules/gfx/src/shader.hh b/modules/gfx/src/shader.hh
index 8715e907cd9375966b3e465f674e7b31a46abab9..f61aeeb978ecc0efb9f6646acefd9d29ee836975 100644
--- a/modules/gfx/src/shader.hh
+++ b/modules/gfx/src/shader.hh
@@ -29,7 +29,7 @@
 #include <map>
 #include <stack>
 #include <ost/gfx/module_config.hh>
-#include "gl_include.hh"
+#include "glext_include.hh"
 
 namespace ost { namespace gfx {
 
diff --git a/modules/gfx/src/texture.cc b/modules/gfx/src/texture.cc
new file mode 100644
index 0000000000000000000000000000000000000000..56ea7555360c05de3d4b2d0e36c5c446275f62b4
--- /dev/null
+++ b/modules/gfx/src/texture.cc
@@ -0,0 +1,41 @@
+#include "texture.hh"
+
+namespace ost { namespace gfx {
+
+  Texture::Texture(const Bitmap& bm):
+    w_(bm.width), h_(bm.height),
+    d_()
+  {
+    if(!bm.data) return;
+    d_=boost::shared_array<Color>(new Color[w_*h_]);
+    static float f=1.0/255.0;
+    for(GLint v=0;v<h_;++v) {
+      for(GLint u=0;u<w_;++u) {
+        int p=v*w_+u;
+        Color& c = d_[p];
+        if(bm.channels==1) {
+          c[0]=f*static_cast<float>(bm.data[p]);
+          c[1]=c[0];
+          c[2]=c[0];
+          c[3]=1.0;
+        } else if(bm.channels==2) {
+          c[0]=f*static_cast<float>(bm.data[p*2+0]);
+          c[1]=c[0];
+          c[2]=c[0];
+          c[3]=f*static_cast<float>(bm.data[p*2+1]);
+        } else if(bm.channels==3) {
+          c[0]=f*static_cast<float>(bm.data[p*3+0]);
+          c[1]=f*static_cast<float>(bm.data[p*3+1]);
+          c[2]=f*static_cast<float>(bm.data[p*3+2]);
+          c[3]=1.0;
+        } else if(bm.channels==4) {
+          c[0]=f*static_cast<float>(bm.data[p*4+0]);
+          c[1]=f*static_cast<float>(bm.data[p*4+1]);
+          c[2]=f*static_cast<float>(bm.data[p*4+2]);
+          c[2]=f*static_cast<float>(bm.data[p*4+3]);
+        }
+      }
+    }
+  }
+
+}}
diff --git a/modules/gfx/src/texture.hh b/modules/gfx/src/texture.hh
new file mode 100644
index 0000000000000000000000000000000000000000..471bdfd7175c307770da9340ec9ca5c5dedf1062
--- /dev/null
+++ b/modules/gfx/src/texture.hh
@@ -0,0 +1,74 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2010 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+#ifndef OST_GFX_TEXTURE_HH
+#define OST_GFX_TEXTURE_HH
+
+/*
+  texture
+
+  Author: Ansgar Philippsen
+*/
+
+#include <boost/shared_array.hpp>
+
+#include "module_config.hh"
+#include "glext_include.hh"
+#include "color.hh"
+#include "bitmap_io.hh"
+
+namespace ost { namespace gfx {
+
+class Texture
+{
+public:
+  Texture():
+    w_(0),
+    h_(0),
+    d_()
+  {}
+
+  Texture(GLint w, GLint h):
+    w_(w),
+    h_(h),
+    d_(new Color[w*h])
+  {}
+
+  Texture(const Bitmap& b);
+
+  bool IsValid() const {return d_;}
+
+  Color& operator()(uint u, uint v) {return d_[v*w_+u];}
+  const Color& operator()(uint u, uint v) const {return d_[v*w_+u];}
+
+  float* data() {return d_[0];}
+  
+  GLint width() const {return w_;}
+  GLint height() const {return h_;}
+  GLint format() const {return GL_RGBA;}
+  GLint type() const {return GL_FLOAT;}
+  GLint border() const {return 0;}
+
+private:
+  GLint w_,h_;
+  boost::shared_array<Color> d_;
+};
+
+}} // ns
+
+#endif