… | |
… | |
324 | |
324 | |
325 | $self->unload; |
325 | $self->unload; |
326 | } |
326 | } |
327 | |
327 | |
328 | $DC::OpenGL::INIT_HOOK{"DC::Texture"} = sub { |
328 | $DC::OpenGL::INIT_HOOK{"DC::Texture"} = sub { |
329 | for (values %TEXTURES) { |
329 | for my $tex (values %TEXTURES) { |
330 | $_->upload if $_->{want_upload}; |
330 | if (my $name = $tex->{want_upload}) { |
|
|
331 | $tex->upload; |
|
|
332 | |
|
|
333 | if ($tex->{loading} && $name > 0) { |
|
|
334 | # if loading is delayed we still have to allocate the texture name |
|
|
335 | glBindTexture GL_TEXTURE_2D, $name; |
|
|
336 | glTexImage2D GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE; |
|
|
337 | } |
|
|
338 | } |
331 | } |
339 | } |
332 | }; |
340 | }; |
333 | |
341 | |
334 | $DC::OpenGL::SHUTDOWN_HOOK{"DC::Texture"} = sub { |
342 | $DC::OpenGL::SHUTDOWN_HOOK{"DC::Texture"} = sub { |
335 | for (values %TEXTURES) { |
343 | for (values %TEXTURES) { |