--- deliantra/Deliantra-Client/DC/Texture.pm 2007/12/26 21:03:21 1.31 +++ deliantra/Deliantra-Client/DC/Texture.pm 2008/04/17 03:46:39 1.34 @@ -1,6 +1,6 @@ =head1 NAME -DC::Texture - tetxure class for CFPlus +DC::Texture - tetxure class for Deliantra-Client =head1 SYNOPSIS @@ -133,7 +133,7 @@ } elsif (defined $self->{image}) { ($self->{w}, $self->{h}, $data, my $internalformat, $self->{format}, $self->{type}) = DC::load_image_inline $self->{image}; - + $self->{internalformat} ||= $internalformat; ($dw, $dh) = @$self{qw(w h)}; @@ -326,8 +326,16 @@ } $DC::OpenGL::INIT_HOOK{"DC::Texture"} = sub { - for (values %TEXTURES) { - $_->upload if $_->{want_upload}; + for my $tex (values %TEXTURES) { + if (my $name = $tex->{want_upload}) { + $tex->upload; + + if ($tex->{loading} && $name > 0) { + # if loading is delayed we still have to allocate the texture name + glBindTexture GL_TEXTURE_2D, $name; + glTexImage2D GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE; + } + } } };