Texture::Texture(GLenum t, ResourceManager *m):
id(0),
target(t),
+ ifmt(RGB),
min_filter(NEAREST_MIPMAP_LINEAR),
mag_filter(LINEAR),
wrap_s(REPEAT),
return (get_base_pixelformat(fmt)==DEPTH_COMPONENT ? UNSIGNED_SHORT : UNSIGNED_BYTE);
}
+void Texture::set_internal_format(PixelFormat fmt)
+{
+ if(MSP_sized_internal_formats)
+ fmt = get_sized_pixelformat(fmt);
+
+ require_pixelformat(fmt);
+ ifmt = fmt;
+}
+
void Texture::update_parameter(int mask) const
{
if(!ARB_direct_state_access && TexUnit::current().get_texture()!=this)
unsigned id;
GLenum target;
+ PixelFormat ifmt;
TextureFilter min_filter;
TextureFilter mag_filter;
float max_anisotropy;
protected:
static DataType get_alloc_type(PixelFormat);
+ void set_internal_format(PixelFormat);
void update_parameter(int) const;
void set_parameter_i(GLenum, int) const;
Texture1D::Texture1D():
Texture(GL_TEXTURE_1D),
- ifmt(RGB),
width(0),
allocated(0)
{
if(wd==0)
throw invalid_argument("Texture1D::storage");
- if(MSP_sized_internal_formats)
- fmt = get_sized_pixelformat(fmt);
- require_pixelformat(fmt);
-
- ifmt = fmt;
+ set_internal_format(fmt);
width = wd;
}
};
private:
- PixelFormat ifmt;
unsigned width;
unsigned allocated;
Texture2D::Texture2D(ResourceManager *m):
Texture(GL_TEXTURE_2D, m),
- ifmt(RGB),
width(0),
height(0),
allocated(0)
if(wd==0 || ht==0)
throw invalid_argument("Texture2D::storage");
- if(MSP_sized_internal_formats)
- fmt = get_sized_pixelformat(fmt);
- require_pixelformat(fmt);
-
- ifmt = fmt;
+ set_internal_format(fmt);
width = wd;
height = ht;
}
private:
class AsyncLoader;
- PixelFormat ifmt;
unsigned width;
unsigned height;
unsigned allocated;
Texture3D::Texture3D(GLenum t):
Texture(t),
- ifmt(RGB),
width(0),
height(0),
depth(0),
Texture3D::Texture3D():
Texture(GL_TEXTURE_3D),
- ifmt(RGB),
width(0),
height(0),
depth(0),
if(wd==0 || ht==0 || dp==0)
throw invalid_argument("Texture3D::storage");
- if(MSP_sized_internal_formats)
- fmt = get_sized_pixelformat(fmt);
- require_pixelformat(fmt);
-
- ifmt = fmt;
+ set_internal_format(fmt);
width = wd;
height = ht;
depth = dp;
};
private:
- PixelFormat ifmt;
unsigned width;
unsigned height;
unsigned depth;
TextureCube::TextureCube():
Texture(GL_TEXTURE_CUBE_MAP),
- ifmt(RGB),
size(0),
allocated(0)
{
if(sz==0)
throw invalid_argument("TextureCube::storage");
- if(MSP_sized_internal_formats)
- fmt = get_sized_pixelformat(fmt);
- require_pixelformat(fmt);
-
- ifmt = fmt;
+ set_internal_format(fmt);
size = sz;
}
};
private:
- PixelFormat ifmt;
unsigned size;
unsigned allocated;