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.52 by root, Wed May 17 15:18:57 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
153sub view_item { 155sub view_item {
154 ("\t" x ($indent / 4)) 156 ("\t" x ($indent / 4))
155 . $_[1]->title->present ($_[0]) 157 . $_[1]->title->present ($_[0])
156 . "\n" 158 . "\n"
157 . $_[1]->content->present ($_[0]) 159 . $_[1]->content->present ($_[0])
160}
161
162sub view_verbatim {
163 (join "",
164 map +("\t" x ($indent / 2)) . "$_\n",
165 split /\n/, CFClient::UI::Label::escape ($_[1]))
166 . "\n"
158} 167}
159 168
160sub view_textblock { 169sub view_textblock {
161 ("\t" x ($indent / 2)) . "$_[1]\n\n" 170 ("\t" x ($indent / 2)) . "$_[1]\n\n"
162} 171}
348 glGetError; 357 glGetError;
349 358
350 if (defined $data) { 359 if (defined $data) {
351 glTexImage2D GL_TEXTURE_2D, 0, 360 glTexImage2D GL_TEXTURE_2D, 0,
352 $self->{internalformat}, 361 $self->{internalformat},
353 $tw, $th, # need to pad texture first 362 $tw, $th,
354 0, 363 0,
355 $self->{format}, 364 $self->{format},
356 $self->{type}, 365 $self->{type},
357 $data; 366 $data;
358 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",
364 $tw, $th, 373 $tw, $th,
365 0; 374 0;
366 CFClient::gl_check "copying to texture %dx%d if=%x", 375 CFClient::gl_check "copying to texture %dx%d if=%x",
367 $tw, $th, $self->{internalformat}; 376 $tw, $th, $self->{internalformat};
368 } 377 }
378
379 glBindTexture GL_TEXTURE_2D, 0; # just to be on the safe side
369} 380}
370 381
371sub DESTROY { 382sub DESTROY {
372 my ($self) = @_; 383 my ($self) = @_;
373 384
375 386
376 glDeleteTexture delete $self->{name} 387 glDeleteTexture delete $self->{name}
377 if $self->{name}; 388 if $self->{name};
378} 389}
379 390
380sub restore_state{ 391sub restore_state {
381 $_->upload 392 $_->upload
382 for values %TEXTURES; 393 for values %TEXTURES;
383}; 394}
384 395
3851; 3961;
386 397
387=back 398=back
388 399

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines