… | |
… | |
36 | sub gl_init { |
36 | sub gl_init { |
37 | $GL_VERSION = gl_version * 1; |
37 | $GL_VERSION = gl_version * 1; |
38 | %GL_EXT = map +($_ => 1), split /\s+/, gl_extensions; |
38 | %GL_EXT = map +($_ => 1), split /\s+/, gl_extensions; |
39 | |
39 | |
40 | $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2; |
40 | $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2; |
|
|
41 | $GL_NPOT = 0 if gl_vendor =~ /ATI Technologies/; # ATI doesn't get it right... |
41 | |
42 | |
42 | glDisable GL_COLOR_MATERIAL; |
43 | glDisable GL_COLOR_MATERIAL; |
43 | glShadeModel GL_FLAT; |
44 | glShadeModel GL_FLAT; |
44 | glDisable GL_DITHER; |
45 | glDisable GL_DITHER; |
45 | glDisable GL_DEPTH_TEST; |
46 | glDisable GL_DEPTH_TEST; |
|
|
47 | glDepthMask 0; |
46 | glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST; |
48 | glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST; |
47 | |
49 | |
48 | CFClient::Texture::restore_state (); |
50 | CFClient::Texture::restore_state (); |
49 | } |
51 | } |
50 | |
52 | |
51 | sub gl_check { |
53 | sub gl_check { |
52 | return unless $GL_DEBUG; |
54 | return unless $GL_DEBUG; |
53 | |
55 | |
54 | if (my $error = glGetError) { |
56 | if (my $error = glGetError) { |
55 | Carp::cluck sprintf "opengl error %x while %s", $error, sprintf @_; |
57 | Carp::cluck sprintf "opengl error %x while %s", $error, &sprintf(@_); |
56 | } |
58 | } |
57 | } |
59 | } |
58 | |
60 | |
59 | sub find_rcfile($) { |
61 | sub find_rcfile($) { |
60 | my $path; |
62 | my $path; |
… | |
… | |
105 | -Home => "$Crossfire::VARDIR/pclient", |
107 | -Home => "$Crossfire::VARDIR/pclient", |
106 | -Cachesize => 1_000_000, |
108 | -Cachesize => 1_000_000, |
107 | -ErrFile => "$Crossfire::VARDIR/pclient/errorlog.txt", |
109 | -ErrFile => "$Crossfire::VARDIR/pclient/errorlog.txt", |
108 | # -ErrPrefix => "DATABASE", |
110 | # -ErrPrefix => "DATABASE", |
109 | -Verbose => 1, |
111 | -Verbose => 1, |
110 | -Flags => DB_CREATE | DB_RECOVER_FATAL | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN, |
112 | -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"; |
113 | or die "unable to create/open database home $Crossfire::VARDIR/pclient: $BerkeleyDB::Error"; |
112 | |
114 | |
113 | sub db_table($) { |
115 | sub db_table($) { |
114 | my ($table) = @_; |
116 | my ($table) = @_; |
115 | |
117 | |
… | |
… | |
371 | $tw, $th, |
373 | $tw, $th, |
372 | 0; |
374 | 0; |
373 | CFClient::gl_check "copying to texture %dx%d if=%x", |
375 | CFClient::gl_check "copying to texture %dx%d if=%x", |
374 | $tw, $th, $self->{internalformat}; |
376 | $tw, $th, $self->{internalformat}; |
375 | } |
377 | } |
|
|
378 | |
|
|
379 | glBindTexture GL_TEXTURE_2D, 0; # just to be on the safe side |
376 | } |
380 | } |
377 | |
381 | |
378 | sub DESTROY { |
382 | sub DESTROY { |
379 | my ($self) = @_; |
383 | my ($self) = @_; |
380 | |
384 | |