void BC_Texture::write_tex(const char *fn)
{
+#ifdef HAVE_GL
int prev_id = -1;
glGetIntegerv(GL_ACTIVE_TEXTURE, &prev_id);
glActiveTexture(this->texture_id);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, img);
write_ppm(img, w, h, "%s", fn);
glActiveTexture(prev_id);
+#endif
}