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.19 by root, Mon Apr 10 19:34:03 2006 UTC vs.
Revision 1.20 by root, Mon Apr 10 22:16:33 2006 UTC

31 %GL_EXT = map +($_ => 1), split /\s+/, gl_extensions; 31 %GL_EXT = map +($_ => 1), split /\s+/, gl_extensions;
32 32
33 $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2; 33 $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2;
34 34
35 Crossfire::Client::Texture::restore_state (); 35 Crossfire::Client::Texture::restore_state ();
36
37# $GL_NPOT=0;#d#
38} 36}
39 37
40sub find_rcfile($) { 38sub find_rcfile($) {
41 my $path; 39 my $path;
42 40
191 $data = $pb->get_pixels; 189 $data = $pb->get_pixels;
192 } 190 }
193 191
194 my ($tw, $th) = @$self{qw(width height)}; 192 my ($tw, $th) = @$self{qw(width height)};
195 193
196 unless ($NPOT) { 194 unless ($GL_NPOT) {
197 $tw = topot $tw; 195 $tw = topot $tw;
198 $th = topot $th; 196 $th = topot $th;
199 197
200 if (defined $data) { 198 if (defined $data) {
201 $data = pack "(a$tw)*", (unpack "(a$self->{width})*", $data); 199 my $bpp = (length $data) / ($self->{width} * $self->{height});
200 $data = pack "(a" . ($tw * $bpp) . ")*",
201 unpack "(a" . ($self->{width} * $bpp) . ")*", $data;
202 $data .= ("\x00" x $tw) x ($th - $self->{height}); 202 $data .= ("\x00" x ($tw * $bpp)) x ($th - $self->{height});
203 } 203 }
204 } 204 }
205 205
206 $self->{u} = $self->{width} / $tw; 206 $self->{s} = $self->{width} / $tw;
207 $self->{v} = $self->{height} / $th; 207 $self->{t} = $self->{height} / $th;
208 208
209 $self->{name} ||= (glGenTextures 1)->[0]; 209 $self->{name} ||= (glGenTextures 1)->[0];
210 210
211 glBindTexture GL_TEXTURE_2D, $self->{name}; 211 glBindTexture GL_TEXTURE_2D, $self->{name};
212 212
213 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST; 213 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR;
214 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST;#_MIPMAP_LINEAR; 214 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR;#_MIPMAP_LINEAR;
215 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP; 215 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP;
216 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP; 216 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP;
217 217
218 glGetError; 218 glGetError;
219 if (defined $data) { 219 if (defined $data) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines