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

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.53 by root, Wed May 17 16:17:01 2006 UTC vs.
Revision 1.59 by elmex, Tue May 23 17:30:18 2006 UTC

36sub gl_init { 36sub 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
51sub gl_check { 53sub 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
59sub find_rcfile($) { 61sub 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
113sub db_table($) { 115sub db_table($) {
114 my ($table) = @_; 116 my ($table) = @_;
115 117
355 glGetError; 357 glGetError;
356 358
357 if (defined $data) { 359 if (defined $data) {
358 glTexImage2D GL_TEXTURE_2D, 0, 360 glTexImage2D GL_TEXTURE_2D, 0,
359 $self->{internalformat}, 361 $self->{internalformat},
360 $tw, $th, # need to pad texture first 362 $tw, $th,
361 0, 363 0,
362 $self->{format}, 364 $self->{format},
363 $self->{type}, 365 $self->{type},
364 $data; 366 $data;
365 CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x", 367 CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x",
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
378sub DESTROY { 382sub DESTROY {
379 my ($self) = @_; 383 my ($self) = @_;
380 384
382 386
383 glDeleteTexture delete $self->{name} 387 glDeleteTexture delete $self->{name}
384 if $self->{name}; 388 if $self->{name};
385} 389}
386 390
387sub restore_state{ 391sub restore_state {
388 $_->upload 392 $_->upload
389 for values %TEXTURES; 393 for values %TEXTURES;
390}; 394}
391 395
3921; 3961;
393 397
394=back 398=back
395 399

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines