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.28 by root, Tue Aug 28 01:23:47 2007 UTC vs.
Revision 1.29 by root, Tue Dec 25 18:58:32 2007 UTC

110 if $cb; 110 if $cb;
111 111
112 return if $self->{loading}; 112 return if $self->{loading};
113 113
114 unless ($GL_VERSION) { 114 unless ($GL_VERSION) {
115 $self->{was_loaded} = 1; 115 $self->{want_upload} = -1;
116 return; 116 return;
117 } 117 }
118 118
119 unless ($self->{name}) { 119 unless ($self->{name}) {
120 # $tw,$th texture 120 # $tw,$th texture
232 $data; 232 $data;
233 glPixelZoom 1, 1; 233 glPixelZoom 1, 1;
234 } 234 }
235 } 235 }
236 236
237 if ((my $name = delete $self->{want_upload}) > 0) {
238 $self->{name} = $name;
239 }
240
237 glBindTexture GL_TEXTURE_2D, $self->{name} ||= glGenTexture; 241 glBindTexture GL_TEXTURE_2D, $self->{name} ||= glGenTexture;
238 242
239 if ($self->{wrap}) { 243 if ($self->{wrap}) {
240 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT; 244 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT;
241 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT; 245 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT;
321 $self->unload; 325 $self->unload;
322} 326}
323 327
324$CFPlus::OpenGL::INIT_HOOK{"CFPlus::Texture"} = sub { 328$CFPlus::OpenGL::INIT_HOOK{"CFPlus::Texture"} = sub {
325 for (values %TEXTURES) { 329 for (values %TEXTURES) {
326 next unless delete $_->{was_loaded}; 330 $_->upload if $_->{want_upload};
327 $_->upload;
328 } 331 }
329}; 332};
330 333
331$CFPlus::OpenGL::SHUTDOWN_HOOK{"CFPlus::Texture"} = sub { 334$CFPlus::OpenGL::SHUTDOWN_HOOK{"CFPlus::Texture"} = sub {
332 for (values %TEXTURES) { 335 for (values %TEXTURES) {
333 next unless $_->{name}; 336 next unless $_->{name};
334 $_->{was_loaded} = 1; 337 $_->{want_upload} = $_->{name};
335 $_->unload; 338 $_->unload;
336 } 339 }
337}; 340};
338 341
3391; 3421;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines