#include <msp/gl/extensions/arb_shadow.h>
+#include <msp/gl/extensions/ext_framebuffer_object.h>
#include <msp/gl/extensions/ext_texture3d.h>
#include <msp/gl/extensions/ext_texture_filter_anisotropic.h>
#include <msp/gl/extensions/sgis_generate_mipmap.h>
glDeleteTextures(1, &id);
}
+DataType Texture::get_alloc_type(PixelFormat fmt)
+{
+ return (fmt==DEPTH_COMPONENT ? UNSIGNED_SHORT : UNSIGNED_BYTE);
+}
+
void Texture::update_parameter(int mask) const
{
if(TexUnit::current().get_texture()!=this)
if(gm)
static Require _req(SGIS_generate_mipmap);
gen_mipmap = gm;
- update_parameter(GENERATE_MIPMAP);
+ if(get_gl_api()!=OPENGL_ES2)
+ update_parameter(GENERATE_MIPMAP);
+}
+
+void Texture::auto_generate_mipmap()
+{
+ if(get_gl_api()==OPENGL_ES2)
+ {
+ // glGenerateMipmap is defined here
+ static Require _req(EXT_framebuffer_object);
+ glGenerateMipmap(target);
+ }
}
void Texture::set_compare_enabled(bool c)
{
- static Require _req(ARB_shadow);
+ if(c)
+ static Require _req(ARB_shadow);
compare = c;
update_parameter(COMPARE);
}