… | |
… | |
41 | |
41 | |
42 | glDisable GL_COLOR_MATERIAL; |
42 | glDisable GL_COLOR_MATERIAL; |
43 | glShadeModel GL_FLAT; |
43 | glShadeModel GL_FLAT; |
44 | glDisable GL_DITHER; |
44 | glDisable GL_DITHER; |
45 | glDisable GL_DEPTH_TEST; |
45 | glDisable GL_DEPTH_TEST; |
|
|
46 | glDepthMask 0; |
46 | glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST; |
47 | glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST; |
47 | |
48 | |
48 | CFClient::Texture::restore_state (); |
49 | CFClient::Texture::restore_state (); |
49 | } |
50 | } |
50 | |
51 | |
51 | sub gl_check { |
52 | sub gl_check { |
52 | return unless $GL_DEBUG; |
53 | return unless $GL_DEBUG; |
53 | |
54 | |
54 | if (my $error = glGetError) { |
55 | if (my $error = glGetError) { |
55 | Carp::cluck sprintf "opengl error %x while %s", $error, sprintf @_; |
56 | Carp::cluck sprintf "opengl error %x while %s", $error, &sprintf(@_); |
56 | } |
57 | } |
57 | } |
58 | } |
58 | |
59 | |
59 | sub find_rcfile($) { |
60 | sub find_rcfile($) { |
60 | my $path; |
61 | my $path; |
… | |
… | |
105 | -Home => "$Crossfire::VARDIR/pclient", |
106 | -Home => "$Crossfire::VARDIR/pclient", |
106 | -Cachesize => 1_000_000, |
107 | -Cachesize => 1_000_000, |
107 | -ErrFile => "$Crossfire::VARDIR/pclient/errorlog.txt", |
108 | -ErrFile => "$Crossfire::VARDIR/pclient/errorlog.txt", |
108 | # -ErrPrefix => "DATABASE", |
109 | # -ErrPrefix => "DATABASE", |
109 | -Verbose => 1, |
110 | -Verbose => 1, |
110 | -Flags => DB_CREATE | DB_RECOVER_FATAL | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN, |
111 | -Flags => DB_CREATE | DB_RECOVER | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN, |
111 | or die "unable to create/open database home $Crossfire::VARDIR/pclient: $BerkeleyDB::Error"; |
112 | or die "unable to create/open database home $Crossfire::VARDIR/pclient: $BerkeleyDB::Error"; |
112 | |
113 | |
113 | sub db_table($) { |
114 | sub db_table($) { |
114 | my ($table) = @_; |
115 | my ($table) = @_; |
115 | |
116 | |
… | |
… | |
355 | glGetError; |
356 | glGetError; |
356 | |
357 | |
357 | if (defined $data) { |
358 | if (defined $data) { |
358 | glTexImage2D GL_TEXTURE_2D, 0, |
359 | glTexImage2D GL_TEXTURE_2D, 0, |
359 | $self->{internalformat}, |
360 | $self->{internalformat}, |
360 | $tw, $th, # need to pad texture first |
361 | $tw, $th, |
361 | 0, |
362 | 0, |
362 | $self->{format}, |
363 | $self->{format}, |
363 | $self->{type}, |
364 | $self->{type}, |
364 | $data; |
365 | $data; |
365 | CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x", |
366 | CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x", |
… | |
… | |
371 | $tw, $th, |
372 | $tw, $th, |
372 | 0; |
373 | 0; |
373 | CFClient::gl_check "copying to texture %dx%d if=%x", |
374 | CFClient::gl_check "copying to texture %dx%d if=%x", |
374 | $tw, $th, $self->{internalformat}; |
375 | $tw, $th, $self->{internalformat}; |
375 | } |
376 | } |
|
|
377 | |
|
|
378 | glBindTexture GL_TEXTURE_2D, 0; # just to be on the safe side |
376 | } |
379 | } |
377 | |
380 | |
378 | sub DESTROY { |
381 | sub DESTROY { |
379 | my ($self) = @_; |
382 | my ($self) = @_; |
380 | |
383 | |
… | |
… | |
382 | |
385 | |
383 | glDeleteTexture delete $self->{name} |
386 | glDeleteTexture delete $self->{name} |
384 | if $self->{name}; |
387 | if $self->{name}; |
385 | } |
388 | } |
386 | |
389 | |
387 | sub restore_state{ |
390 | sub restore_state { |
388 | $_->upload |
391 | $_->upload |
389 | for values %TEXTURES; |
392 | for values %TEXTURES; |
390 | }; |
393 | } |
391 | |
394 | |
392 | 1; |
395 | 1; |
393 | |
396 | |
394 | =back |
397 | =back |
395 | |
398 | |