--- deliantra/Deliantra-Client/DC.pm 2006/04/10 19:34:03 1.19 +++ deliantra/Deliantra-Client/DC.pm 2006/04/10 22:16:33 1.20 @@ -33,8 +33,6 @@ $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2; Crossfire::Client::Texture::restore_state (); - -# $GL_NPOT=0;#d# } sub find_rcfile($) { @@ -193,25 +191,27 @@ my ($tw, $th) = @$self{qw(width height)}; - unless ($NPOT) { + unless ($GL_NPOT) { $tw = topot $tw; $th = topot $th; if (defined $data) { - $data = pack "(a$tw)*", (unpack "(a$self->{width})*", $data); - $data .= ("\x00" x $tw) x ($th - $self->{height}); + my $bpp = (length $data) / ($self->{width} * $self->{height}); + $data = pack "(a" . ($tw * $bpp) . ")*", + unpack "(a" . ($self->{width} * $bpp) . ")*", $data; + $data .= ("\x00" x ($tw * $bpp)) x ($th - $self->{height}); } } - $self->{u} = $self->{width} / $tw; - $self->{v} = $self->{height} / $th; + $self->{s} = $self->{width} / $tw; + $self->{t} = $self->{height} / $th; $self->{name} ||= (glGenTextures 1)->[0]; glBindTexture GL_TEXTURE_2D, $self->{name}; - glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST; - glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST;#_MIPMAP_LINEAR; + glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR; + glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR;#_MIPMAP_LINEAR; glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP; glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP;