… | |
… | |
355 | glGetError; |
355 | glGetError; |
356 | |
356 | |
357 | if (defined $data) { |
357 | if (defined $data) { |
358 | glTexImage2D GL_TEXTURE_2D, 0, |
358 | glTexImage2D GL_TEXTURE_2D, 0, |
359 | $self->{internalformat}, |
359 | $self->{internalformat}, |
360 | $tw, $th, # need to pad texture first |
360 | $tw, $th, |
361 | 0, |
361 | 0, |
362 | $self->{format}, |
362 | $self->{format}, |
363 | $self->{type}, |
363 | $self->{type}, |
364 | $data; |
364 | $data; |
365 | CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x", |
365 | CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x", |
… | |
… | |
382 | |
382 | |
383 | glDeleteTexture delete $self->{name} |
383 | glDeleteTexture delete $self->{name} |
384 | if $self->{name}; |
384 | if $self->{name}; |
385 | } |
385 | } |
386 | |
386 | |
387 | sub restore_state{ |
387 | sub restore_state { |
388 | $_->upload |
388 | $_->upload |
389 | for values %TEXTURES; |
389 | for values %TEXTURES; |
390 | }; |
390 | } |
391 | |
391 | |
392 | 1; |
392 | 1; |
393 | |
393 | |
394 | =back |
394 | =back |
395 | |
395 | |