Texture2D &texture;
IO::Seekable &io;
Buffer pixel_buffer;
- char *mapped_address;
+ char *mapped_address = 0;
Graphics::Image image;
- Graphics::ImageLoader *img_loader;
- unsigned n_bytes;
- int phase;
+ Graphics::ImageLoader *img_loader = 0;
+ unsigned n_bytes = 0;
+ int phase = 0;
public:
AsyncLoader(Texture2D &, IO::Seekable &);
};
-OpenGLTexture2D::OpenGLTexture2D(ResourceManager *m):
- Texture(GL_TEXTURE_2D, m)
+OpenGLTexture2D::OpenGLTexture2D():
+ Texture(GL_TEXTURE_2D)
{ }
void OpenGLTexture2D::allocate()
unsigned height = static_cast<const Texture2D *>(this)->height;
unsigned levels = static_cast<const Texture2D *>(this)->levels;
+ if(!id)
+ create();
+
GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
if(ARB_texture_storage)
{
OpenGLTexture2D::AsyncLoader::AsyncLoader(Texture2D &t, IO::Seekable &i):
texture(t),
io(i),
- mapped_address(0),
- img_loader(Graphics::ImageLoader::open_io(io)),
- phase(0)
+ img_loader(Graphics::ImageLoader::open_io(io))
{ }
OpenGLTexture2D::AsyncLoader::~AsyncLoader()
}
if(!texture.id)
- texture.generate_id();
+ texture.create();
unsigned w = image.get_width();
unsigned h = image.get_height();