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.61 by root, Wed May 24 21:49:58 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) {
57 my ($format, @args) = @_;
55 Carp::cluck sprintf "opengl error %x while %s", $error, sprintf @_; 58 Carp::cluck sprintf "opengl error %x while $format", $error, @args;
56 } 59 }
57} 60}
58 61
59sub find_rcfile($) { 62sub find_rcfile($) {
60 my $path; 63 my $path;
105 -Home => "$Crossfire::VARDIR/pclient", 108 -Home => "$Crossfire::VARDIR/pclient",
106 -Cachesize => 1_000_000, 109 -Cachesize => 1_000_000,
107 -ErrFile => "$Crossfire::VARDIR/pclient/errorlog.txt", 110 -ErrFile => "$Crossfire::VARDIR/pclient/errorlog.txt",
108# -ErrPrefix => "DATABASE", 111# -ErrPrefix => "DATABASE",
109 -Verbose => 1, 112 -Verbose => 1,
110 -Flags => DB_CREATE | DB_RECOVER_FATAL | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN, 113 -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"; 114 or die "unable to create/open database home $Crossfire::VARDIR/pclient: $BerkeleyDB::Error";
112 115
113sub db_table($) { 116sub db_table($) {
114 my ($table) = @_; 117 my ($table) = @_;
115 118
129 my ($pom) = @_; 132 my ($pom) = @_;
130 133
131 $pom->present ("CFClient::PodToPango") 134 $pom->present ("CFClient::PodToPango")
132} 135}
133 136
137sub pod_to_pango_list($) {
138 my ($pom) = @_;
139
140 [
141 map s/^(\s*)// && [40 * length $1, length $_ ? $_ : " "],
142 split /\n/, $pom->present ("CFClient::PodToPango")
143 ]
144}
145
134package CFClient::PodToPango; 146package CFClient::PodToPango;
135 147
136use base Pod::POM::View::Text; 148use base Pod::POM::View::Text;
137 149
138our $indent = 0; 150our $indent = 0;
166 178
167sub view_textblock { 179sub view_textblock {
168 ("\t" x ($indent / 2)) . "$_[1]\n\n" 180 ("\t" x ($indent / 2)) . "$_[1]\n\n"
169} 181}
170 182
183sub view_head1 {
184 "<span foreground='#ffff00' size='x-large'>" . $_[1]->title->present ($_[0]) . "</span>\n\n"
185 . $_[1]->content->present ($_[0])
186};
187
171sub view_head2 { 188sub view_head2 {
172 "<big>" . $_[1]->title->present ($_[0]) . "</big>\n\n" 189 "<span foreground='#ccccff' size='large'>" . $_[1]->title->present ($_[0]) . "</span>\n\n"
173 . $_[1]->content->present ($_[0]) 190 . $_[1]->content->present ($_[0])
174}; 191};
175 192
176sub view_over { 193sub view_over {
177 local $indent = $indent + $_[1]->indent; 194 local $indent = $indent + $_[1]->indent;
355 glGetError; 372 glGetError;
356 373
357 if (defined $data) { 374 if (defined $data) {
358 glTexImage2D GL_TEXTURE_2D, 0, 375 glTexImage2D GL_TEXTURE_2D, 0,
359 $self->{internalformat}, 376 $self->{internalformat},
360 $tw, $th, # need to pad texture first 377 $tw, $th,
361 0, 378 0,
362 $self->{format}, 379 $self->{format},
363 $self->{type}, 380 $self->{type},
364 $data; 381 $data;
365 CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x", 382 CFClient::gl_check "uploading texture %dx%d if=%x f=%x t=%x",
371 $tw, $th, 388 $tw, $th,
372 0; 389 0;
373 CFClient::gl_check "copying to texture %dx%d if=%x", 390 CFClient::gl_check "copying to texture %dx%d if=%x",
374 $tw, $th, $self->{internalformat}; 391 $tw, $th, $self->{internalformat};
375 } 392 }
393
394 glBindTexture GL_TEXTURE_2D, 0; # just to be on the safe side
376} 395}
377 396
378sub DESTROY { 397sub DESTROY {
379 my ($self) = @_; 398 my ($self) = @_;
380 399
382 401
383 glDeleteTexture delete $self->{name} 402 glDeleteTexture delete $self->{name}
384 if $self->{name}; 403 if $self->{name};
385} 404}
386 405
387sub restore_state{ 406sub restore_state {
388 $_->upload 407 $_->upload
389 for values %TEXTURES; 408 for values %TEXTURES;
390}; 409}
391 410
3921; 4111;
393 412
394=back 413=back
395 414

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines