This allows greateer flexibility with setting a resource manager.
unsigned width = static_cast<const Texture1D *>(this)->width;
unsigned levels = static_cast<const Texture1D *>(this)->levels;
+ if(!id)
+ generate_id();
+
GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
if(ARB_texture_storage)
{
unsigned height = static_cast<const Texture2D *>(this)->height;
unsigned levels = static_cast<const Texture2D *>(this)->levels;
+ if(!id)
+ generate_id();
+
GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
if(ARB_texture_storage)
{
unsigned height = static_cast<const Texture2DMultisample *>(this)->height;
unsigned samples = static_cast<const Texture2DMultisample *>(this)->samples;
+ if(!id)
+ generate_id();
+
GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
if(ARB_texture_storage_multisample)
{
unsigned depth = static_cast<const Texture3D *>(this)->depth;
unsigned levels = static_cast<const Texture3D *>(this)->levels;
+ if(!id)
+ generate_id();
+
GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
if(ARB_texture_storage)
{
OpenGLTexture *OpenGLTexture::scratch_binding = 0;
-OpenGLTexture::OpenGLTexture(unsigned t, bool create):
+OpenGLTexture::OpenGLTexture(unsigned t):
id(0),
target(t)
{
- if(create)
- generate_id();
-
static bool alignment_init = false;
if(!alignment_init)
{
static int swizzle_orders[];
static OpenGLTexture *scratch_binding;
- OpenGLTexture(unsigned, bool);
+ OpenGLTexture(unsigned);
~OpenGLTexture();
void generate_id();
unsigned size = static_cast<const TextureCube *>(this)->size;
unsigned levels = static_cast<const TextureCube *>(this)->levels;
+ if(!id)
+ generate_id();
+
GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
if(ARB_texture_storage)
{
namespace GL {
Texture::Texture(unsigned t, ResourceManager *m):
- TextureBackend(t, !m),
+ TextureBackend(t),
format(NO_PIXELFORMAT),
storage_fmt(format),
swizzle(NO_SWIZZLE),
void Texture::Loader::image_data(const string &data)
{
if(obj.manager)
- {
obj.set_manager(0);
- if(!obj.id)
- obj.generate_id();
- }
Graphics::Image img;
IO::Memory mem(data.data(), data.size());
void Texture2D::Loader::raw_data(const string &data)
{
if(obj.manager)
- {
obj.set_manager(0);
- if(!obj.id)
- obj.generate_id();
- }
obj.image(0, data.data());
}