--- deliantra/Deliantra-Client/DC/Texture.pm 2006/06/17 15:07:53 1.8 +++ deliantra/Deliantra-Client/DC/Texture.pm 2006/06/17 15:48:59 1.9 @@ -163,6 +163,7 @@ gl_check "uploading texture %dx%d if=%x f=%x t=%x", $tw, $th, $self->{internalformat}, $self->{format}, $self->{type}; } else { + exists $self->{render_cb} or die; glCopyTexImage2D GL_TEXTURE_2D, 0, $self->{internalformat}, 0, 0, @@ -176,7 +177,7 @@ sub shutdown { my ($self) = @_; - glDeleteTexture delete $self->{name} + glDeleteTexture $self->{name} if $self->{name}; } @@ -189,6 +190,9 @@ } $CFClient::OpenGL::INIT_HOOK{"CFClient::Texture"} = sub { + # first mark all existing texture names as in-use, in case the context lost textures + glBindTexture GL_TEXTURE_2D, $_->{name} + for values %TEXTURES; $_->upload for values %TEXTURES; };