ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Texture.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Texture.pm (file contents):
Revision 1.31 by root, Wed Dec 26 21:03:21 2007 UTC vs.
Revision 1.34 by root, Thu Apr 17 03:46:39 2008 UTC

1=head1 NAME 1=head1 NAME
2 2
3DC::Texture - tetxure class for CFPlus 3DC::Texture - tetxure class for Deliantra-Client
4 4
5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use DC::Texture; 7 use DC::Texture;
8 8
131 ($dw, $dh) = @$self{qw(w h)}; 131 ($dw, $dh) = @$self{qw(w h)};
132 132
133 } elsif (defined $self->{image}) { 133 } elsif (defined $self->{image}) {
134 ($self->{w}, $self->{h}, $data, my $internalformat, $self->{format}, $self->{type}) 134 ($self->{w}, $self->{h}, $data, my $internalformat, $self->{format}, $self->{type})
135 = DC::load_image_inline $self->{image}; 135 = DC::load_image_inline $self->{image};
136 136
137 $self->{internalformat} ||= $internalformat; 137 $self->{internalformat} ||= $internalformat;
138 ($dw, $dh) = @$self{qw(w h)}; 138 ($dw, $dh) = @$self{qw(w h)};
139 139
140 delete $self->{image} if delete $self->{delete_image}; 140 delete $self->{image} if delete $self->{delete_image};
141 141
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) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines